1、檢查網卡配置:
輸入ifconfig能夠查看當前網卡配置的IP地址而且查看配置文件中網絡的設置:linux
[root@bqh-01 ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:71:FC:1E inet addr:192.168.0.117 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe71:fc1e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:675 errors:0 dropped:0 overruns:0 frame:0 TX packets:357 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:53393 (52.1 KiB) TX bytes:31943 (31.1 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) [root@bqh-01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 #若沒有,手動添加便可 DEVICE=eth0 HWADDR=00:0C:29:71:FC:1E TYPE=Ethernet UUID=d1518dbb-7e56-46f3-94e4-f59927222526 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=static IPADDR=192.168.0.117 NETMASK=255.255.255.0 GATEWAY=192.168.0.1
2、檢查網卡網關設置:vim
[root@bqh-01 ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0 [root@bqh-01 ~]# ping 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. 64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=1.51 ms 64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=1.03 ms 64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.961 ms
若是未設置,則經過以下方式增長網關:route add default gw 192.168.0.1服務器
3、查看系統默認的網關(若是沒有,能夠vim手動添加一個上去)網絡
[root@bqh-01 ~]# cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=bqh-01 [root@bqh-01 ~]# echo "GATEWAY=192.168.0.1" >>/etc/sysconfig/network [root@bqh-01 ~]# cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=bqh-01 GATEWAY=192.168.0.1 [root@bqh-01 ~]# ping baidu.com ^C
4、檢查DNS設置:oop
出現 ping:unknown host 提示大部分緣由是 linux 設置的DNS解析不了spa
[root@bqh-01 ~]# cat /etc/resolv.conf nameserver 192.168.43.1 [root@bqh-01 ~]# sed -i s#43#0#g /etc/resolv.conf [root@bqh-01 ~]# cat /etc/resolv.conf nameserver 192.168.0.1 [root@bqh-01 ~]# ping www.baidu.com PING www.a.shifen.com (220.181.38.150) 56(84) bytes of data. 64 bytes from 220.181.38.150: icmp_seq=1 ttl=53 time=14.3 ms 64 bytes from 220.181.38.150: icmp_seq=2 ttl=53 time=14.4 ms ^C --- www.a.shifen.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1072ms rtt min/avg/max/mdev = 14.323/14.403/14.483/0.080 ms
建議域名服務器設置Google的公共DNS服務code