WIP: router: remove temporary tests
This commit is contained in:
parent
478cf9ca2a
commit
ccbc53579d
@ -18,7 +18,7 @@ let
|
|||||||
matchConfig.Name = ifObj.name;
|
matchConfig.Name = ifObj.name;
|
||||||
networkConfig = {
|
networkConfig = {
|
||||||
IPv4Forwarding = true;
|
IPv4Forwarding = true;
|
||||||
IPv6SendRA = (ifObj.name != ifs.lan10.name); # TODO: temporary test, remove
|
IPv6SendRA = true;
|
||||||
Address = [ ifObj.addr4Sized ifObj.addr6Sized ifObj.ulaAddrSized ];
|
Address = [ ifObj.addr4Sized ifObj.addr6Sized ifObj.ulaAddrSized ];
|
||||||
};
|
};
|
||||||
ipv6Prefixes = [
|
ipv6Prefixes = [
|
||||||
@ -44,37 +44,35 @@ let
|
|||||||
DNS = [ ifObj.ulaAddr ];
|
DNS = [ ifObj.ulaAddr ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# It is impossible to do multiple prefix requests with networkd,
|
# It is impossible to do multiple prefix requests with networkd,
|
||||||
# so I use dhcpcd for this
|
# so I use dhcpcd for this
|
||||||
# https://github.com/systemd/systemd/issues/22571
|
# https://github.com/systemd/systemd/issues/22571
|
||||||
networking.dhcpcd.enable = true;
|
|
||||||
# https://github.com/systemd/systemd/issues/22571#issuecomment-2094905496
|
# https://github.com/systemd/systemd/issues/22571#issuecomment-2094905496
|
||||||
# https://gist.github.com/csamsel/0f8cca3b2e64d7e4cc47819ec5ba9396
|
# https://gist.github.com/csamsel/0f8cca3b2e64d7e4cc47819ec5ba9396
|
||||||
|
networking.dhcpcd.enable = true;
|
||||||
|
networking.dhcpcd.allowInterfaces = [ ifs.wan.name ];
|
||||||
networking.dhcpcd.extraConfig = ''
|
networking.dhcpcd.extraConfig = ''
|
||||||
duid
|
|
||||||
ipv6only
|
|
||||||
nodhcp6
|
|
||||||
noipv6rs
|
|
||||||
nohook resolv.conf, yp, hostname, ntp
|
nohook resolv.conf, yp, hostname, ntp
|
||||||
option rapid_commit
|
|
||||||
|
|
||||||
interface ${ifs.wan.name}
|
interface ${ifs.wan.name}
|
||||||
|
# IPv4 (Static)
|
||||||
|
nodhcp
|
||||||
|
noipv4ll
|
||||||
|
static ip_address=${ifs.wan.addr4Sized}
|
||||||
|
static routers=${ifs.wan.gw4}
|
||||||
|
|
||||||
|
# IPv6
|
||||||
|
duid
|
||||||
ipv6rs
|
ipv6rs
|
||||||
dhcp6
|
dhcp6
|
||||||
duid
|
|
||||||
ipv6only
|
|
||||||
nohook resolv.conf, yp, hostname, ntp
|
|
||||||
nogateway
|
|
||||||
option rapid_commit
|
option rapid_commit
|
||||||
|
|
||||||
# this doesn't play well with networkd
|
# DHCPv6 addr
|
||||||
# ia_na
|
ia_na
|
||||||
# ia_pd 1 ${ifs.lan.name}/0
|
|
||||||
# ia_pd 2 ${ifs.lan10.name}/0
|
# DHCPv6 Prefix Delegation
|
||||||
# ia_pd 3 ${ifs.lan20.name}/0
|
|
||||||
|
|
||||||
# request the leases just for routing (so that the att box knows we're here)
|
# request the leases just for routing (so that the att box knows we're here)
|
||||||
# actual ip assignments are static, based on $pdFromWan
|
# actual ip assignments are static, based on $pdFromWan
|
||||||
@ -86,28 +84,14 @@ in
|
|||||||
ia_pd 50/${ifs.lan50.net6} -
|
ia_pd 50/${ifs.lan50.net6} -
|
||||||
# ia_pd 7 -
|
# ia_pd 7 -
|
||||||
# ia_pd 8 -
|
# ia_pd 8 -
|
||||||
|
|
||||||
|
# the leases can be assigned to the interfaces,
|
||||||
|
# but this doesn't play well with networkd
|
||||||
|
# ia_pd 1 ${ifs.lan.name}/0
|
||||||
|
# ia_pd 2 ${ifs.lan10.name}/0
|
||||||
|
# ia_pd 3 ${ifs.lan20.name}/0
|
||||||
'';
|
'';
|
||||||
|
|
||||||
systemd.timers."restart-networkd" = {
|
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
timerConfig = {
|
|
||||||
OnBootSec = "1m";
|
|
||||||
OnUnitActiveSec = "1m";
|
|
||||||
Unit = "restart-networkd.service";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services."restart-networkd" = {
|
|
||||||
script = ''
|
|
||||||
set -eu
|
|
||||||
${pkgs.systemd}/bin/systemctl restart systemd-networkd
|
|
||||||
'';
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
User = "root";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.useNetworkd = true;
|
networking.useNetworkd = true;
|
||||||
systemd.network.enable = true;
|
systemd.network.enable = true;
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
@ -142,20 +126,10 @@ in
|
|||||||
networks = {
|
networks = {
|
||||||
"10-wan" = {
|
"10-wan" = {
|
||||||
matchConfig.Name = ifs.wan.name;
|
matchConfig.Name = ifs.wan.name;
|
||||||
networkConfig = {
|
linkConfig = {
|
||||||
# start a DHCP Client for IPv4 Addressing/Routing
|
Unmanaged = true;
|
||||||
# DHCP = "ipv4";
|
RequiredForOnline = "routable";
|
||||||
# accept Router Advertisements for Stateless IPv6 Autoconfiguraton (SLAAC)
|
|
||||||
# let dhcpcd handle this
|
|
||||||
Address = [ ifs.wan.addr4Sized ];
|
|
||||||
IPv6AcceptRA = false;
|
|
||||||
};
|
};
|
||||||
routes = [
|
|
||||||
{ Gateway = ifs.wan.gw4; }
|
|
||||||
{ Gateway = ifs.wan.gw6; }
|
|
||||||
];
|
|
||||||
# make routing on this interface a dependency for network-online.target
|
|
||||||
linkConfig.RequiredForOnline = "routable";
|
|
||||||
};
|
};
|
||||||
"20-lan" = (mkLanConfig ifs.lan) // {
|
"20-lan" = (mkLanConfig ifs.lan) // {
|
||||||
vlan = [
|
vlan = [
|
||||||
@ -182,43 +156,28 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.interfaces = {
|
# For some reason, the interfaces stop receiving route solicitations after a while.
|
||||||
# ${ifs.lan10.name} = {
|
# Regular router adverts still get sent out at intervals, but this breaks dhcp6 clients.
|
||||||
# ipv4.addresses = [ { address = ifs.lan10.addr4; prefixLength = ifs.lan10.p4Size; } ];
|
# Restarting networkd makes it work again, I have no clue why.
|
||||||
# ipv6.addresses = [
|
# This is jank af, but I've tried a bunch of other stuff with no success
|
||||||
# {
|
# and I'm giving up (for now).
|
||||||
# address = ifs.lan10.addr6;
|
systemd.timers."restart-networkd" = {
|
||||||
# prefixLength = ifs.lan10.p6Size;
|
wantedBy = [ "timers.target" ];
|
||||||
# }
|
timerConfig = {
|
||||||
# {
|
OnBootSec = "1m";
|
||||||
# address = ifs.lan10.ulaAddr;
|
OnUnitActiveSec = "1m";
|
||||||
# prefixLength = ifs.lan10.ulaSize;
|
Unit = "restart-networkd.service";
|
||||||
# }
|
};
|
||||||
# ];
|
|
||||||
# };
|
|
||||||
};
|
};
|
||||||
networking.dhcpcd.allowInterfaces = [ ifs.wan.name ];
|
|
||||||
|
|
||||||
services.radvd.enable = false;
|
systemd.services."restart-networkd" = {
|
||||||
services.radvd.config = ''
|
script = ''
|
||||||
interface ${ifs.lan10.name} {
|
set -eu
|
||||||
RDNSS ${ifs.lan.ulaAddr} {
|
${pkgs.systemd}/bin/systemctl restart systemd-networkd
|
||||||
};
|
'';
|
||||||
AdvSendAdvert on;
|
serviceConfig = {
|
||||||
# MinRtrAdvInterval 3;
|
Type = "oneshot";
|
||||||
# MaxRtrAdvInterval 10;
|
User = "root";
|
||||||
AdvManagedFlag on;
|
|
||||||
# AdvOtherConfigFlag on;
|
|
||||||
prefix ${ifs.lan10.net6} {
|
|
||||||
AdvOnLink on;
|
|
||||||
AdvAutonomous on;
|
|
||||||
};
|
|
||||||
prefix ${ifs.lan10.ulaNet} {
|
|
||||||
AdvOnLink on;
|
|
||||||
AdvAutonomous on;
|
|
||||||
};
|
|
||||||
route ${ulaPrefix}::/48 {
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
'';
|
};
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,6 @@ rec {
|
|||||||
addr4 = "192.168.1.61";
|
addr4 = "192.168.1.61";
|
||||||
addr4Sized = "${addr4}/24";
|
addr4Sized = "${addr4}/24";
|
||||||
gw4 = "192.168.1.254";
|
gw4 = "192.168.1.254";
|
||||||
gw6 = "fe80::e21f:2bff:fe96:e952";
|
|
||||||
};
|
};
|
||||||
lan = mkIfConfig {
|
lan = mkIfConfig {
|
||||||
name_ = "lan";
|
name_ = "lan";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user