地址:/etc/sysconfig/network-scripts
vi /etc/sysconfig/network-scripts/ifcfg-eth0
1、固定ip配置
DEVICE=eth0
HWADDR=70:e2:84:09:64:c9
BOOTPROTO=static #dhcp改为static
ONBOOT=yes #开机启用本配置IPADDR=192.168.7.106 #静态IPGATEWAY=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