Linux无法连接外网

来源:互联网 发布:部落冲突详细数据 编辑:程序博客网 时间:2024/05/21 17:16

注:转自 Linux无法连接外网


1、检查当前环境配置的IP信息

            

2、检查网络配置是否正确

       [root@hadoop/]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

        
DECIVE=eth0     //指向的网络配置文件
IPADDR=192.168.1.226    //IP地址 
GATEWAY=192.168.1.1  //网关地址
DNS1=8.8.8.8                    //DNS解析服务器
NETMASK=255.255.255.0  //子网掩码 

3、ping一下设置的网关是否能够ping通,如果网关无法连通,则需要修改 /etc/sysconfig/network-scripts/ifcfg-eth0文件下的网关地 址

       [root@hadoop/]# ping 192.168.1.1 

       

4、检查DNS服务器是否正确,使用命令

         [root@hadoop etc]# cat  resolv.conf

         

5、ping配置的DNS服务解析地址,看是否能够ping通,如果无法连通,则需要修改,但必须保证是正常的能使用的DNS地址

         

6、只有上述配置都无误后,就可以连通外网资源,再进行测试,是否能ping通外网资源

            [root@hadoop etc]# ping www.baidu.com

            


             nslookup baidu.com检查是否能用DNS解析百度的域名

            [root@hdp2 ~]# nslookup baidu.com
              

               Server:         8.8.8.8
               Address:        8.8.8.8#53

              Non-authoritative answer:
              Name:   baidu.com
              Address: 220.181.57.217
              Name:   baidu.com
              Address: 111.13.101.208
              Name:   baidu.com
              Address: 123.125.114.144



            

            

原创粉丝点击