Hope is a good thing, and maybe the best thing of all

编程不止是一份工作,还是一种乐趣!!!

cent os7静态IP设置

修改/etc/sysconfig/network-scripts/ifcfg-ens33文件:

BOOTPROTO="static" #dhcp改为static   
ONBOOT="yes" #开机启用本配置  
IPADDR=192.168.0.161 #静态IP  
GATEWAY=192.168.0.1 #默认网关  
NETMASK=255.255.255.0 #子网掩码  
DNS1=192.168.0.1 #DNS 配置  

然后重启network服务:

sudo systemctl restart network.service