l2tp set default route via tunnel

This commit is contained in:
Daniel Barlow 2024-05-14 12:52:50 +01:00 committed by Raito Bezarius
parent 1c9f20dd40
commit fc9cb8e07d

View file

@ -6,6 +6,7 @@
}: let }: let
secrets = import ./extneder-secrets.nix; secrets = import ./extneder-secrets.nix;
rsecrets = import ./rotuer-secrets.nix; rsecrets = import ./rotuer-secrets.nix;
lns = "l2tp.aaisp.net.uk";
inherit (pkgs.liminix.services) oneshot longrun bundle target; inherit (pkgs.liminix.services) oneshot longrun bundle target;
inherit (pkgs.pseudofile) dir symlink; inherit (pkgs.pseudofile) dir symlink;
inherit (pkgs) writeText dropbear ifwait serviceFns; inherit (pkgs) writeText dropbear ifwait serviceFns;
@ -58,20 +59,26 @@ in rec {
srv = dir {}; srv = dir {};
}; };
services.lnsroute = svc.network.route.build {
via = "$(output ${services.dhcpc} router)";
target = lns;
dependencies = [services.dhcpc];
};
services.l2tp = svc.l2tp.build { services.l2tp = svc.l2tp.build {
lns = "l2tp.aaisp.net.uk"; inherit lns;
ppp-options = [ ppp-options = [
"debug" "+ipv6" "noauth" "debug" "+ipv6" "noauth"
"name" rsecrets.l2tp.name "name" rsecrets.l2tp.name
"password" rsecrets.l2tp.password "password" rsecrets.l2tp.password
]; ];
dependencies = [ services.defaultroute4 ]; dependencies = [ services.lnsroute ];
}; };
services.defaultroute4 = svc.network.route.build { services.defaultroute4 = svc.network.route.build {
via = "$(output ${services.dhcpc} router)"; via = "$(output ${services.l2tp} router)";
target = "default"; target = "default";
dependencies = [services.dhcpc]; dependencies = [services.l2tp];
}; };
users.root = { users.root = {