linux连不上网问题总结

最低级的错误没有关闭防火墙
1) 重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off
2) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop



1、检查当前环境配置的IP信息
            
linux连不上网问题总结
2、检查网络配置是否正确
       [[email protected]/]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
        
linux连不上网问题总结

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文件下的网关地 址
       [[email protected]/]# ping 192.168.1.1 
       
linux连不上网问题总结
4、检查DNS服务器是否正确,使用命令
         [[email protected] etc]# cat  resolv.conf
         
linux连不上网问题总结
5、ping配置的DNS服务解析地址,看是否能够ping通,如果无法连通,则需要修改,但必须保证是正常的能使用的DNS地址
         linux连不上网问题总结
6、只有上述配置都无误后,就可以连通外网资源,再进行测试,是否能ping通外网资源
            [[email protected] etc]# ping www.baidu.com
           
         linux连不上网问题总结