sketchy-router: give interfaces proper names
This commit is contained in:
parent
a703eaf0b0
commit
0f6eb8c599
2 changed files with 47 additions and 21 deletions
|
@ -34,6 +34,19 @@ in
|
||||||
{
|
{
|
||||||
imports = [ ];
|
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
|
# enable knot authorative dns server
|
||||||
# ref: https://search.nüschtos.de/?query=services.knot
|
# ref: https://search.nüschtos.de/?query=services.knot
|
||||||
# https://www.knot-dns.cz/docs/3.4/html/configuration.html
|
# https://www.knot-dns.cz/docs/3.4/html/configuration.html
|
||||||
|
|
|
@ -2,6 +2,17 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
renameLink = macAddr: newName: {
|
||||||
|
matchConfig = {
|
||||||
|
MACAddress = macAddr;
|
||||||
|
Type = "ether";
|
||||||
|
};
|
||||||
|
linkConfig = {
|
||||||
|
Name = newName;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
|
|
||||||
|
@ -14,14 +25,18 @@
|
||||||
networking.nftables.enable = true;
|
networking.nftables.enable = true;
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
links = {
|
||||||
|
"10-ethUpstream" = renameLink "BC:24:11:D2:69:8D" "ethUpstream";
|
||||||
|
"10-ethMgmt" = renameLink "BC:24:11:A3:38:4E" "ethMgmt";
|
||||||
|
};
|
||||||
networks = {
|
networks = {
|
||||||
"10-ethUpstream" = {
|
"10-ethUpstream" = {
|
||||||
matchConfig.MACAddress = "BC:24:11:D2:69:8D";
|
matchConfig.Name = "ethUpstream";
|
||||||
address = [ "10.31.245.2/24" ];
|
address = [ "10.31.245.2/24" ];
|
||||||
gateway = [ "10.31.245.1" ];
|
gateway = [ "10.31.245.1" ];
|
||||||
};
|
};
|
||||||
"10-ethMgmt" = {
|
"10-ethMgmt" = {
|
||||||
matchConfig.MACAddress = "BC:24:11:A3:38:4E";
|
matchConfig.Name = "ethMgmt";
|
||||||
address = [ "10.20.25.2/24" ];
|
address = [ "10.20.25.2/24" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -29,7 +44,7 @@
|
||||||
|
|
||||||
networking.nat = {
|
networking.nat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
externalInterface = "ens18";
|
externalInterface = "ethUpstream";
|
||||||
internalIPs = [ "10.20.25.0/24" ];
|
internalIPs = [ "10.20.25.0/24" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,7 +53,7 @@
|
||||||
settings = {
|
settings = {
|
||||||
interfaces-config = {
|
interfaces-config = {
|
||||||
interfaces = [
|
interfaces = [
|
||||||
"ens19"
|
"ethMgmt"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
lease-database = {
|
lease-database = {
|
||||||
|
@ -50,31 +65,29 @@
|
||||||
renew-timer = 1000;
|
renew-timer = 1000;
|
||||||
valid-lifetime = 4000;
|
valid-lifetime = 4000;
|
||||||
authoritative = true;
|
authoritative = true;
|
||||||
option-data = [
|
|
||||||
{
|
|
||||||
name = "domain-name-servers";
|
|
||||||
data = "9.9.9.9";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "routers";
|
|
||||||
data = "10.20.25.2";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
shared-networks = [
|
shared-networks = [
|
||||||
{
|
{
|
||||||
name = "mgmtNet";
|
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 = [
|
subnet4 = [
|
||||||
{
|
{
|
||||||
id = 300;
|
id = 300;
|
||||||
subnet = "10.20.25.0/24";
|
subnet = "10.20.25.0/24";
|
||||||
pools = [ { pool = "10.20.25.100 - 10.20.25.254"; } ];
|
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";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue