-
cd /etc/sysconfig/network-scripts
2
2.
vi ifcfg-em1
内容为:其中NETWORK=192.168.100.0 那一行,一开始我写的是GATEWAY=192.168.100.0,配置完后上不了外网,遂改成NETWORK=192.168.100.0
TYPE="Ethernet"
#BOOTPROTO="dhcp"
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="em1"
UUID="4f722ada-5eec-4b52-9dce-7f5336f47cee"
DEVICE="em1"
#ONBOOT="yes"
NM_CONTROLLED=yes
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.100.231 #地址
NETMASK=255.255.255.0 #子网掩码
NETWORK=192.168.100.0 #网关
HWADDR=20:04:0f:ed:fa:e0
3.添加dns vi/etc/resolv.conf 添加8.8.8.8 和 4.4.4.4
nameserver=202.102.152.3
nameserver=202.102.154.3
nameserver 8.8.8.8
nameserver 4.4.4.4
4.重启网络服务
service network restart