Home  >  Article  >  Operation and Maintenance  >  Linux cannot connect to the external network

Linux cannot connect to the external network

王林
王林Original
2019-12-25 14:03:505018browse

Linux cannot connect to the external network

1. Check the IP information of the current environment configuration

Linux cannot connect to the external network

2. Check whether the network configuration is correct

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

Linux cannot connect to the external network

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

Online learning video sharing: linux video tutorial

3. Ping the set gateway to see if it can be pinged

If the gateway cannot Connected, you need to modify the gateway address under the /etc/sysconfig/network-scripts/ifcfg-eth0 file

[root@hadoop/]# ping 192.168.1.1

Linux cannot connect to the external network

4. Check whether the DNS server is Correct, use the command

[root@hadoop etc]# cat  resolv.conf

Linux cannot connect to the external network

5 to ping the configured DNS service resolution address to see if it can be pinged successfully. If it cannot be connected, it needs to be modified, but it must be guaranteed to be normal. Usable DNS addresses

Linux cannot connect to the external network

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

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

Linux cannot connect to the external network

Recommended related articles and tutorials: linux tutorial

The above is the detailed content of Linux cannot connect to the external network. 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