ipv6 default route

needs to specify the ppp0 *peer* address not the local address
This commit is contained in:
Daniel Barlow 2023-06-30 10:17:33 +01:00
parent 5306b36181
commit b6e72504d6
3 changed files with 16 additions and 5 deletions

View file

@ -220,12 +220,20 @@ in rec {
};
services.defaultroute4 = route {
name = "defaultroute";
name = "defaultroute4";
via = "$(output ${services.wan} address)";
target = "default";
dependencies = [ services.wan ];
};
services.defaultroute6 = route {
name = "defaultroute6";
via = "$(output ${services.wan} ipv6-peer-address)";
target = "default";
dev = "$(output ${services.wan} ifname)";
dependencies = [ services.wan ];
};
services.firewall =
let
script= pkgs.firewallgen "firewall.nft" (import ./rotuer-firewall.nix);
@ -307,6 +315,7 @@ in rec {
hostap5
ntp
defaultroute4
defaultroute6
packet_forwarding
dns
resolvconf

View file

@ -72,6 +72,7 @@ in {
FEATURE_EDITING_MAX_LEN = "1024";
FEATURE_TAB_COMPLETION = "y";
FEATURE_EDITING_WINCH = "y";
FEATURE_IPV6 = "y";
};
};
filesystem = dir {

View file

@ -45,14 +45,15 @@ in {
pppoe = callPackage ./pppoe.nix {};
dnsmasq = callPackage ./dnsmasq.nix {};
hostapd = callPackage ./hostapd.nix {};
route = { name, target, via, dependencies }:
oneshot {
route = { name, target, via, dependencies, dev ? null }:
let with_dev = if dev != null then "dev ${dev}" else "";
in oneshot {
inherit name;
up = ''
ip route add ${target} via ${via}
ip route add ${target} via ${via} ${with_dev}
'';
down = ''
ip route del ${target} via ${via}
ip route del ${target} via ${via} ${with_dev}
'';
inherit dependencies;
};