VLAN Systemd Networking

Hello,

Need some help with systemd networking config. I’m trying to configure the eno1 interface and two VLANs and with what have, I do see the netdev files created when I check ls -l /etc/systemd/network/*netdev*. ip link show has no VLAN interfaces though. I also run into an issue where if I create just just 10-eno1, the PC becomes unroutable but if I have separate -trunk and -physical configs allows it to keep working. Here is what I have setup for systemd networking:

 systemd.network = {
    netdevs = {
      "20-vlan50" = {
        netdevConfig = {
          Kind = "vlan";
          Name = "vlan50";
        };
        vlanConfig.Id = 50;
      };
      "20-vlan100" = {
        netdevConfig = {
          Kind = "vlan";
          Name = "vlan100";
        };
        vlanConfig.Id = 100;
      };
    };

    networks = {
      "10-eno1-trunk" = {
        matchConfig.name = "eno1";
        vlan = [
          "vlan50"
          "vlan100"
        ];
        networkConfig.LinkLocalAddressing = "no";
        linkConfig.RequiredForOnline = "no";
      };
      "15-eno-physical" = {
        matchConfig.Name = "eno1";
        address = [
          "10.5.5.15/24"
        ];
        gateway = [ "10.5.5.1" ];
        dns = [ "10.5.5.1" ];
        linkConfig.RequiredForOnline = "routable";
      };
        "30-vlan50" = {
          matchConfig.Name = "vlan50";
          DHCP = "ipv4";
          linkConfig.RequiredForOnline = "no";
        };
        "30-vlan100" = {
          matchConfig.Name = "vlan100";
          DHCP = "ipv4";
          linkConfig.RequiredForOnline = "no";
        };
      };
  };

1 Like

Do not split networks 10-eno… and 15-eno… just join them into one entry (vlans and untagged phys address).

But keep in mind:

In general its bad practice to mix tagged and untagged traffic on the same interface. I do this sometimes in prod - but expect all kinds wired bugs and side effects - depending on hardware, firmware, driver quality and services. Avoid if possible.

When I combine them, it stops being routeable but when I separate it, it works. 10.5.5.x is also a VLAN but I didn’t move it to being tagged cause I haven’t been able to get vlan50 or 100 to show up correctly

you match en01 to the same interface, resulting in conflicting settings

"10-eno1-trunk" says:
 matchConfig.Name = "eno1";
 networkConfig.LinkLocalAddressing = "no";
  linkConfig.RequiredForOnline = "no";
 
"15-eno-physical" 
 matchConfig.Name = "eno1";
 address = [ "10.5.5.15/24"];
 gateway = [ "10.5.5.1" ];
  dns = [ "10.5.5.1" ];
  linkConfig.RequiredForOnline = "routable";

just merge them

"10-eno1" = {
 enable = true;
 matchConfig.Name = "eno1";
 address = [ "10.5.5.15/24"];
 gateway = [ "10.5.5.1" ];
  dns = [ "10.5.5.1" ];
  vlan = [ "vlan50" "vlan100" ];
 linkConfig.RequiredForOnline = "routable";
};

check

  • with the command ‘ip a‘ if eno1 is really your current fully qualified interface name
  • ensure en01 is controlled by systemd.networkd
networking = {
 usePredictableInterfaceNames = true; 
 networkmanager.enable = false;
};
  systemd.network.enable = true;

Yes, so I combine them as show and eno1 no longer has an IP set, going back to the original config, the IP is set again.

Ha… you know what… I just found it, in the first config I didn’t capitalize the “N” in

networks = { "10-eno1-trunk" = { matchConfig.name = "eno1";

I now have it set and both vlans show, but they aren’t getting IPs. DHCP = “ipv4”; is the correct way, yes?

yes, if you have in vlan50 & vlan100 ip4 dhcp just add

networks."<name>".DHCP = "ipv4";