进入/etc/sysconfig/network-scripts/选择你需要改的网卡

然后把dhcp改为static,并在最下面增加:

ONBOOT=yes               //修改为yes, 网卡开机自启动
4.3 IPADDR="xxx.xxx.xxx.xxx"    //新增:配置静态IP地址,按需配置
4.4 NETMASK="255.xxx.xxx.xxx"   //新增:配置子网掩码
4.5 GATEWAY="xxx.xxx.xxx.xxx"   //新增:配置网关
4.6 DNS1="xxx.xxx.xxx.xxx"        //新增:配置DNS

模板:

IPADDR="192.168.1.10"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.254"
DNS1="8.8.8.8"

IPADDR="192.168.1.10"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.254"
DNS1="8.8.8.8"
IPADDR="192.168.1.10"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.254"
DNS1="8.8.8.8"