Created
June 18, 2025 07:32
-
-
Save boffbowsh/aa999b7971b9ebc0b2f8c3b4ad941a2c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ ... }: | |
let | |
landev = "enp0s31f6"; | |
ltedev = "enp0s20f0u5"; | |
pvhdev = "enp0s20f0u6"; | |
in | |
{ | |
networking.useDHCP = false; | |
systemd.network = { | |
enable = true; | |
config = { | |
routeTables.bulk_http = 1; | |
}; | |
networks = { | |
"10-lan" = { | |
matchConfig.Name = landev; | |
networkConfig = { | |
DHCP = "no"; | |
DHCPServer = "yes"; | |
Address = "10.10.0.1/24"; | |
IPMasquerade = "ipv4"; | |
}; | |
routingPolicyRules = [ | |
{ | |
IPProtocol = "tcp"; | |
DestinationPort = "80"; | |
Table = "bulk_http"; | |
} | |
{ | |
IPProtocol = "tcp"; | |
DestinationPort = "443"; | |
Table = "bulk_http"; | |
} | |
]; | |
dhcpServerConfig = { | |
PoolOffset = 10; | |
PoolSize = 180; | |
EmitDNS = "yes"; | |
DNS = "_server_address"; | |
}; | |
}; | |
"20-lte" = { | |
matchConfig.Name = ltedev; | |
networkConfig = { | |
DHCP = "ipv4"; | |
IPv6AcceptRA = false; | |
}; | |
routes = [ | |
{ | |
Destination = "0.0.0.0/0"; | |
Gateway = "_dhcp4"; | |
Table = "main"; | |
Metric = 200; # fallback if hall DSL is down | |
} | |
{ | |
Destination = "0.0.0.0/0"; | |
Gateway = "_dhcp4"; | |
Table = "bulk_http"; # bulk http traffic over LTE | |
Metric = 100; # default route | |
} | |
]; | |
}; | |
"30-pvh" = { | |
matchConfig.Name = pvhdev; | |
networkConfig = { | |
DHCP = "ipv4"; | |
IPv6AcceptRA = false; | |
}; | |
routes = [ | |
{ | |
Destination = "0.0.0.0/0"; | |
Gateway = "_dhcp4"; | |
Table = "main"; | |
Metric = 100; # default route | |
} | |
{ | |
Destination = "0.0.0.0/0"; | |
Gateway = "_dhcp4"; | |
Table = "bulk_http"; # bulk http traffic over Hall DSL | |
Metric = 200; # fallback if LTE is down | |
} | |
]; | |
}; | |
}; | |
}; | |
systemd.services.bind = { | |
wants = [ "network-online.target" ]; | |
after = [ "network-online.target" ]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment