cd /etc/sysconfig/network-scripts
2java
2.網絡
vi ifcfg-em1
內容爲:其中NETWORK=192.168.100.0 那一行,一開始我寫的是GATEWAY=192.168.100.0,配置完後上不了外網,遂改爲NETWORK=192.168.100.03d
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.4rest
nameserver=202.102.152.3 nameserver=202.102.154.3 nameserver 8.8.8.8 nameserver 4.4.4.4
4.重啓網絡服務code
service network restart