0

I use a PPTP VPN to connect to my work's environment, but don't know how to configure DNS resolution the way it seems appropriate.

When I connect via Network Manager I get two servers in /etc/ppp/resolv.conf and mywork.com.br as a search domain in /etc/resolv.conf. While it allows me to resolve names in that network it also seems to redirect all DNS requests through the servers pushed by the PPTP server.

Differently, when I connect with pon mywork no change is done to the DNS settings, but I lose the remote name resolution that I have in the first case.

So, how can I manage to keep both DNS servers working? I mean, I'd like to resolve machine.mywork through the PPTP DNS server and everything else through my ordinary server.

Here's my /etc/ppp/peers/mywork:

pty "pptp vpn.mywork.com.br --nolaunchpppd"
name me@mywork.com.br
remotename mywork
require-mppe-128
file /etc/ppp/options.pptp
ipparam mywork 
nodefaultroute

I'm running 14.04 LTS. Thanks in advance and sorry for my bad english!

lzkill
  • 23

1 Answers1

2

A solution would be to run a local DNS server that can forward queries to other DNS servers based on subdomain/domain.

Ubuntu's network-manager already runs a local DNS server (dnsmasq-base) however the required options are not available so disable it then install and configure the full dnsmasq package as follows:

1) Comment out dns=dnsmasq from /etc/NetworkManager/NetworkManager.conf

2) Restart network-manager: sudo service network-manager restart

3) Install dnsmasq package: sudo apt-get install dnsmasq

4) Edit /etc/dnsmasq.conf and add:

server=/.mywork/VPN_DNS_IP
server=/#/INTERNET_DNS_IP

5) Restart dnsmaq: sudo service dnsmasq restart

el_tigro
  • 434
  • This solution is not correct. "address" means "resolve all this TLD to this IP", instead "server" must be used to tell to ask ".mywork" TLD to "VPN_DNS_IP". So the correct usage will be :

    server=/.mywork/VPN_DNS_IP

    Second line also not necesarry while rest will be resolved using DNS of your internet connection

    – Can YILDIZ Jul 25 '17 at 15:27
  • In my case (Ubuntu 18.04 LTS) dns=dnsmasq was not present in configuration file and reboot was required between steps 4 and 5 but the solution worked anyways. – Jakub Mendyk Apr 02 '19 at 07:50