Home >Operation and Maintenance >CentOS >What should I do if CentOS cannot access the Internet?

What should I do if CentOS cannot access the Internet?

angryTom
angryTomOriginal
2020-03-20 16:29:322543browse

What should I do if CentOS cannot access the Internet?

What to do if CentOS cannot access the external network

The solution to the problem that CentOS cannot access the external network is as follows:

1. Check Routing

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 ens33
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 ens33
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 ens33
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

Recommended learning:Website construction tutorial

If you are missing the first route, you will definitely not be able to ping the external network

2. Add dns

# vim /etc/resolv.conf
nameserver 8.8.8.8

3, add route

# route add default gw 192.168.0.1

4, restart the network card

service network restart

This article comes from PHP Chinese website, CentOS usage tutorialColumn, please pay attention to this column for more related tutorials!

The above is the detailed content of What should I do if CentOS 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