Sunday 24 November 2019

How to resolve “-bash: ifconfig: command not found” on CentOS 8



By default ifconfig command is not available in CentOS8 minimal installation and other Linux distributions. ifconfig command is available by installing package net-tools. ip a command can be used instead of ifconfig command on CentOS8 minimal installation.
This article describes How to resolve “-bash: ifconfig: command not found” on CentOS8.

[root@linuxcnf ~]# ifconfig
-bash: ifconfig: command not found
[root@linuxcnf ~]#

Step 1. Package Installation: Run the following command to install net-tools package:

[root@linuxcnf ~]# dnf install net-tools
CentOS-8 – AppStream
…………………….
Installed:
  net-tools-2.0-0.51.20160912git.el8.x86_64

Complete!
[root@linuxcnf ~]#

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

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

[root@linuxcnf ~]# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.43.168  netmask 255.255.255.0  broadcast 192.168.43.255
        inet6 fe80::7b8b:a3a1:a54b:5bb2  prefixlen 64  scopeid 0x20<link>
        inet6 2405:204:3014:5b7d:3219:8b07:a73c:3565  prefixlen 64  scopeid 0x0<global>
        inet6 2405:204:30aa:dedf:c8fe:ecd8:149:6ca6  prefixlen 64  scopeid 0x0<global>
        ether 08:00:27:83:e3:fa  txqueuelen 1000  (Ethernet)
        RX packets 13571  bytes 16761854 (15.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7097  bytes 616118 (601.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@linuxcnf ~]#

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

No comments:

Post a Comment