centos7 sets the IP to a fixed value:
Recommended related video tutorials: linux video tutorial
Enter the IP of the system The directory where the address save file is located
[root@localhost ~]# cd /etc/sysconfig/network-scripts
Modify the file that saves IP information
[root@localhost ~]# vim ifcfg-eth0 (The name on your machine may not be this, but it is ifcfg -eth files)
Save and exit
Restart the network
[root@localhost ~]# service network restart
Note: If your virtual machine is found I can't connect to the Internet. When I ping the fixed address, it appears: connect:Network is unreachable; and when I use the following command to check the IP, I find that the IP is not the fixed value you set.
[root@localhost ~]# ip addr
It is very likely that the local network card is not started. At this time we use the following command to start the network card.
[root@localhost ~]# ifup eth0
Recommended tutorial: centos tutorial
The above is the detailed content of How to fix IP in centos7. For more information, please follow other related articles on the PHP Chinese website!