linux网络配置正确,能够ping通外网地址,无法打开网页问题
作者:北国熊linux网络配置正确,能够ping通外网地址,无法打开网页问题首先确定系统的网络配置没有问题,并且能够访问外网,通过以下方法进行确认:[root@localhost ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0 # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)DEVICE=eth0BOOTPROTO=noneHWADDR=00:50:56:bd:00:56ONBOOT=yesNETMASK=255.255.255.0IPADDR=172.16.6.50GATEWAY=172.16.6.1TYPE=Ethernet [root@localhost ~]# ping 172.16.6.1PING 172.16.6.1 (172.16.6.1) 56(84) bytes of data.64 bytes from 172.16.6.1: icmp_seq=1 ttl=255 time=0.890 ms64 bytes from 172.16.6.1: icmp_seq=2 ttl=255 time=0.841 ms--- 172.16.6.1 ping statistics ---2 packets transmitted, 2 received, 0% packet loss, time 999msrtt min/avg/max/mdev = 0.841/0.865/0.890/0.038 ms在确定网络没问题的情况下,可以通过如下步骤寻找解决办法:1) 确定设置了域名服务器[root@localhost ~]# more /etc/resolv.conf search localdomain nameserver 8.8.8.8 #谷歌的免费DNS2) 确定设置了网关[root@localhost ~]# grep GATEWAY /etc/sysconfig/network-scripts/ifcfg*-------------------------------------------------------------------/etc/sysconfig/network-scripts/ifcfg-eth0:GATEWAY=172.16.6.1-------------------------------------------------------------------如果没有设置,可以通过如下两种方式增加网关:a.[root@localhost ~]# route add default gw 192.168.40.1b.[root@localhost ~]#vi /etc/sysconfig/network-scripts/ifcfg*重启network服务:[root@localhost ~]# service network restart3) 确定可用dns解析[root@localhost ~]# grep hosts /etc/nsswitch.conf-------------------------------------------------------------------hosts: files dns-------------------------------------------------------------------排除以上情况,问题基本上可以解决……