linux网络配置正确,能够ping通外网地址,无法打开网页问题


linux网络配置正确,能够ping通外网地址,无法打开网页问题
 
首先确定系统的网络配置没有问题,并且能够访问外网,通过以下方法进行确认:
[root@localhost ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0 
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:50:56:bd:00:56
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=172.16.6.50
GATEWAY=172.16.6.1
TYPE=Ethernet
       [root@localhost ~]# ping 172.16.6.1
PING 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 ms
64 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 999ms
rtt 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          #谷歌的免费DNS
 
2) 确定设置了网关
 
[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.1
 
b.
 
[root@localhost ~]#vi /etc/sysconfig/network-scripts/ifcfg*
重启network服务:
[root@localhost ~]# service network restart
 
 
3) 确定可用dns解析
 
[root@localhost ~]# grep hosts /etc/nsswitch.conf
-------------------------------------------------------------------
 
hosts: files dns
-------------------------------------------------------------------
 
排除以上情况,问题基本上可以解决……

相关内容

    暂无相关文章