For simplicity, let’s say that I have one interface, eth0
. I want to turn it into a bridge (for VMs, containers), and at the same time use a couple ot VLANS with it. Bridges over eth0
work fine. VLANs over eth0
also work fine. But I’m failing to combine the two.
Here’s what I got so far. In this configuration everything is created seemingly ok, but DHCP does not work. Static IP (used in my management VLAN) works fine, I can access the machines in that VLAN.
Any ideas?
networking = {
useNetworkd = false;
useDHCP = false; # off by defalut, enable per-interface
hostName = "ago";
# zfs needs hostId, so we derive it from hostname
hostId = lib.mkDefault (builtins.substring 0 8 (builtins.hashString "md5" config.networking.hostName));
firewall.enable = false; # let's not complicate things while debugging
bridges = {
"br0" = {
interfaces = [ "eth0" ]; # sits on top of eth0
};
};
vlans = {
vlan30 = {
id = 30;
interface = "br0";
};
vlan99 = {
id = 99;
interface = "br0";
};
};
interfaces = {
eth0.useDHCP = false; # Interface is bridged
br0.useDHCP = true; # Bridge gets IP via DHCP
vlan30.useDHCP = true; # VLAN 50 gets IP via DHCP
vlan99 = {
ipv4.addresses = [{
address = "10.99.99.30";
prefixLength = 24;
}];
};
};
};
This results in:
🟢 nc -vz 10.99.99.1 82
Connection to 10.99.99.1 82 port [tcp/xfer] succeeded!
🟢 ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
link/ether 00:15:5d:0e:cb:43 brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:15:5d:0e:cb:43 brd ff:ff:ff:ff:ff:ff
5: vlan30@br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:15:5d:0e:cb:43 brd ff:ff:ff:ff:ff:ff
6: vlan99@br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:15:5d:0e:cb:43 brd ff:ff:ff:ff:ff:ff
inet 10.99.99.30/24 scope global vlan99
valid_lft forever preferred_lft forever
Update: it looks like dhcpcd
doesn’t like that I’ve got IPV6 disabled. WAT!
Feb 07 23:57:35 ago systemd[1]: Starting DHCP Client...
Feb 07 23:57:35 ago (e-dhcpcd)[12345]: dhcpcd.service: Failed to set up mount namespacing: /proc/sys/net/ipv6: No such file or directory
Feb 07 23:57:35 ago (e-dhcpcd)[12345]: dhcpcd.service: Failed at step NAMESPACE spawning /nix/store/jm83gcsczykqcsix267lfb6l6f9d82c4-migrate-dhcpcd: No such file or>
Feb 07 23:57:35 ago systemd[1]: dhcpcd.service: Control process exited, code=exited, status=226/NAMESPACE
Feb 07 23:57:35 ago systemd[1]: dhcpcd.service: Failed with result 'exit-code'.
Feb 07 23:57:35 ago systemd[1]: Failed to start DHCP Client.
Feb 07 23:57:35 ago systemd[1]: dhcpcd.service: Scheduled restart job, restart counter is at 2.
Indeed, enabling IPv6 fixed the error - but I do not wish to have it on my systems! How to fix???