如何修复 Ubuntu 18.0.4 中的互联网连接

如何修复 Ubuntu 18.0.4 中的互联网连接

我刚刚升级到 18.04 LTS,即使连接到无线,互联网似乎也无法正常工作。我知道已经有几个关于同一主题的问题,但我找不到任何适合我的解决方案。

尝试 ping google.com,我得到ping: google.com: Name or service not known

我是网络新手,但我运行了以下命令来提供更多信息:

ifconfig:

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:90:5b:8d:8e  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:21:cc:c0:da:4d  txqueuelen 1000  (Ethernet)
        RX packets 6402  bytes 409728 (409.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 430  bytes 64072 (64.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xf2500000-f2520000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 8237  bytes 592857 (592.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8237  bytes 592857 (592.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.2  netmask 255.255.255.0  broadcast 192.168.100.255
        inet6 fe80::f121:abd2:7fe2:ef4a  prefixlen 64  scopeid 0x20<link>
        inet6 2a02:2f05:6205:d800:4d08:65a1:e15a:b5b4  prefixlen 64  scopeid 0x0<global>
        inet6 2a02:2f05:6205:d800:915e:95fb:ee10:4db6  prefixlen 64  scopeid 0x0<global>
        ether 8c:70:5a:64:88:2c  txqueuelen 1000  (Ethernet)
        RX packets 2313  bytes 2279322 (2.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1362  bytes 274783 (274.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ip a:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:21:cc:c0:da:4d brd ff:ff:ff:ff:ff:ff
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 8c:70:5a:64:88:2c brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.2/24 brd 192.168.100.255 scope global dynamic noprefixroute wlp3s0
       valid_lft 258163sec preferred_lft 258163sec
    inet6 2a02:2f05:6205:d800:4d08:65a1:e15a:b5b4/64 scope global temporary dynamic 
       valid_lft 603766sec preferred_lft 85231sec
    inet6 2a02:2f05:6205:d800:915e:95fb:ee10:4db6/64 scope global mngtmpaddr noprefixroute 
       valid_lft forever preferred_lft forever
    inet6 fe80::f121:abd2:7fe2:ef4a/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:90:5b:8d:8e brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever

答案1

通过添加以下几行来使其正常工作/etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

相关内容