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 { services.defaultroute4 = route {
name = "defaultroute"; name = "defaultroute4";
via = "$(output ${services.wan} address)"; via = "$(output ${services.wan} address)";
target = "default"; target = "default";
dependencies = [ services.wan ]; 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 = services.firewall =
let let
script= pkgs.firewallgen "firewall.nft" (import ./rotuer-firewall.nix); script= pkgs.firewallgen "firewall.nft" (import ./rotuer-firewall.nix);
@ -307,6 +315,7 @@ in rec {
hostap5 hostap5
ntp ntp
defaultroute4 defaultroute4
defaultroute6
packet_forwarding packet_forwarding
dns dns
resolvconf resolvconf

View file

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

View file

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