How does Centos7 configure static IP addresses?
I. the method of configuring static IP address without using the network manager nmcli
Go to the / etc/sysconfig/network-scripts directory and find the configuration file (ifcfg-enp0s3) for the interface
Open configuration file to modify ifcfg-enp0s3BOOTPROTO and change it to static to join IPADDR, NETMASK, GATEWAY
3. Save the changes and restart the network service using the following command:
Systemctl restart network.service
4. Now verify that the interface is configured correctly:
Ip add
Network connectivity
2. The method of configuring static IP address by using network manager nmcli
1. View all connections
Nmcli connection show
two。 Configure static ip
Nmcli c modify enp0s3 ipv4.address 192.168.68.166 ipv4.gateway 192.168.68.1 ipv4.method manual
3. Restart the network service takes effect. Check ip.
Systemctl restart network.serviceip add