尝试安装并删除 OpenVPN 后出现未找到服务器的问题

尝试安装并删除 OpenVPN 后出现未找到服务器的问题

我无法在 Ubuntu 16.04 上访问互联网。它显示server not found在 Firefox 上,我无法使用终端访问任何要安装的内容。我的互联网连接工作正常,但我尝试使用终端安装 openvpn,然后使用终端将其删除。从那时起就出现了这个问题。

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP,> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 bdr 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
    valid_lft forever preferred_lft forever
2: enp3s0: <NO-CARRIER,BROADCAST,MULTICAST,UP>mtu 1500 qdisc mq state UP group default qlen 1000
    link/either 18:db:f2:4a:90:3e brd ff:ff:ff:ff:ff:ff

3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/either e4:02:9b:48:c9:a2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.100/24 brd 192.168.1.255 scope global wlp2s0
    valid_lft forever preferred_lft forever
    inet6 2405:204:6322:99a0:2c20:3623:c01a:161e/64 scope global temporary dynamic
    valid_lft 3387sec preferred_lft 3387sec
    inet6 2405:204:6322:99a0:e602:9bff:fe48:c9a2/64 scope global mngtmpaddr dynamic
    valid_lft 3387sec preferred_lft 3387sec
    inet6 fe80::e602:9bff:fe48:c9a2/64 scope link
    valid_lft forever preferred_lft forever

$ ping -c 10 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data 
64 bytes from 8.8.8.8: icmp_seq=6 ttl=44 time=98.8ms
64 bytes from 8.8.8.8: icmp_seq=7 ttl=44 time=97.9ms
64 bytes from 8.8.8.8: icmp_seq=8 ttl=44 time=96.8ms
64 bytes from 8.8.8.8: icmp_seq=9 ttl=44 time=95.7ms
64 bytes from 8.8.8.8: icmp_seq=10 ttl=44 time=93.8ms

--- 8.8.8.8 ping statistics ---
10 packets transmitted, 5 packets received, 50% packet loss, time 9119ms
rtt min/avg/max/mdev/ =93.863/96.641/98.800/1.741 ms

$ sudo dpkg -l resolvconf
Desired=Unknown/Install/Remove/purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description    +++-==============-============-============-=================================
rc  resolvconf     1.78ubuntu6  all          name server information handler

$ sudo dpkg -l wpasupplicant
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/conf-files/Unknown/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad
||/Name            Version      Architecture Description 
+++-==============-============-============-================================
 ii  wpasupplicant 2.4-0ubuntu6 amd64         client support fpr WPA and WPA2

并且ls /etc/这里没有显示任何/etc/resolv.conf文件并且也不允许我手动创建它。

这是什么问题?我该如何解决?

答案1

经过交谈,似乎您的机器位于 wifi 路由器后面,并且您通过 wifi 连接到网络,但是在安装和删除 openvpn 后出现 dns 问题。

因此,为了解决这个问题,其中一种方法是/etc/network/interfaces通过编辑文件

sudo nano /etc/network/interfaces

然后在其中添加这些行,但不要擦除之前存在的任何内容

allow-hotplug wlp2s0
iface wlp2s0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
dns-nameserver 8.8.8.8

然后按ctrl+x(ctrl -> control 键)保存该文件,然后按y确认,然后运行nano /etc/wpa_supplicant/wpa_supplicant.conf并添加以下几行

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=IN

network={
    ssid="your_wifi_network_name"
    psk="your_wifi_password"
}

然后按ctrl+x(ctrl -> control 键)保存该文件,然后按y确认并通过运行重新启动网络

sudo systemctl restart networking

相关内容