解决Linux Ping不通外网

1、检查DNS设置是否正常

>> long@happyhome:~$ cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 119.29.29.29

2、检查路由是否存在问题

>> long@happyhome:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG    100    0        0 eno1
192.168.2.0     0.0.0.0         255.255.255.0   U     100    0        0 eno1

没有第一条路由连接不了外网。

添加路由的方法:

>> sudo route add default gw 192.168.2.1

Search

    Table of Contents