Op m'n VPS zou ik graag IPSEC/L2TP VPN willen opzetten. Nu ben ik al een aardig eindje, zo werkt het authenticeren en de VPN verbinding opzetten. Het enige dat niet lukt is al het verkeer via de VPN versturen. Zodra ik dit vinkje aanzet in OS X kan ik niet naar de buitenwereld pingen of verbinding maken:

Een overzichtje met wat "specs":
Omdat de VPS geen LAN heeft en ik voor een VPN wel IP-adressen moet uitdelen, heb ik een loopback interface aangemaakt. Ik weet niet of dit de juiste methode is, maar zo ziet /network/interfaces eruit:
/etc/iptables/rules.v4 ziet er als volgt uit (hiervoor gebruik ik iptables-persistent):
Tot slot een overzichtje van de configuratiebestanden.
/etc/ipsec.conf:
/etc/ppp/options.xl2tpd:
/etc/xl2tpd/xl2tpd.conf:
/etc/sysctl.conf:
/etc/pam.d/ppp:
/etc/ppp/pap-secrets:
Zoekresultaten naar tunnel-problemen met xl2tpd leverde mij helaas weinig op.
Nog een paar extra checks:
sudo ipsec verify geeft het onderstaande overzicht:

Als ik via SSH op de VPS ben ingelogd lukt pingen naar de buitenwereld wel:

Een overzichtje met wat "specs":
- De VPS draait op Ubuntu 12.10 en configureer ik met Chef Solo
- Mijn client OS is Mac OS X 10.8.3, met andere VPN's kan ik wel verbinding maken vanuit thuis
- Voor het configureren van VPN op de VPS heb ik grootendeels gebruik gemaakt van deze tutorial: https://raymii.org/s/tuto...pn_with_Ubuntu_12.10.html
- De VPS heeft standaard twee netwerkadapters: eth0 en lo. eth0 is gekoppeld aan 1 publiek IPv4-adres en de VPS heeft verder geen LAN
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
| Apr 6 12:26:07 vps1 pppd[6298]: sent [LCP ConfReq id=0x1 <mru 1000> <asyncmap 0x0> <auth pap> <magic ...> <pcomp> <accomp>] Apr 6 12:26:07 vps1 pppd[6298]: rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <magic ...> <pcomp> <accomp>] Apr 6 12:26:07 vps1 pppd[6298]: sent [LCP ConfAck id=0x1 <asyncmap 0x0> <magic ...> <pcomp> <accomp>] Apr 6 12:26:07 vps1 pppd[6298]: rcvd [LCP ConfAck id=0x1 <mru 1000> <asyncmap 0x0> <auth pap> <magic ...> <pcomp> <accomp>] Apr 6 12:26:07 vps1 pppd[6298]: sent [LCP EchoReq id=0x0 magic=...] Apr 6 12:26:07 vps1 pppd[6298]: rcvd [LCP EchoReq id=0x0 magic=...] Apr 6 12:26:07 vps1 pppd[6298]: sent [LCP EchoRep id=0x0 magic=...] Apr 6 12:26:07 vps1 pppd[6298]: rcvd [PAP AuthReq id=0x1 user="johan" password=<hidden>] Apr 6 12:26:07 vps1 pppd[6298]: Initializing PAM (3) for user johan Apr 6 12:26:07 vps1 pppd[6298]: ---> PAM INIT Result = 0 Apr 6 12:26:07 vps1 pppd[6298]: Attempting PAM authentication Apr 6 12:26:07 vps1 pppd[6298]: PAM Authentication OK for johan Apr 6 12:26:07 vps1 pppd[6298]: Attempting PAM account checks Apr 6 12:26:07 vps1 pppd[6298]: PAM Account OK for johan Apr 6 12:26:07 vps1 pppd[6298]: PAM Session opened for user johan Apr 6 12:26:07 vps1 pppd[6298]: user johan logged in on tty pts/1 intf ppp0 Apr 6 12:26:07 vps1 pppd[6298]: PAP peer authentication succeeded for johan Apr 6 12:26:07 vps1 pppd[6298]: Unsupported protocol 'IPv6 Control Protocol' (0x8057) received Apr 6 12:26:08 vps1 pppd[6298]: Cannot determine ethernet address for proxy ARP Apr 6 12:26:08 vps1 pppd[6298]: local IP address 172.16.1.1 Apr 6 12:26:08 vps1 pppd[6298]: remote IP address 172.16.1.2 Apr 6 12:27:31 vps1 pppd[6298]: LCP terminated by peer (User request) Apr 6 12:27:31 vps1 pppd[6298]: Connect time 1.4 minutes. Apr 6 12:27:31 vps1 pppd[6298]: Sent 0 bytes, received 82116 bytes. Apr 6 12:27:31 vps1 xl2tpd[6215]: result_code_avp: result code endianness fix for buggy Apple client. network=768, le=3 Apr 6 12:27:31 vps1 xl2tpd[6215]: control_finish: Connection closed to ..., serial 1 () Apr 6 12:27:31 vps1 pppd[6298]: Modem hangup Apr 6 12:27:31 vps1 pppd[6298]: Connection terminated. Apr 6 12:27:31 vps1 xl2tpd[6215]: Terminating pppd: sending TERM signal to pid 6298 Apr 6 12:27:31 vps1 xl2tpd[6215]: result_code_avp: result code endianness fix for buggy Apple client. network=256, le=1 Apr 6 12:27:31 vps1 xl2tpd[6215]: control_finish: Connection closed to ..., port 52547 (), Local: 26551, Remote: 37 Apr 6 12:27:31 vps1 pppd[6298]: Terminating on signal 15 Apr 6 12:27:31 vps1 pppd[6298]: Exit. Apr 6 12:27:31 vps1 xl2tpd[6215]: Can not find tunnel 26551 (refhim=0) Apr 6 12:27:31 vps1 xl2tpd[6215]: network_thread: unable to find call or tunnel to handle packet. call = 2596, tunnel = 26551 Dumping. Apr 6 12:27:33 vps1 xl2tpd[6215]: Can not find tunnel 26551 (refhim=0) Apr 6 12:27:33 vps1 xl2tpd[6215]: network_thread: unable to find call or tunnel to handle packet. call = 2596, tunnel = 26551 Dumping. Apr 6 12:27:37 vps1 xl2tpd[6215]: Can not find tunnel 26551 (refhim=0) Apr 6 12:27:37 vps1 xl2tpd[6215]: network_thread: unable to find call or tunnel to handle packet. call = 2596, tunnel = 26551 Dumping. Apr 6 12:27:41 vps1 xl2tpd[6215]: Can not find tunnel 26551 (refhim=0) Apr 6 12:27:41 vps1 xl2tpd[6215]: network_thread: unable to find call or tunnel to handle packet. call = 2596, tunnel = 26551 Dumping. Apr 6 12:27:46 vps1 xl2tpd[6215]: Can not find tunnel 26551 (refhim=0) Apr 6 12:27:46 vps1 xl2tpd[6215]: network_thread: unable to find call or tunnel to handle packet. call = 2596, tunnel = 26551 Dumping. Apr 6 12:27:50 vps1 xl2tpd[6215]: Can not find tunnel 26551 (refhim=0) Apr 6 12:27:50 vps1 xl2tpd[6215]: network_thread: unable to find call or tunnel to handle packet. call = 2596, tunnel = 26551 Dumping. Apr 6 12:27:54 vps1 xl2tpd[6215]: Can not find tunnel 26551 (refhim=0) Apr 6 12:27:54 vps1 xl2tpd[6215]: network_thread: unable to find call or tunnel to handle packet. call = 2596, tunnel = 26551 Dumping. Apr 6 12:27:58 vps1 xl2tpd[6215]: Can not find tunnel 26551 (refhim=0) |
Omdat de VPS geen LAN heeft en ik voor een VPN wel IP-adressen moet uitdelen, heb ik een loopback interface aangemaakt. Ik weet niet of dit de juiste methode is, maar zo ziet /network/interfaces eruit:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| auto lo lo:10 iface lo inet loopback dns-nameservers 164.138.29.5 164.138.29.6 auto eth0 iface eth0 inet static address <publiek IP-adres van VPN> netmask 255.255.255.0 gateway 164.138.29.1 hwaddr ether <MAC-adres> iface lo:10 inet static address 172.16.1.1 network 172.16.1.0 netmask 255.255.255.0 |
/etc/iptables/rules.v4 ziet er als volgt uit (hiervoor gebruik ik iptables-persistent):
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| # Generated by iptables-save v1.4.12 on Fri Apr 5 22:38:12 2013 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [26212:1633690] -A INPUT -i lo -j ACCEPT -A INPUT -i lo:10 -j ACCEPT -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT -A INPUT -p udp -m udp --dport 4500 -j ACCEPT -A INPUT -p udp -m udp --dport 500 -j ACCEPT -A INPUT -p udp -m policy --strict --dir in --pol ipsec --proto esp -m udp --dport 1701 -j ACCEPT -A INPUT -m policy --strict --dir in --pol ipsec --proto esp -j REJECT -A INPUT -j DROP COMMIT # Completed on Fri Apr 5 22:38:12 2013 # Generated by iptables-save v1.4.12 on Fri Apr 5 22:38:12 2013 *nat :PREROUTING ACCEPT [3:96] :INPUT ACCEPT [0:0] :OUTPUT ACCEPT [12:776] :POSTROUTING ACCEPT [0:0] -A POSTROUTING -j MASQUERADE COMMIT # Completed on Fri Apr 5 22:38:12 2013 |
Tot slot een overzichtje van de configuratiebestanden.
/etc/ipsec.conf:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| config setup nat_traversal=yes virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.1.0/24,%v6:fd00::/8,%v6:fe80::/10 oe=off protostack=netkey conn %default forceencaps=yes conn L2TP-PSK-NAT rightsubnet=vhost:%priv also=L2TP-PSK-noNAT conn L2TP-PSK-noNAT authby=secret pfs=no auto=add keyingtries=3 rekey=no ikelifetime=8h keylife=1h type=transport left=<publiek IP-adres van VPN> leftprotoport=17/1701 right=%any rightprotoport=17/%any dpddelay=30 dpdtimeout=60 dpdaction=clear |
/etc/ppp/options.xl2tpd:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
| login ms-dns 8.8.8.8 ms-dns 8.8.4.4 auth mtu 1200 mru 1000 crtscts hide-password modem name l2tpd proxyarp lcp-echo-interval 30 lcp-echo-failure 4 |
/etc/xl2tpd/xl2tpd.conf:
code:
1
2
3
4
5
6
7
8
9
10
11
| [global] ipsec saref = yes [lns default] ip range = 172.16.1.2-172.16.1.254 local ip = 172.16.1.1 unix authentication = yes require authentication = yes ppp debug = yes pppoptfile = /etc/ppp/options.xl2tpd length bit = yes |
/etc/sysctl.conf:
code:
1
2
3
4
5
6
7
8
9
| net.ipv4.ip_forward = 1 net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 net.ipv4.conf.lo.accept_redirects = 0 net.ipv4.conf.eth0.accept_redirects = 0 net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.lo.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 net.ipv4.conf.eth0.send_redirects = 0 |
/etc/pam.d/ppp:
code:
1
2
3
4
| auth required pam_nologin.so auth required pam_unix.so account required pam_unix.so session required pam_unix.so |
/etc/ppp/pap-secrets:
code:
1
| * l2tpd "" * |
Zoekresultaten naar tunnel-problemen met xl2tpd leverde mij helaas weinig op.
Nog een paar extra checks:
sudo ipsec verify geeft het onderstaande overzicht:

Als ik via SSH op de VPS ben ingelogd lukt pingen naar de buitenwereld wel:
code:
1
2
3
4
5
6
7
8
9
| ping -c 3 google.com PING google.com (173.194.66.139) 56(84) bytes of data. 64 bytes from we-in-f139.1e100.net (173.194.66.139): icmp_req=1 ttl=50 time=5.22 ms 64 bytes from we-in-f139.1e100.net (173.194.66.139): icmp_req=2 ttl=50 time=5.16 ms 64 bytes from we-in-f139.1e100.net (173.194.66.139): icmp_req=3 ttl=50 time=4.91 ms --- google.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2003ms rtt min/avg/max/mdev = 4.914/5.100/5.225/0.157 ms |
[ Voor 4% gewijzigd door Nordlys op 06-04-2013 13:36 ]