【centos】CentOS设置固定ip
1、编辑网卡配置文件:
# vi /etc/sysconfig/network-scripts/ifcfg-ethxxx
2、新增或修改以下内容:
BOOTPROTO="static" #dhcp改为static
ONBOOT="yes" #开机自启网卡
IPADDR=192.168.1.128 # ip地址
GATEWAY=192.168.1.1 # 网关
NETMASK=255.255.255.0 #子网掩码
DNS1=192.168.1.1 #dns
3、重启网卡服务:
service network restart