Should I quit using Ifconfig?
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.
Solution 4
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
Related videos on Youtube
Zhen
I'm a Game Programmer at soul but currently I work as System Administrator. To see me rant: http://malcodigo.blogspot.com To see me walk: http://zhenpaseando.blospot.com To just see me: Napoli, Italia. My best known work: Doodle Hex for Nintendo DS, Cell & Love for Android and Altamira II Supercomputer for the RES.
Updated on September 18, 2022Comments
-
Zhen almost 2 years
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 theip
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.
-
Charles over 11 yearsThe 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, arghipconfig
" -
ott-- over 11 yearsMaybe an alias will help:
alias ipconfig='echo ipconfig is deprecated, use ip instead'
. Of course you set up more senseful aliases. -
wim over 11 years
ifconfig
is deprecated? I must have been living in a cave -
James O'Gorman over 11 yearsI find it curious that a command called "ip" has the capability to do link-level operations.
-
Stefan Lasiewski over 11 yearsIt'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.
-
BatchyX over 11 yearsifconfig's latest version on Linux dates back from 1999. I consider that "obsolete".
-
Michael Hampton over 11 yearsAs of Fedora 18,
ifconfig
,netstat
etc. are no longer shipped with the OS by default. Among other things, this means that RHEL 7 probably won't have them. They can still be installed from thenet-tools
package if you really need them (though you probably don't). -
Kedare over 11 yearsSure it strange if "ip" also manage other protocol than the IP Protocol... Like Infiniband here
-
Luke Sheppard over 4 yearsPer what @ott said, I add this at the bottom of my
.bashrc
file:alias ifconfig='echo -e "\nifconfig is deprecated, use \033[31;1mip -brief addr show\033[0m instead\n" && ip -brief addr show'
. -
Admin almost 2 yearsBecause ubuntu 2004 drop ifconfig and ping in docker . I think openwrt or busybox is better than ubuntu.
-
-
Coops over 11 yearsI also like its cisco-esque command shortening. "ip a" = "ip address show"
-
Jason Antman over 11 yearsmeh. 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...
-
ctype.h over 11 yearsI've never heard of
ip
. I just tested it on a FreeBSD server and it saysip: Command not found.
. Maybeifconfig
is only deprecated on Linux. -
BatchyX over 11 years@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. -
Bryan Mills over 11 yearsInteresting 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
-
BatchyX over 11 years@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 toip a
,ip link show
toip l
,ip link set eth0 up
toip l set eth0 up
and so on. This bringsip
on par withifconfig
. -
voretaq7 over 11 yearsJust 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... -
Kaz over 11 yearsip has been the replacement for ifconfig on Linux, as a choice made by some distros.
-
Kaz over 11 years"The command /bin/ip has been around for some time now." On some distributions of Linux. Everywhere else, it's some variation on ifconfig.
-
Philip about 11 years
ifconfig
was developed by BSD back in the day. Linux essentially used BSD's IP stack (as did Windows and others of the time, whyipconfig
is still similar toifconfig
). In the 2.4 Kernel Linux starting diverging heavily from BSD's stack, that was the beginning of 2001. It's not happenstance thatifconfig
in Linux hasn't been well maintained since then. -
ott-- about 11 yearsYour first example answers it. Why run 2 commands when 1 does it?
-
Oupkar Sandhu about 11 years10 years!? Time to launch a "save ifconfig" project on GitHub, I guess.
-
Brian Knoblauch over 9 yearsip may have been around for some time, but it's the first I've even heard of it. I do mostly manage BSD and Solaris servers though. The few Linux ones I work on, I always go with what I know first (ifconfig) and it's always worked so I've never had reason to search out another tool...
-
nyuszika7h over 9 years@ott
ip addr show
pretty much includes the output ofip link show
. -
ericx over 8 yearsI find the output from
ip route list
to be a bit thin on information compared tonetstat -nr
-
Pablo A over 6 yearsI find the output of
ip
pretty ugly and unreadable, so I usually pipe it tocolumn -t
. -
Jasen over 6 yearsit 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. ifeth0
already has 2 ip addresses on it (two on it, not one one an alias like eth0:1). -
Jasen over 6 years
ip addr show
can be shortened toip a
and sure you may like the look of the ifconfig output. but ifconfig's output doesn't always list all the ip addresses. in my book thats pretty broken. -
Seamus almost 4 years
ip
is all well and good. But it seems odd to me that after 11+ years, it still cannot tell if an Ethernet device is connected to an upstream router/switch/etc. To be clear:ifconfig
can reportRUNNING
if eth0 is connected, but there is no combination of verbs or options inip
that will give you that information. -
Seamus almost 4 years
ifconfig
reportsRUNNING
in its output if the Enet interface is connected to a switch/router.ip
appears to have no equivalent for that in Sep, 2020. ??? -
Governa over 3 yearsIf I'm not mistaken, ifconfig's "RUNNING" == "state UP" in ip link. Not to be confused with the UP in flags field...