As far as I understand how bridge interfaces work in TrueNAS, their MAC address should be inherited from the first member physical interface. However, when I set up my bridge, I got some random MAC and there doesn’t seem to be a way to change it. Is there a way to force the MAC to be inherited from member NIC?
I can be wrong, but assuming the bridge represents a dumb L2 switch, there is no MAC address.
Anyway, what exactly are you trying to accomplish?
Welp, it looks like this statement is incorrect. But my question stands.
My use case is simple - I need a bridge between my VMs and other parts of the system. I created a bridge which contains my physical NIC and VMs interfaces and sometimes there are problems obtaining IP from my router. The desired state would be bridge interface getting the IP address, in which case everything works, but sometimes the router gives the IP to the NIC and there’s no communication with the server. If I understand correctly, that’s because the NIC and the bridge have different MAC addresses (which is true) and there’s a race condition on which gets the IP first. If both shared the same MAC, the bridge should be the one getting the IP.
IP (or DHCP) on the bridge should not interfere with your VMs. If you want to have automatically assigned IPs for VMs, just set up DHCP inside the VM.
If you want your TrueNAS to obtain an IP from the router as well, you should remove all IPs (aka aliases) from both the NIC and the bridge and then set the DHCP checkbox on the bridge.
The NIC doesn’t have an alias - only the bridge has. DHCP is not used at all and I’m not sure how stable the bridge MAC is to set it up. This setup should work if the MAC gets shared, but I don’t see a way to make it so. The NIC should be enslaved to the bridge by default.
How do you plan to obtain IP from the router without DHCP?
The bridge has a static one. All of the setup has been done accordingly to the official docs.
You should be able to access your truenas via that static one then.
Do you have DHCP inside VMs? Or do you want them to have static IPs as well?
VMs are not the problem. I know the static IP should work, but the whole problem is about it not working when the NIC, instead of the bridge, gets the IP. That’s the thing - I don’t know why sometimes it gets it, while not having any alias configured. The only information I found is that, by default, the bridge should share the MAC with the physical NIC. Yet, in my case, it’s not sharing.
- What exactly is not working?
- Does your NIC have the DHCP checkbox set? If so – remove it.
- Do you have any DHCP reservations (aka static leases) configured on your router?
The setup:
- bridge interface with VM interfaces and a NIC
- DHCP disabled for the bridge and NIC
- bridge having a static IP
The problem:
When TN starts up, sometimes the bridge gets its static IP and is THE interface visible in the router, but other times, the NIC gets the same IP and is the interface visible in the router. When the NIC gets the IP, instead of the bridge, there’s no communication with the server.
What about static leases on the router?
TBH, I don’t understand how the NIC gets IP (and even the same as the bridge) if it has DHCP disabled.
Post ip a output.
These are the relevant interfaces:
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
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp6s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 9c:6b:00:a0:94:e8 brd ff:ff:ff:ff:ff:ff
3: enp7s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether 9c:6b:00:a0:9a:10 brd ff:ff:ff:ff:ff:ff
4: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
link/ether 00:e0:4c:6a:3c:62 brd ff:ff:ff:ff:ff:ff
inet6 fe80::2e0:4cff:fe6a:3c62/64 scope link
valid_lft forever preferred_lft forever
5: enx02e8e506caf7: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 02:e8:e5:06:ca:f7 brd ff:ff:ff:ff:ff:ff
6: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 1a:30:50:fa:9b:71 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.31/24 brd 192.168.1.255 scope global br0
valid_lft forever preferred_lft forever
inet6 fe80::b0f3:4aff:fe52:f2d7/64 scope link
valid_lft forever preferred_lft forever
7: tap4c81dc92: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
link/ether c2:d3:d3:d0:ce:8d brd ff:ff:ff:ff:ff:ff
.
Seems like your NIC doesn’t have an IP at the moment. Perhaps you should execute ip a when it does.
Of course it doesn’t have an IP - it shouldn’t have. The problem is when it gets an IP.
…
I’m not going to intentionally break the server communication, but I can assure you that its the same as the bridge interface now.
Ok.
And
Also. It seems like you have multiple (unused) NICs. Perhaps you could try to configure VMs bridge over one of them, thus making VMs use separate NIC.
Happened again and here’s the output:
1: lo: <LOOPBACK, UP, LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group defaul
t 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
inet6 :: 1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp6s0: <BROADCAST, MULTICAST> mtu 1500 qdisc noop state DOWN group default ql
en 1000
link/ether 9c:6b:00:a0:94:e8 brd ff:ff:ff:ff:ff:ff
3: enp7s0: <NO-CARRIER, BROADCAST, MULTICAST, UP> mtu 1500 qdisc mq state DOWN grou
p default qlen 1000
link/ether 9c:6b:00:a0:9a:10 brd ff:ff:ff:ff:ff:ff
4: enp2s0: <BROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc fq_codel state UP gr
oup default qlen 1000
link/ether 00:e0:4c:6a:3c:62 brd ff:ff:ff:ff:ff:ff
inet6 fe80 :: 2e0:4cff:fe6a:3c62/64 scope link
valid_lft forever preferred_lft forever
5: enx02e8e506caf7: <BROADCAST, MULTICAST> mtu 1500 qdisc noop state DOWN group d
efault qlen 1000
link/ether 02:e8:e5:06:ca:f7 brd ff:ff:ff:ff:ff:ff
6: bro: <BROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc noqueue state UP group
default qlen 1000
link/ether 1a:30:50:fa:9b:71 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.31/24 brd 192.168.1.255 scope global brø
valid_lft forever preferred_lft forever
inet6 fe80 :: 149d: 33ff:fe91:5fb8/64 scope link
valid_lft forever preferred_lft forever