su -
cd /etc/sysconfig/network-scripts/
ifconfig
vim ifcfg-eth0
BOOTPROTO=static
IPADDR=192.168.100.50
NETMASK=255.255.255.0
GATEWAY=192.168.100.1
DNS1=8.8.8.8
DNS2=8.8.4.4
注:BOOTPROTO 为网卡启动方式,设置为静态即可;DNS 可按需添加。
:wq!
systemctl restart network
ifconfig
systemctl restart network
ifconfig
这样您就学会了如何在 CentOS 7 上更换 IP 地址!