Saturday, 14 September 2019

How to resolve “-bash: /usr/sbin/ifconfig: No such file or directory” on CentOS 7



The ifconfig command deprecated in CentOS 7 minimal installation and most of the Linux distributions. The ip a command can used instead of ifconfig command. The following steps describes installation of ifconfig command on CentOS 7.

[root@linuxcloudy ~]# ifconfig
-bash: /usr/sbin/ifconfig: No such file or directory
[root@linuxcloudy ~]#

Step 1. Ifconfig command binary installation: Run the following command to install ifconfig command:

[root@linuxcloudy ~]# yum install net-tools
Loaded plugins: fastestmirror
……………………………..
Installed:
  net-tools.x86_64 0:2.0-0.24.20131004git.el7

Complete!
[root@linuxcloudy ~]#

Step 2. Verify the installation: Run the following commands to verify the installation:

[root@linuxcloudy ~]# which ifconfig
/usr/sbin/ifconfig
[root@linuxcloudy ~]#

[root@linuxcloudy ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.43.14  netmask 255.255.255.0  broadcast 192.168.43.255
        inet6 2405:204:1292:dedb:1365:4b78:ffb4:3e45  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::c3fe:1825:631e:f1cb  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:08:30:d4  txqueuelen 1000  (Ethernet)
        RX packets 12987  bytes 17611665 (16.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6113  bytes 563230 (550.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 20  bytes 1720 (1.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20  bytes 1720 (1.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@linuxcloudy ~]#

Done!!! Now the ifconfig command is available in the system.

No comments:

Post a comment