L2TP tunnel notes

Published: Monday, Aug 15, 2016 Last modified: Thursday, Nov 14, 2024

Assuming you have correctly setup the configuration like so:

https://support.aa.net.uk/L2TP_Client:_Linux

journalctl -u xl2tpd -f

Now start xl2tpd which does the tunneling.

Then establish the tunnel:

# echo "c myisp" > /var/run/xl2tpd/l2tp-control

The point to point ppp0 interface should come up. Now we need to route traffic through it, but make sure we don’t disrupt the existing network to the tunnel. Lets assume we connect to the tunnel by connecting to the IP address of 2.2.2.2

enp0s31f6 is the unique name of my wired interface.

ip route add 2.2.2.2 via 192.168.1.1 dev enp0s31f6

We are telling to get to 2.2.2.2, we need to go through our normal router’s route of 192.168.1.1.

Now for all other traffic, say the IP address you pop out of is 81.81.81.81, we set a new route to say all or “default” traffic gets tunneled through it, like so:

ip route add default via 81.81.81.81 dev ppp0