Should I quit using Ifconfig?
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.
Solution 1:
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
Solution 2:
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 :
- iproute2: Life after ifconfig (the basics, from poumpoumk's answer),
- Deprecated Linux networking commands and their replacements (details),
-
Why ifconfig sucks (and how to use
ip
when it does).
According to the last link, ifconfig
has not been maintained for +15 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.
Solution 3:
ifconfig
is deprecated for many years now, time to switch, especially in a case like yours.