How To Fix Ifconfig Command Not Found on CentOS 7

Fix Ifconfig Command Not Found on CentOS 7

In this tutorial, we will show you how to fix ifconfig command not found on CentOS 7. A few days back I minimal installed CentOS 7 (x86_64) on my VPS system. On and before CentOS 6.x releases, I was habitual to use the command called ifconfig. On CentOS 6.x and before, ifconfig command by default used to ship. Whereas in minimal installed CentOS, I have not found ifconfig command. This was due to “net-tools” not installed by default. Install “net-tools” will solve the problem.

For those of you who didn’t know, “ifconfig” command is used to configure network interfaces in GNU/Linux systems. It displays the details of a network interface card like IP address, MAC Address, and the status of a network interface card, etc.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation of Ifconfig on a CentOS 7 server.

Fix Ifconfig Command Not Found on CentOS 7

In case you do not want to install an additional package and simply to see your IP address you can use IP addr command:

[ ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:eb:6b:89 brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic enp0s3
       valid_lft 85578sec preferred_lft 85578sec
    inet6 fe80::a00:27ff:feeb:6b89/64 scope link
       valid_lft forever preferred_lft forever

To get the ifconfig command into our system, run the below-given command:

yum install net-tools
[ ~]# yum install net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
 Package                            Arch                            Version                                           Repository                     Size
 net-tools                          x86_64                          2.0-0.17.20131004git.el7                          base                          304 k
Transaction Summary
Install  1 Package
Total download size: 304 k
Installed size: 917 k
Is this ok [y/d/N]: y
Downloading packages:
net-tools-2.0-0.17.20131004git.el7.x86_64.rpm                                                                                      | 304 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                                              1/1
  Verifying  : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                                              1/1
  net-tools.x86_64 0:2.0-0.17.20131004git.el7

and then you can use it

[ ~]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        inet6 fe80::a00:27ff:feeb:6b89  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:eb:6b:89  txqueuelen 1000  (Ethernet)
        RX packets 11316  bytes 14098176 (13.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3224  bytes 264337 (258.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet  netmask
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Congratulations! You have successfully installed ifconfig. Thanks for using this tutorial for installing the ifconfig on your CentOS 7 system. For additional help or useful information, we recommend you to check the official ifconfig website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!