Openvpn dns 名称服务器未配置

Openvpn dns 名称服务器未配置

我正在使用 ubuntu 16.04,并且已经设置了 openvpn 连接,并且正在创建 tun0 接口。vpn 连接成功。起初我可以通过 VPN 访问一些 URL,但页面需要 10-20 秒,浏览器只是在等待连接。然后,在将我的电脑从网络上拔下并重新启动后,网页就完全停止工作了。我运行并将nmcli dev show结果与​​一些在 debian linux 上通过 open vpn 正常工作的机器进行了比较,我发现:

当 openvpn 已连接但没有网页加载时,我看到:

:~$ nmcli dev show
GENERAL.DEVICE:                         tun0
GENERAL.TYPE:                           tun
GENERAL.HWADDR:                         
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     tun0
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/14
IP4.ADDRESS[1]:                         10.146.129.226/32
IP4.GATEWAY:                            10.146.129.225
IP4.DNS[1]:                             127.0.0.1
IP6.ADDRESS[1]:                         fe80::27f8:bc23:5e18:b6ba/64

当 openvpn 已连接但网页需要 10-20 秒才能加载时,我看到一堆 IP4.ROUTE 正在配置:

:~$ nmcli dev show
GENERAL.DEVICE:                         tun0
GENERAL.TYPE:                           tun
GENERAL.HWADDR:                         
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     tun0
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/0
IP4.ADDRESS[1]:                         10.146.129.226/32
IP4.GATEWAY:                            10.146.129.225
IP4.ROUTE[1]:                           dst = 193.88.68.118/32, nh = 10.146.129.225, mt = 50
IP4.ROUTE[2]:                           dst = 193.88.68.252/32, nh = 10.146.129.225, mt = 50
....
IP4.ROUTE[67]:                          dst = 193.88.68.101/32, nh = 10.146.129.225, mt = 50
IP4.ROUTE[68]:                          dst = 193.88.68.103/32, nh = 10.146.129.225, mt = 50
IP4.DNS[1]:                             127.0.0.1
IP6.ADDRESS[1]:                         fe80::71d2:5709:5536:b3fc/64
IP6.GATEWAY:                            


For the person whose openvpn is working on debian 9.4 IP4.DNS entries are being configured while mine from above only says IP4.DNS[1]: 127.0.0.1: 

:~$ nmcli dev show
GENERAL.DEVICE: tun0
GENERAL.TYPE: tun
GENERAL.HWADDR: (unknown)
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: tun0
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/224
IP4.ADDRESS[1]: 10.146.129.242/32
IP4.GATEWAY: 10.146.129.241
...
IP4.ROUTE[67]: dst = 193.88.68.99/32, nh = 10.146.129.241, mt = 50
IP4.ROUTE[68]: dst = 193.88.68.8/32, nh = 10.146.129.241, mt = 50
IP4.DNS[1]: 10.146.128.8
IP4.DNS[2]: 194.239.134.83
IP4.DNS[3]: 193.162.153.164
IP4.DNS[4]: 1.1.1.1
IP4.DNS[5]: 8.8.4.4
IP4.DNS[6]: 9.9.9.9
IP6.ADDRESS[1]: fe80::35a6:a424:c5b6:bf7f/64
IP6.GATEWAY: --

他们的 /etc/resolve conf 文件也有名称服务器条目,如下所示:

# Generated by NetworkManager
search teknet int.xxxx.dk dev.xxxx.dk opasia.gkl.xxxx.dk xxx.dk
nameserver 10.146.128.8
nameserver 194.239.134.83
nameserver 193.162.153.164
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 1.1.1.1
nameserver 8.8.4.4
nameserver 9.9.9.9

我的/etc/resolve.conf文件如下所示:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
search teknet int.xxx.dk dev.xxx.dk opasia.gkl.xxx.dk dk.eng.xxx.net

我正在运行 dnsmasq,但不清楚 ubuntu 16.04 实际上如何更新 dns/名称服务器条目。我尝试过:

  1. 添加名称服务器条目至/etc/resolvconf/resolv.conf.d/base
  2. 添加服务器条目/etc/dnsmasq.conf并重新引导 dnsmasq
  3. 添加 dns-nameservers/etc/network/interface并执行resolveconf -u
  4. 进行更改后重新启动网络管理器,但似乎没有将 dns 名称服务器条目添加到/etc/resolve.conf。重新启动网络管理器确实sudo systemctl restart network-manager.service会清除我添加的手动条目etc/resolve.conf,然后当我的网络重新连接到上面显示的内容时,这些条目似乎被重写。

有太多地方需要更新 dns 条目,我不知道实际使用的是哪一个,是 dnsmasq、resolvconf 还是我网络中的 dhcp 脚本或 vpn 脚本?有人能告诉我如何开始调试以及应该发生什么吗?

我似乎希望我的 nmcli dev show 命令显示 tun0 接口的 IP4.DNS 条目设置正确。但我似乎无法实现这一点。

相关内容