地址:/etc/sysconfig/network-scripts
1、固定ip配置
DEVICE=eth0
HWADDR=70:e2:84:09:64:c9
BOOTPROTO=static #dhcp改为static
ONBOOT=yes #开机启用本配置
IPADDR=192.168.7.106 #静态IP
GATEWAY=192.168.7.1 #默认网关
NETMASK=255.255.255.0 #子网掩码
DNS1=192.168.7.1 #DNS 配置
2、ip自动获取
DEVICE=eth0
HWADDR=70:e2:84:09:64:c9
NM_CONTROLLED=yes #即可生效
ONBOOT=yes #开机启动
BOOTPROTO=dhcp #自动获取
3、网卡重启
service network restart
ifconfig eth0 down / ifconfig eth0 up
ifdown eth0 / ifup eth0