Set Static IP in CentOS 7: Step-by-Step
To set a static IP address on CentOS7, you can follow these steps:
- Open the network settings file.
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
- Edit the following lines in the file (modify the IP address, subnet mask, gateway, and DNS server according to the actual situation):
BOOTPROTO=static
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
- Save and close the file, then restart the network service.
sudo systemctl restart network
- Confirm the successful setting of the IP address.
ip addr show eth0
The above steps can assist you in successfully setting a static IP address on CentOS7.