Gentoo Archives: gentoo-user

From: Stefan Schulte <stefan.schulte@×××××××××××.net>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Setting up WLAN and VPN the right way
Date: Thu, 18 Mar 2010 22:07:06
Message-Id: 20100318220646.GA5261@nebukadnezar.matrix.de
1 Hi at all,
2
3 I'm trying to setup VPN on my Laptop but I'm stuck. When I'm at the
4 university I have to connect to their WLAN and then setting up a
5 VPN-Connection. All packets should take the VPN-tunnel. Here's what I've
6 got so far:
7
8 1) W-LAN connection works and I get an ip, default route and DNS-Servers
9 via dhcp
10
11 - eth1 is my WLAN-Device
12 - ppp0 is my VPN-Device
13 - vpn.bg.bib.de is the disired VPN-Server
14 snippet of /etc/conf.d/net:
15
16 modules="iproute2"
17 modules_eth1="!iwconfig wpa_supplicant"
18 wpa_supplicant_eth1="-Dwext"
19 dhcp_eth1="nosendhost nonis nontp"
20 config_eth1="dhcp"
21
22 pppd_ppp0="
23 defaultroute
24 noauth
25 persist
26 call fhdw
27 holdoff 10
28 mru 1460
29 mtu 1460
30 idle 600"
31 link_ppp0="pty 'pptp vpn.bg.bib.de --nolaunchpppd'"
32
33 2) VPN Connection does work
34 - pptpclient is installed
35 - /etc/ppp/peers/fhdw with options usepeerdns and defaultroute
36 - »/etc/init.d/net.ppp0 start« does start the vpn connection
37
38 BUT:
39 1)
40 After the tunnel is up, /etc/ppp/ip-up.d/40-dns.sh is supposed to
41 replace the dhcp-nameservers with dns-servers behind the VPN-server
42 stored in /etc/ppp/resolv.conf. Unfortunately
43 the resolv.conf is immediatly altered a second time by baselayout or
44 whatever is writing these »Generated by net-scripts for interface«
45 lines and then I've no nameserver at all. I have to do a
46 cat /etc/ppp/resolv.conf >> /etc/resolv.conf
47 every time after the tunnel is up.
48
49 2)
50 After the tunnel is up I have two default routes. One for eth1 and one
51 for ppp0. So I manually set up a hostroute for the vpn-server with the
52 eth1 gateway and then delete the default route for eth1. After that the
53 VPN-Server is reached through eth1 and all the rest through ppp0
54 Unfortunately the default route for eth1 appears again after a few
55 minutes (I guess dhcpcd is to blame) and every connection breaks down
56 until I delete the route again.
57
58 So how do you set up a VPN correctly? Or is there is any documentation
59 I've missed?
60
61 BTW: I'm using fluxbox and no networkmanager or stuff like that.
62
63 -Stefan