190

With the servers that mount Infiniband cards, when I use the ifconfig command, I get this warning:

Ifconfig uses the ioctl access method to get the full address 
information, which limits hardware addresses to 8 bytes.
Because Infiniband address has 20 bytes, only the first 8 bytes 
are displayed correctly.
Ifconfig is obsolete! For replacement check ip.

Should I quit using ifconfig? Is it deprecated in favor of the ip command? Or will it be updated in the near future?

Note: This question and answers are in regards to GNU/Linux's "major" distributions. It should not be assumed that the information applies to all distributions, and especially not other OSes.

10
  • 25
    The sooner you switch, the better. It took me months to replace the muscle-memory of ifconfig. It does make operations on Windows even more fun though. "ip add-no, wait, that's not it, ifcon-NO, argh ipconfig"
    – Charles
    Dec 17, 2012 at 10:09
  • 8
    Maybe an alias will help: alias ipconfig='echo ipconfig is deprecated, use ip instead'. Of course you set up more senseful aliases.
    – ott--
    Dec 17, 2012 at 10:13
  • 103
    ifconfig is deprecated? I must have been living in a cave
    – wim
    Dec 17, 2012 at 14:00
  • 31
    I find it curious that a command called "ip" has the capability to do link-level operations. Dec 17, 2012 at 20:34
  • 12
    It's only deprecated on certain operating systems. If you use stuff outside of Linux, I believe that ifconfig is still in use. I see no such warning on FreeBSD, for example. Dec 18, 2012 at 2:58

4 Answers 4

169

Quoting Thomas Pircher's website (cc-by-sa):

ifconfig vs ip

The command /bin/ip has been around for some time now. But people continue using the older command /sbin/ifconfig. Let's be clear: ifconfig will not quickly go away, but its newer version, ip, is more powerful and will eventually replace it.

The man page of ip may look intimidating at first, but once you get familiar with the command syntax, it is an easy read. This page will not introduce the new features of ip. It rather features a side-by-side comparison if ifconfig and ip to get a quick overview of the command syntax.

Show network devices and configuration

ifconfig

ip addr show
ip link show

Enable a network interface

ifconfig eth0 up
ip link set eth0 up

A network interface is disabled in a similar way:

ifconfig eth0 down
ip link set eth0 down
11
  • 56
    Interesting how in every use case you mentioned the ip command is longer and more complex. Probably going to be a primary reason people still use ifconfig
    – TheLQ
    Dec 18, 2012 at 18:20
  • 23
    @TheLQ: ip provides much, much more features. Of course it is more complex. Anyway, many commands can be shortened. e.g. ip addr show can be shortened to ip a, ip link show to ip l, ip link set eth0 up to ip l set eth0 up and so on. This brings ip on par with ifconfig.
    – BatchyX
    Dec 18, 2012 at 19:32
  • 19
    Just remember, the entire world is not a Linux machine. Solaris, AIX, HP-UX, all of the BSDs, and SCO (not that anyone cares about them) all use ifconfig. If you want to be a unix admin (not just a Linux admin) you should make sure you're at least familiar with ifconfig and its basic syntax...
    – voretaq7
    Dec 19, 2012 at 18:17
  • 10
    Your first example answers it. Why run 2 commands when 1 does it?
    – ott--
    Apr 30, 2013 at 18:21
  • 6
    @ott ip addr show pretty much includes the output of ip link show. Nov 20, 2014 at 18:57
47

Yes, ifconfig is deprecated in favor of iproute2 (the ip command) on Linux.

Similarly, the arp, route and netstat commands are also deprecated.

However, iproute2 is Linux specific, when some other Unixes use ifconfig, so it may help to know/remember how it works if you're ever going to use another Unix...

To learn the "new way", I suggest you to look at those 3 links :

According to the last link, ifconfig has not been maintained for +20 years:

Except for the patch mass that Debian accumulated, the net-tools package has not seen any upstream development after version 1.60, released sometime about April 15 2001.

2
  • 9
    ifconfig was developed by BSD back in the day. Linux essentially used BSD's IP stack (as did Windows and others of the time, why ipconfig is still similar to ifconfig). In the 2.4 Kernel Linux starting diverging heavily from BSD's stack, that was the beginning of 2001. It's not happenstance that ifconfig in Linux hasn't been well maintained since then.
    – Chris S
    Apr 30, 2013 at 18:02
  • 5
    10 years!? Time to launch a "save ifconfig" project on GitHub, I guess.
    – kenchilada
    May 1, 2013 at 14:46
20

ifconfig is deprecated for many years now, time to switch, especially in a case like yours.

6
  • 1
    I also like its cisco-esque command shortening. "ip a" = "ip address show"
    – Coops
    Dec 17, 2012 at 11:15
  • 5
    meh. There's enough scripts and other tools around that are built over ifconfig, that I don't feel the need to switch until it disappears... Dec 17, 2012 at 19:55
  • 11
    I've never heard of ip. I just tested it on a FreeBSD server and it says ip: Command not found.. Maybe ifconfig is only deprecated on Linux.
    – ctype.h
    Dec 18, 2012 at 3:25
  • 2
    @ctype.h: Indeed, it is only deprecated on linux. ifconfig's release targetting linux dates back from 1999. ip was already the recommended choice for 2.4 kernels.
    – BatchyX
    Dec 18, 2012 at 18:15
  • ifconfig reports RUNNING in its output if the Enet interface is connected to a switch/router. ip appears to have no equivalent for that in Sep, 2020. ???
    – Seamus
    Sep 6, 2020 at 23:02
5

ip has been the replacement for ifconfig for a while, probably at some point ifconfig will update, however I wouldn't wait for it and learn to work with ip as well. Its supported on all linux distri's

2
  • 8
    ip has been the replacement for ifconfig on Linux, as a choice made by some distros.
    – Kaz
    Dec 19, 2012 at 22:51
  • it seems extremely unlikely that ifconfig could be made fully compatible with linux. commands like ifconfig eth0 192.168.0.7/24 do not have a clear meaning: eg. if eth0 already has 2 ip addresses on it (two on it, not one one an alias like eth0:1).
    – Jasen
    Mar 16, 2018 at 2:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .