E
E
Eugene2014-05-18 08:48:01
linux
Eugene, 2014-05-18 08:48:01

How to set up DNS when using a VPN?

Hello.
I decided to take advantage of such a blessing as a VPN tunnel from home to my favorite work. Our system administrator made all the settings, sent me the keys. In general, there are no problems with the connection. Set up a connection through NetworkManager (I have LinuxMint 15 KDE). The problem is that I can't figure out how the names are resolved now? Those. our in-house resources live in our network with the company.local postfix. When you try to go to such a resource (with a connected VPN), nothing happens. Ping such resources is also unsuccessful. Tell me what to do?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
younghacker, 2014-05-19
@zolt85

Most likely the names are resolved through your provider.
You were correctly told to look into /etc/resolv.conf
You can also see what it returns as a server
To check if your servers are responding (you never know if you have dnsmasq configured somewhere outside) try
where xxxx is the address of your branded dns
The command should return the correct address .
As an option, you can not push dns server addresses through vpn, but raise dnsmasq locally and configure it so that it resolves your company.local zone from your specified corporate dns.

cat /etc/dnsmasq.d/intranet.company.local.conf
server=/company.local/x.x.x.x

cat /etc/dnsmasq.conf
interface=lo
no-dhcp-interface=*
bind-interfaces
clear-on-reload
local-ttl=3600
neg-ttl=3600
max-ttl=7200
conf-dir=/etc/dnsmasq.d

And in iptables, you can intercept all requests to an external tcp / udp 53 and wrap them in a local dnsmasq. Just in case, leave the exit outside only for nobody
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# dns requests from nobody are transparent
-A OUTPUT -p tcp -m tcp --dport 53 -m owner --uid-owner nobody -j ACCEPT
-A OUTPUT -p udp -m udp --dport 53 -m owner --uid-owner nobody -j ACCEPT
# all other dns requests are routed to local resolver (dnsmasq)
-A OUTPUT -p tcp -m tcp --dport 53 -j DNAT --to-destination 127.0.0.1
-A OUTPUT -p udp -m udp --dport 53 -j DNAT --to-destination 127.0.0.1

The third way is to register the necessary addresses in
/etc/hosts

I
Igor, 2014-05-18
@merryjane

Compare the contents of /etc/resolv.conf on your work machine and at home. Most likely, when connecting vpn at home, you did not push dns servers into this file. Try to write them down by hand.

E
Eugene, 2014-05-19
@zolt85

Thank you all guys, thanks to you, nslookup started giving correct addresses. But the browser does not agree with him, it does not open the resource by name ... Fortunately, there are not many resources, and it was not difficult to register the necessary names in /etc/hosts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question