Page MenuHomeVyOS Platform

L2tpv3 config delete on reboot/startup
Closed, WontfixPublicBUG


I am not sure if I would call this a bug, but ill let you decide.

test lab all running 1.2.0-rc9
3 routers all running OSPF, l2tpv3 tunnel between the "left" and "right" router through the "middle"
middle router announces default route.
l2tpv3 local/remote ip is the loopback address

When the router is booting up it hits the l2tpv3 config section before it has started OSPF and shared routes, this makes the remote-ip of the l2tpv3 tunnel unreachable.

I know that the linux l2tp tool will not let you create a tunnel where there remote-ip is unreachable.
for example on a device with no default gateway:
sudo ip l2tp add tunnel tunnel_id 100 peer_tunnel_id 100 encap ip local remote
might produce
RTNETLINK answers: Network is unreachable

When you have the situation where you are trying to create an l2tpv3 tunnel and the remote ip is unreachable, it fails. This seems to then delete that section of the config.

My workaround is to create a high distance(254) default gateway route that OSPF will eventually overwrite when it starts up. You could argue that it might be best practice to always turn on a default route, and I think you might be right.

This seems to be more of a bug/feature? of the linux l2tp tool itself. Maybe it makes sense to put some kind of delay in starting the l2tp section, or maybe this just needs to be documented in the wiki?


Difficulty level
Unknown (require assessment)
Why the issue appeared?
Issues in third-party code
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Unspecified (please specify)

Event Timeline

c-po changed the task status from Open to Confirmed.Apr 1 2021, 5:21 PM
c-po triaged this task as Normal priority.
c-po changed Why the issue appeared? from Will be filled on close to Issues in third-party code.
c-po set Is it a breaking change? to Unspecified (possibly destroys the router).
c-po moved this task from Need Triage to In Progress on the VyOS 1.4 Sagitta board.

This can be reproduced with the following config on 1.4

 interfaces {
     dummy dum0 {
     ethernet eth0 {
         duplex auto
         speed auto
         vif 10 {
     l2tpv3 l2tpeth10 {
         description "L2 VPN Tunnel"
         destination-port 5010
         encapsulation ip
         mtu 1500
         peer-session-id 110
         peer-tunnel-id 10
         session-id 110
         source-port 5010
         tunnel-id 10
+    l2tpv3 l2tpeth20 {
+        description "L2 VPN Tunnel"
+        destination-port 5020
+        encapsulation ip
+        mtu 1500
+        peer-session-id 120
+        peer-tunnel-id 20
+        remote
+        session-id 120
+        source-address
+        source-port 5020
+        tunnel-id 20
+    }
+    l2tpv3 l2tpeth30 {
+        description "L2 VPN Tunnel"
+        destination-port 5030
+        encapsulation ip
+        mtu 1500
+        peer-session-id 130
+        peer-tunnel-id 30
+        remote
+        session-id 130
+        source-address
+        source-port 5030
+        tunnel-id 30
+    }

The most crucial part here is that there is NO default route present on the system

Or try to create a tunnel manually:

sudo ip l2tp add tunnel tunnel_id 3000 peer_tunnel_id 4000 encap udp local remote udp_sport 5000 udp_dport 6000 - the kernel does a nexthop lookup and fails :(

c-po raised the priority of this task from Normal to High.

Turns out this is not a VyOS limitation but is a Linux Kernel/iproute2 limitation.

It does not allow you to create an l2tpv3 interface where it can not reach the remote side during creation. Somehow this does not feel right but the best way is as you mentioned - install a high distance default route.

dmbaturin set Issue type to Unspecified (please specify).