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
Release: 2020-03-20 16:29:32
Original
2542 people have browsed it

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
Copy after login

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
Copy after login

3, add route

# route add default gw 192.168.0.1
Copy after login

4, restart the network card

service network restart
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template