systemd-networkd improvements

This commit is contained in:
Rouven Seifert 2023-12-23 17:30:24 +01:00
parent 70123785d6
commit 1bcad0949a
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
2 changed files with 30 additions and 17 deletions

View file

@ -34,9 +34,13 @@
};
systemd.network = {
enable = true;
config = {
networkConfig = {
SpeedMeter = true;
};
};
networks."10-loopback" = {
matchConfig.Name = "lo";
linkConfig.RequiredForOnline = false;
};
networks."10-wired" = {
matchConfig.Name = "ens3";
@ -56,6 +60,8 @@
wireguardConfig = {
PrivateKeyFile = config.age.secrets."wireguard/dorm/private".path;
ListenPort = 51820;
RouteTable = "main";
RouteMetric = 30;
};
wireguardPeers = [
{
@ -72,18 +78,16 @@
matchConfig.Name = "wg0";
networkConfig = {
DNS = "192.168.42.1";
DNSSEC = true;
BindCarrier = [ "ens3" ];
};
addresses = [
{
addressConfig = {
Address = "192.168.43.4/24";
RouteMetric = 30;
Address = "192.168.43.4/32";
};
}
];
routes = [
{ routeConfig = { Gateway = "0.0.0.0"; Destination = "192.168.42.0/24"; Metric = 30; }; }
];
};
};
}

View file

@ -74,10 +74,14 @@
};
systemd.network = {
enable = true;
wait-online.anyInterface = true;
wait-online.enable = false;
config = {
networkConfig = {
SpeedMeter = true;
};
};
networks."10-loopback" = {
matchConfig.Name = "lo";
linkConfig.RequiredForOnline = false;
};
networks."10-wired-default" = {
matchConfig.Name = "en*";
@ -107,12 +111,17 @@
};
routes = [
# Route to the Model train network via raspi
{ routeConfig = { Gateway = "192.168.178.63"; Destination = "192.168.179.0/24"; }; }
{
routeConfig = {
Gateway = "192.168.178.63";
GatewayOnLink = true;
Destination = "192.168.179.0/24";
};
}
];
};
networks."15-wireless-default" = {
matchConfig.Name = "wlp9s0";
linkConfig.RequiredForOnline = false;
networkConfig = {
DHCP = "yes";
IgnoreCarrierLoss = "3s";
@ -134,13 +143,15 @@
wireguardConfig = {
PrivateKeyFile = config.age.secrets."wireguard/dorm/private".path;
ListenPort = 51820;
RouteTable = "main";
RouteMetric = 30;
};
wireguardPeers = [
{
wireguardPeerConfig = {
PublicKey = "Z5lwwHTCDr6OF4lfaCdSHNveunOn4RzuOQeyB+El9mQ=";
PresharedKeyFile = config.age.secrets."wireguard/dorm/preshared".path;
Endpoint = "141.30.227.6:51820";
Endpoint = "dorm.vpn.rfive.de:51820";
AllowedIPs = "192.168.42.0/24, 192.168.43.0/24";
};
}
@ -148,21 +159,19 @@
};
networks."30-wg0" = {
matchConfig.Name = "wg0";
linkConfig.RequiredForOnline = "carrier";
networkConfig = {
DNS = "192.168.42.1";
DNSSEC = true;
BindCarrier = [ "wlp9s0" "enp0s31f6" ];
};
addresses = [
{
addressConfig = {
Address = "192.168.43.3/24";
RouteMetric = 30;
Address = "192.168.43.3/32";
};
}
];
routes = [
# allowedIPs is somewhat broken
{ routeConfig = { Gateway = "0.0.0.0"; Destination = "192.168.42.0/24"; Metric = 30; }; }
];
};
};
programs.wireshark = {