Should I quit using Ifconfig?

77,705

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 :

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

Share:
77,705

Related videos on Youtube

Zhen
Author by

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, 2022

Comments

  • Zhen
    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 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.

    • Charles
      Charles over 11 years
      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"
    • ott--
      ott-- over 11 years
      Maybe an alias will help: alias ipconfig='echo ipconfig is deprecated, use ip instead'. Of course you set up more senseful aliases.
    • wim
      wim over 11 years
      ifconfig is deprecated? I must have been living in a cave
    • James O'Gorman
      James O'Gorman over 11 years
      I find it curious that a command called "ip" has the capability to do link-level operations.
    • Stefan Lasiewski
      Stefan Lasiewski over 11 years
      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.
    • BatchyX
      BatchyX over 11 years
      ifconfig's latest version on Linux dates back from 1999. I consider that "obsolete".
    • Michael Hampton
      Michael Hampton over 11 years
      As 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 the net-tools package if you really need them (though you probably don't).
    • Kedare
      Kedare over 11 years
      Sure it strange if "ip" also manage other protocol than the IP Protocol... Like Infiniband here
    • Luke Sheppard
      Luke Sheppard over 4 years
      Per 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
      Admin almost 2 years
      Because ubuntu 2004 drop ifconfig and ping in docker . I think openwrt or busybox is better than ubuntu.
  • Coops
    Coops over 11 years
    I also like its cisco-esque command shortening. "ip a" = "ip address show"
  • Jason Antman
    Jason Antman over 11 years
    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...
  • ctype.h
    ctype.h over 11 years
    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.
  • BatchyX
    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
    Bryan Mills over 11 years
    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
  • BatchyX
    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 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.
  • voretaq7
    voretaq7 over 11 years
    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...
  • Kaz
    Kaz over 11 years
    ip has been the replacement for ifconfig on Linux, as a choice made by some distros.
  • Kaz
    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
    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, 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.
  • ott--
    ott-- about 11 years
    Your first example answers it. Why run 2 commands when 1 does it?
  • Oupkar Sandhu
    Oupkar Sandhu about 11 years
    10 years!? Time to launch a "save ifconfig" project on GitHub, I guess.
  • Brian Knoblauch
    Brian Knoblauch over 9 years
    ip 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
    nyuszika7h over 9 years
    @ott ip addr show pretty much includes the output of ip link show.
  • ericx
    ericx over 8 years
    I find the output from ip route list to be a bit thin on information compared to netstat -nr
  • Pablo A
    Pablo A over 6 years
    I find the output of ip pretty ugly and unreadable, so I usually pipe it to column -t.
  • Jasen
    Jasen over 6 years
    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
    Jasen over 6 years
    ip addr show can be shortened to ip 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
    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 report RUNNING if eth0 is connected, but there is no combination of verbs or options in ip that will give you that information.
  • Seamus
    Seamus almost 4 years
    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. ???
  • Governa
    Governa over 3 years
    If I'm not mistaken, ifconfig's "RUNNING" == "state UP" in ip link. Not to be confused with the UP in flags field...