You are not logged in.

#1 2010-07-14 20:21:03

Stalafin
Member
From: Berlin, Germany
Registered: 2007-10-26
Posts: 617

[solved] vpnc and dnsmasq or: How to obtain the DNS in the VPN?

I am following the Howto below, in order to set up my VPN such that only connections going to *.example.org are routed via the VPN, but my standard traffic is not:
http://www.gentoo.org/doc/en/vpnc-howto.xml

In sections 6 there is described how to set up dnsmasq for that. It says:

Now you need to add an option to your dnsmasq startup options. Edit the following option to suit your needs. Substitute .example.org with the appropriate domain and the IP address with a valid DNS server that belongs to the VPN tunnel.

Config file for /etc/init.d/dnsmasq

# See the dnsmasq(8) man page for possible options to put here.
DNSMASQ_OPTS="-S /.example.org/192.168.125.10"

What I do not understand - how do I determine the valid DNS server that belongs to the VPN tunnel? And is this DNS server actually supposed to be visible outside the VPN, too?

I am a little confused about this right now. Maybe someone can help.

Last edited by Stalafin (2010-07-16 07:45:25)

Offline

#2 2010-07-15 11:08:58

Stalafin
Member
From: Berlin, Germany
Registered: 2007-10-26
Posts: 617

Re: [solved] vpnc and dnsmasq or: How to obtain the DNS in the VPN?

Continuing my oddysey:
Not having set up anything described in the howto, these are my routes before I open a VPN tunnel:

$  netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.0.0     *               255.255.255.0   U         0 0          0 wlan0
default         192.168.0.1     0.0.0.0         UG        0 0          0 wlan0

And these are my routes after (I have censored the actual IP addresses of the new routes, and replaced them by aaa.aaa.aa.aa and bb.bbb.bb.b):

$  netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
aaa.aaa.aa.aa   192.168.0.1     255.255.255.255 UGH    1500 0          0 wlan0
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0
bb.bbb.bb.b     0.0.0.0         255.255.252.0   U         0 0          0 tun0
0.0.0.0         0.0.0.0         0.0.0.0         U         0 0          0 tun0
0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 wlan0

Does this help in any way?

Offline

#3 2010-07-16 07:45:08

Stalafin
Member
From: Berlin, Germany
Registered: 2007-10-26
Posts: 617

Re: [solved] vpnc and dnsmasq or: How to obtain the DNS in the VPN?

I figured out a solution with a really helpful guy from #gentoo, mmoebius:

1) I open the VPN tunnel
1a) VPNC creates the tun0 interface
1b) VPNC sets up new routes (as indicated above)
1c) VPNC rewrites resolv.conf to the nameserver as in the subnet the tun0 interface is opened to
2) I delete the 0.0.0.0 as the default route, and change resolv.conf to what it was before (or disallow VPNC to change it)
3) I set up DNSMASQ to route all traffic to the domains .foo.bar to go to the nameserver in the subnet (the IP to which I received from the admin, and from the changed resolv.conf), and I create a new route making the IP of the nameserver go to the tun0 interface.

And that should be it.

Thread status changed to [solved].

Offline

Board footer

Powered by FluxBB