没有使用我的VPN和Ubuntu 16.04 LTS我无法连接到互联网

我是Linux的新手。 我以为我遇到了wifi驱动程序的问题,直到我发现当我使用VPN时我可以连接到网络。 我的互联网工作正常,直到今天。 我需要能够在不使用VPN的情况下连接到Web。

我得到的消息如下:

Firefox can't find the server at www.google.com. 

在终端上:

 $ uname -a Linux MisterX 4.4.0-66-generic #87-Ubuntu SMP Fri Mar 3 15:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux $ ping google.com ping: unknown host google.com $ dig google.com ; <> DiG 9.10.3-P4-Ubuntu <> google.com ;; global options: +cmd ;; connection timed out; no servers could be reached $ ping ping 216.58.208.78 PING 216.58.208.78 (216.58.208.78) 56(84) bytes of data. 64 bytes from 216.58.208.78: icmp_seq=1 ttl=48 time=230 ms 64 bytes from 216.58.208.78: icmp_seq=2 ttl=48 time=226 ms 64 bytes from 216.58.208.78: icmp_seq=3 ttl=48 time=249 ms 64 bytes from 216.58.208.78: icmp_seq=4 ttl=48 time=224 ms ^C --- 216.58.208.78 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3002ms rtt min/avg/max/mdev = 224.005/232.736/249.737/10.094 ms $ dig 216.58.208.78 ; <> DiG 9.10.3-P4-Ubuntu <> 216.58.208.78 ;; global options: +cmd ;; connection timed out; no servers could be reached $ sudo nano /etc/nsswitch.conf passwd: compat group: compat shadow: compat gshadow: files hosts: files mdns4_minimal [NOTFOUND=return] dns networks: files protocols: db files services: db files ethers: db files rpc: db files netgroup: nis 

我试过了:

 $ sudo /etc/init.d/network-manager restart [ ok ] Restarting network-manager (via systemctl): network-manager.service. 

最后,它适用于:

第一( https://askubuntu.com/a/164351/664380

 $ sudo mv /etc/resolv.conf /etc/backup.resolv.conf 

然后,运行( https://askubuntu.com/a/835198/664380

 $ ifconfig 

并查看您的网络适配器的名称。 我的是:enp0s31f6

现在运行此命令

 $ sudo nano /etc/network/interfaces 

你应该得到一些内容….删除所有内容并粘贴(但更改enp0s31f6所在的网络适配器名称):

 # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback # The primary network interface auto enp0s31f6 iface enp0s31f6 inet dhcp 

保存文档并重新启动…

在我的情况下,我只在/ etc / network /接口下面的三行

 # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback 

我不得不加在上面

 # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* 

以下:

 # The primary network interface auto enp0s31f6 iface enp0s31f6 inet dhcp