How to assign MAC address to a bridge interface?

I have a Bridge interface br0 defined via






How can I assign a mac address to this interface?

I am multi-booting different Fedora editions in this systems, so I want to have the same MAC address for:

Fedora 34
Fedora Silverblue 34

In addition, OpenWrt router allow me to define a static IPv6 assignment based on DUID:

Hostname	MAC-Address	IPv4-Address	Lease time	DUID	IPv6-Suffix (hex)	
amdf	xx:xx:xx:xx:xx:xx	2h	0004bc612e0cc9940f4a8978801549f5619e	34

How can I override the DUID as well?

1 Like

Is your bridge displayed with ip link sh? If so does it show a MAC address?

I notice that I have a virbr0 bridge that shows no MAC in NetworkManager, but does show one from the ip utility. So there has to be some mechanism assigning it a MAC. (Below output was edited to only show relevant information).

nmcli con show

NAME                    UUID                                  TYPE      DEVICE        
virbr0                  4623ff0b-8fc5-410a-87a5-eea23d4782a1  bridge    virbr0        
nmcli con show virbr0 | grep -i mac

bridge.mac-address:                     --
ip link sh virbr0

3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 52:54:00:93:11:9b brd ff:ff:ff:ff:ff:ff

virbr0 is created by libvirt, so I will not touch it normally.

For the br0, it is created using nm-connection-editor . From the edotir UI, there is no way to override the MAC address of the bridge interface.

Finally, I solved the MAC address override by editing the [bridge] section:


So now, my next task is to override the ipv6-duid for my VLAN connections.

I know vibro0 is made by libvirt. I was curious as to when you made your bridge and didn’t specify a MAC, if one was created for it. And if it was if it displayed as my virbr0 did: not in NetworkManager but does with ip.

Let me remove the override, reboot and see.

== update ==
As checked:

When the override is defined, nmcli con show <connection> shows the MAC address I added to the connection.

When the override is removed, nmcli con show indeed show the as undefined bridge.mac-address: --

So it is auto-generating the MAC when the interface is up . As
nmcli is showing:

br0: connected to br0c
        bridge, xx:xx:xx:xx:xx:xx, sw, mtu 1500

Was there also no MAC address for ip link sh?

ip link show always list the MAC address correctly.

nmcli connection modify id br0c \
    ethernet.cloned-mac-address MACADDR \
    ipv6.dhcp-duid DUID
nmcli connection up id br0c

nm-settings-nmcli: NetworkManager Reference Manual

1 Like

MACADDR works, but DUID do not.

nmcli con show br0c | grep duid
ipv6.dhcp-duid:                         0004BC612E0CC9940F4A8978801549F5619E

Active DHCPv6 leases at Router

Active DHCPv6 Leases
Host	IPv6 address	DUID	Lease time remaining
amdf	xx::857 yy::857	00047e313c4ee85714f5f79657e0e7ce955b	0h 0m 24s

Static Leases at Router

|Hostname|MAC-Address|IPv4-Address|Lease time|DUID|IPv6-Suffix (hex)||

This just works for me:

# OpenWrt
uci add dhcp host
uci set dhcp.@host[-1].duid="000100004fd454041c6f65d26f43"
uci set dhcp.@host[-1].hostid="23"
uci commit dhcp
/etc/init.d/odhcpd restart

# Fedora
nmcli connection modify id vghome ipv6.dhcp-duid 000100004fd454041c6f65d26f43
nmcli connection up id vghome 
nmcli -g IP6.ADDRESS connection show id vghome

OK - finally I find out why.

nmcli con
NAME     UUID                                  TYPE      DEVICE 
vl102c   c3b65409-5617-4ef8-9afd-5136ab97afe1  vlan      102    
vl224c   7335c403-a1f3-446a-af21-5a043ea1a26e  vlan      224    
br0c     17aa4482-0bc6-4047-9648-2e7fcc5ac767  bridge    br0    
enp1s0c  7ca5dd24-9e35-4809-8deb-43cc4dc389e0  ethernet  enp1s0 

My br0c have both IPv4 & 6 disabled.
My IPv6 is running at vl224c, so the duid assignment need to be done to vl224c, instead of br0c.

But MACADDR override can be done to br0c .

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.