ifconfig is a command-line utility to view network interfaces attached to Linux machines and network information such as IP address(es), netmask, etc.. assigned to network interfaces.
Also, it displays the count of sent and received network packets along with counts of error and dropped packets.
When you do a minimal installation of CentOS 8 / RHEL 8, you might get an error like command not found when you run ifconfig command.
READ: How To Install CentOS 8 – Step by Step Guide (with screenshots)
READ: How To Install RHEL 8 – Step by Step Guide (with screenshots)
-bash: ifconfig: command not found
This guide will help you to install the necessary packages for getting ifconfig command.
Install ifconfig Package
Let us see which package provides us ifconfig command using the YUM command.
yum whatprovides ifconfig
Output:
CentOS-8 - AppStream 1.1 MB/s | 6.3 MB 00:05
CentOS-8 - Base 954 kB/s | 7.9 MB 00:08
CentOS-8 - Extras 569 B/s | 2.1 kB 00:03
Extra Packages for Enterprise Linux 8 - x86_64 617 kB/s | 3.2 MB 00:05
net-tools-2.0-0.51.20160912git.el8.i686 : Basic networking tools
Repo : BaseOS
Matched from:
Filename : /usr/sbin/ifconfig net-tools-2.0-0.51.20160912git.el8.x86_64 : Basic networking tools
Repo : BaseOS
Matched from:
Filename : /usr/sbin/ifconfig
From the above command, you can see that the net-tools package provides you ifconfig command. Now, install the net-tools package using the yum command.
yum -y install net-tools
Output:
Last metadata expiration check: 0:00:51 ago on Mon 04 Nov 2019 09:07:03 AM EST. Dependencies resolved. ========================================================================================= Package Arch Version Repository Size ========================================================================================= Installing: net-tools x86_64 2.0-0.51.20160912git.el8 BaseOS 323 k Transaction Summary ========================================================================================= Install 1 Package Total download size: 323 k Installed size: 1.0 M Downloading Packages: net-tools-2.0-0.51.20160912git.el8.x86_64.rpm 264 kB/s | 323 kB 00:01 ----------------------------------------------------------------------------------------- Total 148 kB/s | 323 kB 00:02 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : net-tools-2.0-0.51.20160912git.el8.x86_64 1/1 Running scriptlet: net-tools-2.0-0.51.20160912git.el8.x86_64 1/1 Verifying : net-tools-2.0-0.51.20160912git.el8.x86_64 1/1 Installed: net-tools-2.0-0.51.20160912git.el8.x86_64 Complete!
Once the installation is complete, then run ifconfig to see whether it is available or not.
ifconfig
Output:
Conclusion
That’s All. You now have the ifconfig command available on your CentOS 8 / RHEL 8 machine.