0

I have a linux web server and I need to create an on-demand l2tp ipsec VPN connection with a network route. The VPN connection works and the route is automatically created via a script in /etc/ppp/ip-up.d that expects device ppp0. Everything works fine when I run the following on the command line:

echo "c myvpn" > /var/run/xl2tpd/l2tp-control

As expected, the vpn connects via ppp0 and my route is created. However, when I run this exact same command from a script, sometimes the VPN connects using ppp1 which causes the route creation to fail.

Why is this happening? There is no other network activity going on. Is there a way to specify which network interface gets used?

0

By default the name of ppp interface isn't fixed, but you can change this behaviour with unit 0 option in the pppd options file (0 is the numeric suffix of ppp interface name), that used by xl2tpd (option pppoptfile in the xl2tpd configuration file). To monitor activity of network stack you can use ip monitor command.

  • Thank you. I tried this and it ends up working but it takes a few connection attempts for me. I see log output with ppp1 but it seems to always end up connecting on ppp0. I think I get this issue when I try to connect quickly after disconnecting. Maybe this is a kernel issue? – Josh Kim May 8 at 17:46
  • Add debug option into the pppd option file and check the logs to investigate what happens. – Anton Danilov May 8 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.