Score:-1

New openvpn server clients can ping layer 2 but not layer 3 (DNS)

in flag

I am trying to configure a new openvpn server and my clients can connect to the server, ping 4.2.2.2, but fails at layer 3 (DNS).

error:

ping google.com
temporary failure in name resolution

server config:

mode server
tls-server
port 1194
proto udp
dev tun

ca      /etc/openvpn/server/ca.crt
cert    /etc/openvpn/server/issued/server.crt
key     /etc/openvpn/server/private/server.key
dh      /etc/openvpn/server/dh.pem

server 10.9.8.0 255.255.255.0
ifconfig-pool-persist ipp.txt
keepalive 10 120
comp-lzo         # Compression - must be turned on at both end
persist-key
persist-tun
#status /var/log/openvpn-status.log
verb 1  # verbose mode
user nobody
group nogroup
client-config-dir /etc/openvpn/ccd
client-to-client
push "redirect-gateway def1"
push "redirect-gateway bypass-dhcp"
push "route 192.168.1.0 255.255.255.0"
push "dhcp-option DNS 137.220.63.245"
#push "dhcp-option DNS 4.2.2.2"
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf

log /var/log/openvpn/openvpn.log

iptables:

root@vultr:~# cat /etc/iptables/rules.v4 
# Generated by iptables-save v1.8.7 on Wed Jun 16 04:19:35 2021
*mangle
:PREROUTING ACCEPT [2774:359035]
:INPUT ACCEPT [1375:169341]
:FORWARD ACCEPT [1396:189514]
:OUTPUT ACCEPT [629:154223]
:POSTROUTING ACCEPT [2025:343737]
COMMIT
# Completed on Wed Jun 16 04:19:35 2021
# Generated by iptables-save v1.8.7 on Wed Jun 16 04:19:35 2021
*filter
:INPUT ACCEPT [1375:169341]
:FORWARD ACCEPT [1396:189514]
:OUTPUT ACCEPT [629:154223]
COMMIT
# Completed on Wed Jun 16 04:19:35 2021
# Generated by iptables-save v1.8.7 on Wed Jun 16 04:19:35 2021
*nat
:PREROUTING ACCEPT [93:6515]
:INPUT ACCEPT [19:1048]
:OUTPUT ACCEPT [1:76]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o enp1s0 -j MASQUERADE
COMMIT
# Completed on Wed Jun 16 04:19:35 2021

client config:

root@hvm-debian01:/etc/openvpn# cat /etc/openvpn/client.conf
client
remote 1.1.1.1
dev tun
nobind
tls-client
cert /etc/openvpn/client2.crt
key /etc/openvpn/client2.key
ca /etc/openvpn/ca.crt
comp-lzo
verb 5
ping-restart 60
log /var/log/openvpn/openvpn.log

How to I get openvpn to support dns for my clients?

systemctl restart systemd-resolved

Doesn't help

Upon connecting, my

/etc/resolv.conf

appears to update correctly.

root@hvm-debian01:/etc/openvpn# cat /etc/resolv.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 137.220.63.245
nameserver 192.168.1.1
Score:0
in flag

Changing the push DNS from 137.220.63.245 to 4.2.2.2 fixed the issue.

dig google.com. @137.220.63.245

from the client revealed the issue.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.