In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to solve the problem of being unable to access the public network in CentOS? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.
Phenomenon:
The private network of ping is normal.
Ping public network IP, domain names are not working properly. Error returned: connect: Network is unreachable
Later, I inadvertently saw that the Linux network was configured with the command to add a gateway:
Copy the code
The code is as follows:
Route add default gw 192.168.128.2 dev eth0
Do as above, after adding the default gateway. Everything is fine when you visit the public network again.
From this point of view, the gateway should not be configured in the configuration file, but it is confirmed that the GATEWAY address is configured in / etc/sysconfig/network, and the GATEWAY address is also correct. After restarting network many times, as long as you do not manually add the gateway, you cannot access the public network.
After carefully confirming each network configuration file many times, it is found that there is a NETWORK configuration item in the network card configuration file (ifcfg-eth0). The function of this configuration item is not very clear, so I went to the official website to check the instructions:
Copy the code
The code is as follows:
NETWORK=
Where is the network address. This directive is deprecated, as the value is calculated automatically with ifcalc.
This rhythm tells us that this parameter should not be set (deprecate). This value will be calculated automatically by ifcalc. Since there is no need to set it, it will be removed naturally.
After removing it and restarting the network service, the public network is miraculously able to access it. Use route to check the routing table and find that the message default can be added automatically, but it has not been available all the time:
Copy the code
The code is as follows:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.128.0 * 255.255.255.0 U 000 eth0
Link-local * 255.255.0.0 U 1002 00 eth0
Default 192.168.128.2 0.0.0.0 UG 0 0 0 eth0
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.