How to Install ifconfig on CentOS 7

When it comes to configuring network interfaces in CentOS 7, the weapon of choice is the ip command. For instance, to get all the information regarding the currently configured interfaces, you can issue:


$ ip address show


There’s even a nifty shortcut, in the true spirit of the Unix world:


$ ip a s


This will spit out the details of your configured interfaces and IP addresses.


That said, some of you might be looking for the good old ifconfig command. Perhaps you’re a sysadmin who has perfected his arsenal on Debian system (like Ubuntu, for example), or maybe you’re a developer with painfully-collected DevOps skills and the thought of learning a new bunch of commands and options gives you a cold sweat.


In those cases, you will find your fingers reaching for ‘ifconfig’ but you are greeted with this message:


‘ifconfig’ Command not found


Oops! Don’t despair. This simply means that ifconfig isn’t installed on CentOS 7 by default, and the preferred way in the CentOS community is to use the ip command we met earlier.


But it’s super easy to install ifconfig on CentOS 7 and enjoy the interface you’re used to.


Installing ifconfig on CentOS 7


If you do the standard ‘yum install ifconfig’ you are going to hit a stonewall. That’s because ‘ifconfig’ isn’t a separate package on yum, but is provided as part of another package bundle. What is that bundle called? Well, we could tell you straight away, but it’s a better practice to dive deeper into the tools we use every day.


So, let’s ask yum where the package ifconfig can be found:


$ yum provides ifconfig


And out come the results:


Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base:

 * extras:

 * updates:

net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools

Repo        : @base

Matched from:

Filename    : /usr/sbin/ifconfig


If you scan through the output carefully, you’ll notice ‘net-tools’ being mentioned. That’s where the ifconfig program lives. So, without further wait, you just need to install net-tools:


$ sudo yum install net-tools


Once this is installed, just type ‘ifconfig’ at the command prompt and enjoy!