Linux Networking – Difference Between ‘ifconfig’ and ‘ip’ Commands

commandiplinuxnetworking

I read some articles/tutorials on 'ifconfig' command, most of them included a common statement –

"ifconfig is deprecated by ip command"

and suggested to learn ip command. But none of them explained how 'ip' command is more powerful than 'ifconfig'.

What is the difference between both of them?

Best Answer

ifconfig is from net-tools, which hasn't been able to fully keep up with the Linux network stack for a long time. It also still uses ioctl for network configuration, which is an ugly and less powerful way of interacting with the kernel.

A lot of changes in Linux networking code, and a lot of new features aren't accessible using net-tools: multipath routing, policy routing (see the RPDB). route allows you to do stupid things like adding multiple routes to the same destination, with the same metric.

Additionally:

  • ifconfig doesn't report the proper hardware address for some devices.
  • You can't configure ipip, sit, gre, l2tp, etc. in-kernel static tunnels.
  • You can't create tun or tap devices.
  • The way of adding multiple addresses to a given interface also has poor semantics.
  • You also can't configure the Linux traffic control system using net-tools either.

See also ifconfig sucks.

EDIT: Removed assertion about net-tools development ceasing that by now I forgot where I got for this post. net-tools' has been worked on since iproute2 was released, though it's mostly bug fixing and minor enhancements and features, like internationalization.