From fc9cb8e07d229ba6168502192143bb2b29167e17 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Tue, 14 May 2024 12:52:50 +0100 Subject: [PATCH] l2tp set default route via tunnel --- examples/l2tp.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/l2tp.nix b/examples/l2tp.nix index d604881..6aa983a 100644 --- a/examples/l2tp.nix +++ b/examples/l2tp.nix @@ -6,6 +6,7 @@ }: let secrets = import ./extneder-secrets.nix; rsecrets = import ./rotuer-secrets.nix; + lns = "l2tp.aaisp.net.uk"; inherit (pkgs.liminix.services) oneshot longrun bundle target; inherit (pkgs.pseudofile) dir symlink; inherit (pkgs) writeText dropbear ifwait serviceFns; @@ -58,20 +59,26 @@ in rec { srv = dir {}; }; + services.lnsroute = svc.network.route.build { + via = "$(output ${services.dhcpc} router)"; + target = lns; + dependencies = [services.dhcpc]; + }; + services.l2tp = svc.l2tp.build { - lns = "l2tp.aaisp.net.uk"; + inherit lns; ppp-options = [ "debug" "+ipv6" "noauth" "name" rsecrets.l2tp.name "password" rsecrets.l2tp.password ]; - dependencies = [ services.defaultroute4 ]; + dependencies = [ services.lnsroute ]; }; services.defaultroute4 = svc.network.route.build { - via = "$(output ${services.dhcpc} router)"; + via = "$(output ${services.l2tp} router)"; target = "default"; - dependencies = [services.dhcpc]; + dependencies = [services.l2tp]; }; users.root = {