After Centos installation is complete, ifconfig: command not found

1. Problem: I just installed centos7 at the minimum and want to check the local IP address. Then run ifconfig, and an error popped up as a result.

2. Troubleshooting: First of all, we understand whether it is caused by not turning on the network card? We can check through the following 3 methods;

  1) Ping Baidu to find out whether the network card is enabled


 2) Confirm whether the network card is enabled by entering ip addr to check whether the IP address can be obtained

 3) Through cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 (ifcfg-enp0s3 is the name of the network card, different machines are different.) Whether NBOOT is turned on (meaning whether the network card is turned on).

3. Conclusion of troubleshooting

   1) If it can be pinged, it means that the network card is enabled and can obtain an IP address to access the Internet. (If not, you can use vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 to change ONBOOT to yes. Change BOOTPROTO to dhcp, or to obtain the IP address manually, see Centos7 network configuration for details) Note: After modification Need to restart the network card (command: service network restart)

   2) The obtained IP address can be checked through ip addr, which proves that the network card is enabled. If you can’t get it, please modify the network configuration file. Note: You need to restart the network card after modification (command: service network restart)

   3) Check whether the network card is enabled through cat /etc/sysconfig/network-scripts/ifcfg-enp0s3, if not, use vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 to modify the network configuration file.

Summary: At this time, it can be determined that ifconfig related tools are not installed.

4. Use yum provides ifconfig to check which package to improve ifconfig, and install it.


  Then execute yum install net-tools

  Then enter: ifconfig command to test

  The version of the net-tools package can be displayed here, and the information related to the IP address can be viewed.

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *