sketchy-router: give interfaces proper names

This commit is contained in:
lilly 2025-03-07 21:00:30 +01:00
parent a703eaf0b0
commit 0f6eb8c599
Signed by: lilly
SSH key fingerprint: SHA256:y9T5GFw2A20WVklhetIxG1+kcg/Ce0shnQmbu1LQ37g
2 changed files with 47 additions and 21 deletions

View file

@ -34,6 +34,19 @@ in
{
imports = [ ];
# configure static IP address
networking.useDHCP = false;
systemd.network = {
enable = true;
networks = {
"10-mgmtNet" = {
matchConfig.MACAddress = "bc:24:11:c1:8a:a4";
address = [ "10.20.25.3/24" ];
gateway = [ "10.20.25.2" ];
};
};
};
# enable knot authorative dns server
# ref: https://search.nüschtos.de/?query=services.knot
# https://www.knot-dns.cz/docs/3.4/html/configuration.html

View file

@ -2,6 +2,17 @@
pkgs,
...
}:
let
renameLink = macAddr: newName: {
matchConfig = {
MACAddress = macAddr;
Type = "ether";
};
linkConfig = {
Name = newName;
};
};
in
{
imports = [ ];
@ -14,14 +25,18 @@
networking.nftables.enable = true;
systemd.network = {
enable = true;
links = {
"10-ethUpstream" = renameLink "BC:24:11:D2:69:8D" "ethUpstream";
"10-ethMgmt" = renameLink "BC:24:11:A3:38:4E" "ethMgmt";
};
networks = {
"10-ethUpstream" = {
matchConfig.MACAddress = "BC:24:11:D2:69:8D";
matchConfig.Name = "ethUpstream";
address = [ "10.31.245.2/24" ];
gateway = [ "10.31.245.1" ];
};
"10-ethMgmt" = {
matchConfig.MACAddress = "BC:24:11:A3:38:4E";
matchConfig.Name = "ethMgmt";
address = [ "10.20.25.2/24" ];
};
};
@ -29,7 +44,7 @@
networking.nat = {
enable = true;
externalInterface = "ens18";
externalInterface = "ethUpstream";
internalIPs = [ "10.20.25.0/24" ];
};
@ -38,7 +53,7 @@
settings = {
interfaces-config = {
interfaces = [
"ens19"
"ethMgmt"
];
};
lease-database = {
@ -50,31 +65,29 @@
renew-timer = 1000;
valid-lifetime = 4000;
authoritative = true;
option-data = [
{
name = "domain-name-servers";
data = "9.9.9.9";
}
{
name = "routers";
data = "10.20.25.2";
}
];
shared-networks = [
{
name = "mgmtNet";
interface = "ens19";
interface = "ethMgmt";
option-data = [
{
name = "domain-name-servers";
data = "10.20.25.5";
}
{
name = "domain-search";
data = "noc.eh22.intern.";
}
{
name = "routers";
data = "10.20.25.2";
}
];
subnet4 = [
{
id = 300;
subnet = "10.20.25.0/24";
pools = [ { pool = "10.20.25.100 - 10.20.25.254"; } ];
reservations = [
{
hw-address = "bc:24:11:c1:8a:a4";
ip-address = "10.20.25.3";
}
];
}
];
}