From d36ad3c9edbd87338f1dcd6ca6dc2d1d60f0f166 Mon Sep 17 00:00:00 2001 From: Igor Rzegocki Date: Thu, 12 Dec 2024 16:48:25 +0100 Subject: [PATCH] feat(meemee): temporary set up VLANs --- machines/meemee/configuration.nix | 87 ++++++++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 7 deletions(-) diff --git a/machines/meemee/configuration.nix b/machines/meemee/configuration.nix index 3b630e0..6e7447f 100644 --- a/machines/meemee/configuration.nix +++ b/machines/meemee/configuration.nix @@ -85,13 +85,86 @@ rec { firewallEnable = true; hostname = "meemee"; mainInterface = { - name = "enp1s0"; - bridge = true; - bridgeMAC = "02:00:0a:64:14:02"; - DNS = [ - "9.9.9.9" - "149.112.112.10" - ]; + name = "trst0"; + }; + customNetworking = { + enable = true; + links = { + "0000-bridge-inherit-mac" = { + matchConfig.Type = "bridge"; + linkConfig.MACAddressPolicy = "none"; + }; + }; + netdevs = { + "0001-uplink" = { + netdevConfig = { + Kind = "bridge"; + Name = "br0"; + MACAddress = "none"; + }; + bridgeConfig = { + VLANFiltering = true; + STP = false; + }; + }; + "0002-trst0" = { + netdevConfig = { + Kind = "vlan"; + Name = "trst0"; + }; + vlanConfig.Id = 100; + }; + "0003-iot0" = { + netdevConfig = { + Kind = "vlan"; + Name = "iot0"; + }; + vlanConfig.Id = 210; + }; + }; + networks = { + "1002-add-main-to-br0" = { + matchConfig.Name = "enp1s0"; + bridge = [ "br0" ]; + bridgeVLANs = [ + { VLAN = 100; } + { VLAN = 210; } + ]; + }; + "1003-br0-up" = { + inherit (mySystem.networking.customNetworking.networks."1002-add-main-to-br0") bridgeVLANs; + matchConfig.Name = "br0"; + vlan = [ + "trst0" + "iot0" + ]; + networkConfig = { + LinkLocalAddressing = "no"; + }; + }; + "1004-trst0-up" = { + matchConfig.Name = "trst0"; + linkConfig = { + RequiredForOnline = "routable"; + MACAddress = "02:00:0a:64:14:02"; + }; + networkConfig = { + LinkLocalAddressing = "no"; # disable fallback IPs + DHCP = "ipv4"; + }; + }; + "1005-iot0-up" = { + matchConfig.Name = "iot0"; + linkConfig = { + RequiredForOnline = "routable"; + MACAddress = "02:00:0a:d2:14:02"; + }; + networkConfig = { + LinkLocalAddressing = "no"; # disable fallback IPs + DHCP = "ipv4"; + }; + }; + }; }; };