mirror of
https://git.sr.ht/~rouven/nixos-config
synced 2024-11-15 05:13:10 +01:00
systemd-networkd improvements
This commit is contained in:
parent
70123785d6
commit
1bcad0949a
|
@ -34,9 +34,13 @@
|
||||||
};
|
};
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
config = {
|
||||||
|
networkConfig = {
|
||||||
|
SpeedMeter = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
networks."10-loopback" = {
|
networks."10-loopback" = {
|
||||||
matchConfig.Name = "lo";
|
matchConfig.Name = "lo";
|
||||||
linkConfig.RequiredForOnline = false;
|
|
||||||
};
|
};
|
||||||
networks."10-wired" = {
|
networks."10-wired" = {
|
||||||
matchConfig.Name = "ens3";
|
matchConfig.Name = "ens3";
|
||||||
|
@ -56,6 +60,8 @@
|
||||||
wireguardConfig = {
|
wireguardConfig = {
|
||||||
PrivateKeyFile = config.age.secrets."wireguard/dorm/private".path;
|
PrivateKeyFile = config.age.secrets."wireguard/dorm/private".path;
|
||||||
ListenPort = 51820;
|
ListenPort = 51820;
|
||||||
|
RouteTable = "main";
|
||||||
|
RouteMetric = 30;
|
||||||
};
|
};
|
||||||
wireguardPeers = [
|
wireguardPeers = [
|
||||||
{
|
{
|
||||||
|
@ -72,18 +78,16 @@
|
||||||
matchConfig.Name = "wg0";
|
matchConfig.Name = "wg0";
|
||||||
networkConfig = {
|
networkConfig = {
|
||||||
DNS = "192.168.42.1";
|
DNS = "192.168.42.1";
|
||||||
|
DNSSEC = true;
|
||||||
|
BindCarrier = [ "ens3" ];
|
||||||
};
|
};
|
||||||
addresses = [
|
addresses = [
|
||||||
{
|
{
|
||||||
addressConfig = {
|
addressConfig = {
|
||||||
Address = "192.168.43.4/24";
|
Address = "192.168.43.4/32";
|
||||||
RouteMetric = 30;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
routes = [
|
|
||||||
{ routeConfig = { Gateway = "0.0.0.0"; Destination = "192.168.42.0/24"; Metric = 30; }; }
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,10 +74,14 @@
|
||||||
};
|
};
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
enable = true;
|
enable = true;
|
||||||
wait-online.anyInterface = true;
|
wait-online.enable = false;
|
||||||
|
config = {
|
||||||
|
networkConfig = {
|
||||||
|
SpeedMeter = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
networks."10-loopback" = {
|
networks."10-loopback" = {
|
||||||
matchConfig.Name = "lo";
|
matchConfig.Name = "lo";
|
||||||
linkConfig.RequiredForOnline = false;
|
|
||||||
};
|
};
|
||||||
networks."10-wired-default" = {
|
networks."10-wired-default" = {
|
||||||
matchConfig.Name = "en*";
|
matchConfig.Name = "en*";
|
||||||
|
@ -107,12 +111,17 @@
|
||||||
};
|
};
|
||||||
routes = [
|
routes = [
|
||||||
# Route to the Model train network via raspi
|
# 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" = {
|
networks."15-wireless-default" = {
|
||||||
matchConfig.Name = "wlp9s0";
|
matchConfig.Name = "wlp9s0";
|
||||||
linkConfig.RequiredForOnline = false;
|
|
||||||
networkConfig = {
|
networkConfig = {
|
||||||
DHCP = "yes";
|
DHCP = "yes";
|
||||||
IgnoreCarrierLoss = "3s";
|
IgnoreCarrierLoss = "3s";
|
||||||
|
@ -134,13 +143,15 @@
|
||||||
wireguardConfig = {
|
wireguardConfig = {
|
||||||
PrivateKeyFile = config.age.secrets."wireguard/dorm/private".path;
|
PrivateKeyFile = config.age.secrets."wireguard/dorm/private".path;
|
||||||
ListenPort = 51820;
|
ListenPort = 51820;
|
||||||
|
RouteTable = "main";
|
||||||
|
RouteMetric = 30;
|
||||||
};
|
};
|
||||||
wireguardPeers = [
|
wireguardPeers = [
|
||||||
{
|
{
|
||||||
wireguardPeerConfig = {
|
wireguardPeerConfig = {
|
||||||
PublicKey = "Z5lwwHTCDr6OF4lfaCdSHNveunOn4RzuOQeyB+El9mQ=";
|
PublicKey = "Z5lwwHTCDr6OF4lfaCdSHNveunOn4RzuOQeyB+El9mQ=";
|
||||||
PresharedKeyFile = config.age.secrets."wireguard/dorm/preshared".path;
|
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";
|
AllowedIPs = "192.168.42.0/24, 192.168.43.0/24";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -148,21 +159,19 @@
|
||||||
};
|
};
|
||||||
networks."30-wg0" = {
|
networks."30-wg0" = {
|
||||||
matchConfig.Name = "wg0";
|
matchConfig.Name = "wg0";
|
||||||
|
linkConfig.RequiredForOnline = "carrier";
|
||||||
networkConfig = {
|
networkConfig = {
|
||||||
DNS = "192.168.42.1";
|
DNS = "192.168.42.1";
|
||||||
|
DNSSEC = true;
|
||||||
|
BindCarrier = [ "wlp9s0" "enp0s31f6" ];
|
||||||
};
|
};
|
||||||
addresses = [
|
addresses = [
|
||||||
{
|
{
|
||||||
addressConfig = {
|
addressConfig = {
|
||||||
Address = "192.168.43.3/24";
|
Address = "192.168.43.3/32";
|
||||||
RouteMetric = 30;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
routes = [
|
|
||||||
# allowedIPs is somewhat broken
|
|
||||||
{ routeConfig = { Gateway = "0.0.0.0"; Destination = "192.168.42.0/24"; Metric = 30; }; }
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
programs.wireshark = {
|
programs.wireshark = {
|
||||||
|
|
Loading…
Reference in a new issue