I have setup openvpn server with following configuration
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 file is like
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>
I only want to redirect traffic of specific subnets to vpn and all other traffic to client's ISP gateway, however when I connect vpn in "Ubuntu 18.04 x64 Desktop", with all default options, it redirects all traffic unless I check "Use this connection only for resources on its network"
Now the problem is If I check this box "Use this connection only for resources on its network", DNS push from openvpn server do not work, and client machine starts using ISP's 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
Tried different solutions from google search but none worked. Did someone face such issue and found solution?