Home  >  Article  >  Operation and Maintenance  >  Linux cannot access the Internet

Linux cannot access the Internet

angryTom
angryTomOriginal
2019-11-07 11:28:484407browse

Linux cannot access the Internet

Linux cannot access the Internet

Turn off the firewall

1) It will take effect after restarting

开启: chkconfig iptables on
关闭: chkconfig iptables off

2) Effective immediately, invalid after restart
Open: service iptables start
Close: service iptables stop

1. Check the IP information of the current environment configuration

Linux cannot access the Internet

2. Check whether the network configuration is correct

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

Linux cannot access the Internet

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 Check whether the gateway set up can be pinged. If the gateway cannot be connected, you need to modify the gateway address in the /etc/sysconfig/network-scripts/ifcfg-eth0 file

[root@hadoop/]# ping 192.168.1.1

Linux cannot access the Internet

4. Check whether the DNS server is correct. Use the command

[root@hadoop etc]# cat  resolv.conf

Linux cannot access the Internet

5. Ping the configured DNS service resolution address to see if It can be pinged. If it cannot be connected, it needs to be modified, but it must be a normal and usable DNS address.

Linux cannot access the Internet

6. Only the above configurations are After everything is correct, you can connect to the external network resources and then test whether you can ping the external network resources.

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

Linux cannot access the Internet

Recommended: linux operation and maintenance tutorial

The above is the detailed content of Linux cannot access the Internet. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn