Problem:
After configuring CentOS, I found that I could not access the Internet internally and could not ping the external IP.
Solution:
Check whether there is any problem with the network card settings and ensure that the IP address and GATEWAY are in the same network segment. Command: vim /etc/sysconfig/network-scripts/ifcfg-eth*.
(Recommended tutorial: centos usage tutorial)
Check whether the routing settings are correct. If there is no problem in the first step, then your IP and gateway can be pinged at this time. Use the command: route -n to view the routing settings of the system. For example: the IP address of my eth0 is 192.168.1.156 and the gateway is 192.168.1.2. If you want to connect to the external network address, there will be a route set as shown in the figure. The Destination is 0.0.0.0 at this time, indicating any address.
Check whether iptables (firewall) is configured correctly. If it is your own machine and there are no security requirements, you can turn off the firewall and run the command: service iptables stop
to set up a dns server. Command: vim etc/resolv.conf, add the following content: nameserver 8.8.8.8.
Finish!
Recommended related video tutorials: linux video tutorial
The above is the detailed content of The centos6.5 system cannot ping the external network. For more information, please follow other related articles on the PHP Chinese website!