1. Open the network card configuration file
vim /etc/sysconfig/network-scripts/ifcfg-ens32
2. Modify the following configuration options
(1) bootproto=static
(2)onboot=yes
(3) Add a few lines at the end, IP address, subnet mask, gateway, dns server
IPADDR=192.168.1.160 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DNS1=119.29.29.29 DNS2=8.8.8.8
3. Restart the network service
[root@mini ~]# systemctl restart network
Recommended tutorial: centos tutorial
The above is the detailed content of How to set a static IP address in centos7. For more information, please follow other related articles on the PHP Chinese website!