Server side DNS resolution problems on Android

Official client software for OpenVPN Access Server and OpenVPN Cloud.
Post Reply
phorus
OpenVpn Newbie
Posts: 3
Joined: Sun Mar 12, 2017 6:58 pm

Server side DNS resolution problems on Android

Post by phorus » Sun Mar 12, 2017 7:08 pm

Hi everybody,

I'd like to use the SIP credentials from my landline also with my Android phone when I'm not at home, connected directly to the router. As real nomadic use is not possible, I need to establish a VPN connection with my home network that also handles all DNS requests on the server side.

The problem I'm experiencing only happens on my Android phone. It works perfectly with the same apps and the exact same settings on an iPad3 (OpenVPN Connect and Zoiper). I just don't want to carry the iPad everywhere I go. ;)

After quite some research online I think the problem lies in Android not changing the DNS servers it uses after the VPN connection has been set up. However, I didn't find any solution.

Within my home network (no VPN) I get the following output in Terminal Emulator. Here, the softphone works.
$ getprop|grep net.dns
[net.change]: [net.rmnet_usb0.dns4]
[net.dns1]: [fe80::1]
[net.dns2]: [192.168.1.2]
[net.dns3]: [192.168.1.1]

After switching off WiFi and being connected via 4G (no VPN), Android uses the mobile providers DNS servers. The softphone of course doesn't work, since it can't resolve the SIP registrar. (Specifying it by IP is not enough, btw.)
$ getprop|grep net.dns
[net.change]: [net.dns3]
[net.dns1]: [62.109.121.17]
[net.dns2]: [62.109.121.18]
[net.dns3]: []

Establishing the VPN connection doesn't update the DNS servers on Android. The SIP registration by the softphone fails.
$ getprop|grep net.dns
[net.change]: [net.dns3]
[net.dns1]: [62.109.121.17]
[net.dns2]: [62.109.121.18]
[net.dns3]: []

Setting them manually doesn't seem to work either. (I prefer not to root the phone.)
$ setprop net.dns1 192.168.1.2
could not set property

I'd appreciate any help!

Some information on my setup:
- 192.168.1.1 is a very basic DSL router.
- 192.168.1.2 is a Raspberry Pi running OpenVPN and Dnsmasq
> OpenVPN 2.2.1 arm-linux-gnueabihf [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Dec 1 2014
> Dnsmasq version 2.62 Copyright (c) 2000-2012 Simon Kelley
- Samsung S4 with Android 5.0.1 and OpenVPN Connect 1.1.17 (build 76)

/etc/openvpn $ cat openvpn.conf
dev tun
proto udp
port 1194
ca /path/to/certs/ca.crt
cert /path/to/certs/server.crt
key /path/to/certs/server.key
dh /path/to/certs/dh.pem
user nobody
group nogroup
server 10.8.0.0 255.255.255.0
persist-key
persist-tun
status /var/log/openvpn-status.log
verb 3
client-to-client
push "redirect-gateway def1 bypass-dhcp bypass-dns"
#set the dns servers
push "dhcp-option DNS 10.8.0.1"
push "dhcp-option DNS 192.168.1.2"
push "dhcp-option DNS 192.168.1.1"
log-append /var/log/openvpn
comp-lzo
duplicate-cn
keepalive 10 120

phorus
OpenVpn Newbie
Posts: 3
Joined: Sun Mar 12, 2017 6:58 pm

Re: Server side DNS resolution problems on Android

Post by phorus » Sun Mar 12, 2017 9:12 pm

Just tested on Android 4.0.4. There it works as well. :/
Does anybody have a solution for 5.0.1?

phorus
OpenVpn Newbie
Posts: 3
Joined: Sun Mar 12, 2017 6:58 pm

Re: Server side DNS resolution problems on Android

Post by phorus » Wed Mar 15, 2017 8:55 pm

Isn't there any remedy or some insight? Anybody? :?:

Post Reply