4

I've set up an L2TP/IPsec PSK VPN between my phone and my home network. It works, but Android doesn't use my home DNS server, so none of my internal hostnames resolve. I can access internal servers by IP address, but not by name. How can I get the phone to use my internal DNS instead of whatever servers it normally uses?

Some background: I'm using a Samsung Epic 4G running Gingerbread. My VPN server is running xl2tpd and openswan on Linux. I checked the routing table on my phone, and traffic is correctly being routed through the VPN. On the server, there are options in the PPP config called "ms-dns-1" and "ms-dns-2" that allows the server to push DNS server IPs to the client. But apparently those options are only used by Microsoft clients. I've Googled the issue, and other people have the same problem, but I haven't been able to find a solution.

My phone isn't rooted. I'm willing to root the phone if I have to, but I'd prefer not to.

Edit, 2 months later

I finally found out what was wrong, and it had nothing to do with DNS. I'm using my desktop computer as the VPN endpoint, and I had neglected to turn on IP forwarding, so it wasn't forwarding packets. I could access services on the VPN endpoint itself, but anything that required forwarding packets (including DNS lookups) failed. The VPN client was correctly picking up DNS information, but it couldn't reach the DNS server because of the forwarding issue. Once I corrected that, the VPN worked perfectly. To summarize, I'm an idiot.

4
  • Isn't there a DNS configuration for the VPN connections? When I set up my PPTP VPN connection, it asked me for remote DNS servers specifically.
    – Mr. TA
    Commented May 21, 2012 at 18:16
  • I think it only asks for DNS servers if you configure a static IP. If you use DHCP (very common), it picks up everything from the DHCP server.
    – Jonathan
    Commented May 22, 2012 at 16:24
  • I have similar issue. (Still have.) There is something I don't understand in your initial description. You wrote "I can access internal servers by IP address, but not by name." Did you are able to access internal machines with IP forwarding turned off?
    – utom
    Commented Jan 1, 2015 at 19:52
  • @utom No, that was another mistake on my part. I was able to access my VPN endpoint by IP address. I didn't even check other IP addresses. I just assumed I could access them the same way. If I had checked other addresses, I might have found the issue sooner.
    – Jonathan
    Commented Jan 5, 2015 at 13:53

2 Answers 2

1

You might want to take a look at the DNS Settings app, which claims to be able to do what you want (you just have to switch once to a static IP to change the DNS settings, and then switch back to dynamic IP, according to the description). That's the only non-root app I could find for this issue -- there are two more apps at least, but they require root to work.

0

I know this is an old thread, but I recently ran into this problem on my Samsung Galaxy A21s and figured out the fix yesterday.

In my case, I had a VPN server where DNS resolution was working fine when used with my iOS device, but DNS resolution was not working when I used an Android device to connect to the same VPN server.

In my case, the issue was the DNS settings on the Android device.

Under Settings > Connections > More connection settings, there is a feature called Private DNS. This was set to "Automatic". I set that to Off. After that, when connected to the VPN server, the Android device started using my internal DNS server (as specified by the VPN server). When not connected to VPN, the Android phone uses the DNS servers specified by the local network. This was the desired behaviour for my use case.

Apologies, but whether someone set the Private DNS feature to Automatic while troubleshooting is unclear. So I can't tell whether or not Android sets that to Automatic by default. Frankly, I've spent too much time troubleshooting the issue to confirm either way (this was only meant as a POC). Just sharing my experience in case anyone else runs into the same problem in the future.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .