dns - 选中“仅将此连接用于其网络上的资源”时,openvpn push DNS 失败
问题描述
我已经使用以下配置设置了 openvpn 服务器
local xxx.xxx.xxx.xxx
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh.pem
auth SHA512
tls-crypt tc.key
topology subnet
server 192.168.255.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "route 10.0.0.0 255.0.0.0"
push "dhcp-option DNS 192.168.255.1"
#push "dhcp-option DNS 172.17.0.42"
#push "dhcp-option DNS 1.1.1.1"
#push "dhcp-option DNS 8.8.8.8"
#push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
cipher AES-256-CBC
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
crl-verify crl.pem
explicit-exit-notify
client.ovpn 文件就像
client
dev tun
proto udp
remote xx.xxx.xxx.xxx 1194
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
auth SHA512
cipher AES-256-CBC
ignore-unknown-option block-outside-dns
block-outside-dns
verb 3
pull-filter ignore redirect-gateway def1
script-security 2
up /etc/openvpn/update-systemd-resolved
up-restart
down /etc/openvpn/update-systemd-resolved
down-pre
# prevent DNS leakage
dhcp-option DOMAIN-ROUTE .
<ca>
我只想将特定子网的流量重定向到 vpn 并将所有其他流量重定向到客户端的 ISP 网关,但是当我使用所有默认选项在“Ubuntu 18.04 x64 Desktop”中连接 vpn 时,它会重定向所有流量,除非我选中“仅使用此连接获取其网络上的资源”
现在的问题是如果我选中此框“仅将此连接用于其网络上的资源”,则来自 openvpn 服务器的 DNS 推送不起作用,并且客户端计算机开始使用 ISP 的 dns。
$ systemd-resolve --status | grep -A8 tun0
Link 33 (tun0)
Current Scopes: none
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
Link 2 (ens33)
Current Scopes: DNS
从谷歌搜索尝试了不同的解决方案,但没有一个奏效。有人遇到过这样的问题并找到了解决方案吗?
解决方案
推荐阅读
- javascript - 如何在条件下取消附加 gapi-auth2.attachClickHandler
- javascript - 如何使用谷歌脚本将空值附加到电子表格?
- android - Android TV 中的 RecyclerView 项目焦点
- javascript - 使用 JS 的 HTTP 上传文件
- node.js - TypeError:无法读取未定义 discord.js 的属性“名称”
- nginx - 路径上的应用程序而不是 root 不适用于 Kubernetes Ingress
- javascript - 获取对象的元素索引
- python-3.x - Pandas 与插值合并
- promise - guzzle 承诺中的“always()”等价物是什么?
- php - php数组和递归函数