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 using the command called ifconfig. On CentOS 6.x and before, ifconfig command by default is used to ship. Whereas in minimal installed CentOS, I have not found ifconfig command. This was due to “net-tools” not being 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, 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 the step-by-step installation of Ifconfig on a CentOS 7 server.
- A server running one of the following operating systems: CentOS 7.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
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 the
ip addr command:
[firstname.lastname@example.org ~]# 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 127.0.0.1/8 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 10.0.0.15/24 brd 10.0.0.255 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
[email@example.com ~]# yum install net-tools Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.mirror.iweb.ca * extras: mirror.csclub.uwaterloo.ca * updates: mirror.csclub.uwaterloo.ca 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 ========================================================================================================================================================== Installing: 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 Installed: net-tools.x86_64 0:2.0-0.17.20131004git.el7 Complete!
and then you can use it
[firstname.lastname@example.org ~]# ifconfig enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.0.0.15 netmask 255.255.255.0 broadcast 10.0.2.255 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 127.0.0.1 netmask 255.0.0.0 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.