Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 12 down vote accepted

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.

share|improve this answer

ifconfig is a traditional command to display information about network interfaces and change some settings. In particular, it can bring interfaces up and down. It exists on most unix variants.

On Linux, the ifconfig command hasn't evolved in a long time. It's still perfectly fine for what it does. If you're using ifconfig for something, there's no reason to stop.

Linux also provides the ip command from the iproute2 tool suite. The ip command combines several classical commands and more, including ifconfig, route and arp. ip can do a lot more than ifconfig. On the other hand, ip isn't always present, especially on embedded systems (and never on unix variants other than Linux).

Parsing ifconfig's output kinda sucks. Parsing ip's output kinda sucks. No winner there.

share|improve this answer
    
I've always thought parsing ip's output to be fairly simple, and certainly a heck of a lot simpler than ifconfig. I also love that in many cases the output of an ip command can be used as the input to another ip command with little or no modification (for example, every line of ip route show can be used as the arguments to ip route add). –  Patrick Oct 4 '13 at 4:21
    
@Patrick parsing the ip route, and ip rule output is pretty clear and pretty easy to parse. But ip link, or ip addr is a pain. I really wish someone would submit a patch or something to make the ip addr print out the exact statements, perhaps with a switch, that you would use setup the current config, like you get with ip route show. –  Zoredache Oct 4 '13 at 4:59

Just to add some bits to the answer by pilona. Around 2005 a new mechanism for controlling the network stack was introduced - netlink sockets.

To configure the network interface iproute2 makes use of that full-duplex netlink socket mechanism, while ifconfig relies on ioctl system call. Here are 2 main papers on motivation behind netlink and usage of rtnetlink.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.