Skip to contentSkip to conversation

Why should static MAC address match one of the port MAC addresses - bug?

Bridge Rolf Fokkens 2 participants 6 messages Dec 19, 2010 – Dec 26, 2010 Ethernet bridge

lore
Share & tools
lore
#0 lore raw

Hi All,

Despite of what Stephen explains, I'm having the problem Michiel describes as well. I have a bridge br2 containing 1 (but potentially more) tap interface for kvm. Windows 7 VM doesn't like the bridge mac address to change, so I try to make it fixed.

ifconfig br2 hw ether 02:00:00:00:01:02

Interface br2 becomes instantly unreachable from the VM (via the tap interface). No arp response or anything else.

So, Michiel's claim seems to be true: the bridge mac address should apparently be one of the bridge interfaces. But I don't see the logic, this seems like a bug to me.

kernel is Fedora kernel-2.6.35.9-64.fc14.x86_64.

Cheers,

Rolf

Quoted 52 lines

------------------------------------------------------------------------

* /To/: Michel Lammertink <mlammertink@xxxxxxxxx <mailto:[email protected]>>
* /Subject/: Re: Why should static MAC address match one of the port MAC addresses.
* /From/: Stephen Hemminger <shemminger@xxxxxxxxxxxxxxxxxxxx <mailto:[email protected]>>
* /Date/: Tue, 12 Oct 2010 09:44:08 -0700
* /Cc/: bridge@xxxxxxxxxxxxxxxxxxxxxxxxxx <mailto:[email protected]>
* /In-reply-to/: <4CB46549.2070901@xxxxxxxxx <mailto:[email protected]>>
* /Organization/: Linux Foundation
* /References/: <4CB46549.2070901@xxxxxxxxx <mailto:[email protected]>>

------------------------------------------------------------------------

Quoted 10 lines · On Tue, 12 Oct 2010 15:40:25 +0200 Michel Lammertink<mlammertink@xxxxxxxxx>…
/  Hi all,/
/  /
/  I've read many messages on this mailing list with the question about/
/  setting a static MAC address on the bridge interface, but two questions/
/  remain:/
/  /
/   1. Why should the MAC address of the bridge match the address of one of/
/  its interfaces? Setting the MAC address to a different value does not/
/  generate an error, but the bridge is not working properly (Local data/
/  does not arrive)./

No longer a requirement. It was just a good way to ensure a good address that was unique, and not being used by other systems.

Quoted 3 lines

/ 2. Why does the bridge by default choose the "lowest" MAC address,/
/ instead of the MAC address of the first port added, as is proposed by/ / the standard [1]?/

It was a convenience in original design to choose a consistent value. Since ports can be added in any order, using the lowest seemed like a good idea for the original author. This has been maintained for backwards compatibility.

Quoted 8 lines

/ [1] IEEE802.1D, Par. 7.12.5./
/ Quote: "The Bridge Address may be the individual MAC Address of a/

/  Bridge Port, in which case, use of the address of the lowest numbered/
/  Bridge Port (Port 1) is recommended."/
/  /
/  Thanks in advance,/
/  /
/  Michel./
#1 lore raw
Quoted 16 lines · On Sun, 19 Dec 2010 23:26:22 +0100 Rolf Fokkens <[email protected]> wrote:

Hi All,

Despite of what Stephen explains, I'm having the problem Michiel describes as well. I have a bridge br2 containing 1 (but potentially more) tap interface for kvm. Windows 7 VM doesn't like the bridge mac address to change, so I try to make it fixed.

ifconfig br2 hw ether 02:00:00:00:01:02

Interface br2 becomes instantly unreachable from the VM (via the tap interface). No arp response or anything else.

So, Michiel's claim seems to be true: the bridge mac address should apparently be one of the bridge interfaces. But I don't see the logic, this seems like a bug to me.

Quoted 5 lines

kernel is Fedora kernel-2.6.35.9-64.fc14.x86_64.

Cheers,

Rolf

The address you change the address, it is like you changed the MAC address of a card on the network. Windows ARP cache is no longer valid and has to time out.

#2 lore raw

Hi,

I think that the bridge interface no longer sees unicast messages addressed to it, after changing the MAC address. I'll explain:

I chose a different MAC address, 02:77:00:00:01:02. This MAC address is absolutely not present on another interface. The MAC address of the Windows XP client is 02:00:00:00:00:01. The bridge interface br2 now only has one interface tap0 which links to the Windows XP client.

[root@home01 ~]# brctl show

bridge name    bridge id        STP enabled    interfaces
br0        8000.002215b81084    no        eth0.3
br1        8000.002215b81084    no        eth0.4
br2        8000.027700000102    no        tap0
br3        8000.002215b81084    no        eth0.1253

The IP address of the Windows XP guest is 192.168.252.1, the IP address of the bridge interface is 192.168.252.254, which is the default gateway address of the Windows XP guest.

Now let's look at the ARP entries. First the Windows XP guest:

C:\>arp -a

Interface 192.168.252.1 --- 0x2
Internet Address Physical Address Type
192.168.252.254 02-77-00-00-01-02 dynamic

Next on the Linux host:

[root@home01 ~]# arp -n

Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.254.7            ether   00:18:f3:fd:09:7a   C                     br1
192.168.254.18           ether   00:16:e8:29:bc:e3   C                     br1
192.168.1.1              ether   00:0e:50:64:7f:74   C                     br0
192.168.254.16           ether   90:84:0d:6f:26:1c   C                     br1
192.168.1.128            ether   00:21:85:98:45:84   C                     br0
192.168.252.1                    (incomplete)                              br2
192.168.254.9            ether   18:a9:05:39:14:95   C                     br1

[root@home01 ~]#

So now we see that the Windows XP guest is aware of the new MAC address of the bridge. However the Linux host is not aware of the guest's MAC address! Time to see what's happening when we use tcpdump:

[root@home01 ~]# tcpdump -n -e -i tap0 arp
tcpdump: WARNING: tap0: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on tap0, link-type EN10MB (Ethernet), capture size 65535 bytes

20:42:23.606319 02:00:00:00:00:01 > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.168.252.254 tell 192.168.252.1, length 28 20:42:23.606359 02:77:00:00:01:02 > 02:00:00:00:00:01, ethertype ARP (0x0806), length 42: Reply 192.168.252.254 is-at 02:77:00:00:01:02, length 28

20:47:42.503536 02:77:00:00:01:02 > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.168.252.1 tell 192.168.252.254, length 28 20:47:42.504039 02:00:00:00:00:01 > 02:77:00:00:01:02, ethertype ARP (0x0806), length 42: Reply 192.168.252.1 is-at 02:00:00:00:00:01, length 28 20:47:43.505541 02:77:00:00:01:02 > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.168.252.1 tell 192.168.252.254, length 28 20:47:43.506316 02:00:00:00:00:01 > 02:77:00:00:01:02, ethertype ARP (0x0806), length 42: Reply 192.168.252.1 is-at 02:00:00:00:00:01, length 28 20:47:44.507539 02:77:00:00:01:02 > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.168.252.1 tell 192.168.252.254, length 28 20:47:44.508319 02:00:00:00:00:01 > 02:77:00:00:01:02, ethertype ARP (0x0806), length 42: Reply 192.168.252.1 is-at 02:00:00:00:00:01, length 28

First we see an ARP request from the Windows XP guest to find the host's 192.168.252.254. There is a fast ARP response, so this is consistent with the ARP table on the Windows XP guest.

Next we see an ARP request from the Linux host to find the guest's 192.168.252.1. This is followed by a fast ARP response. Despite the response both the request and the response are repeated 3 times. This is consistent with the fact that the ARP table on the Linux host is missing the guest's MAC address.

So, apparently both interfaces (br2 and tap0) see the ethernet broadcast, but only the guest's interface (tap0) sees the unicast. This is confirmed by brctl's output:

[root@home01 ~]# brctl showmacs br2

port no mac addr           is local? ageing timer
  1     02:00:00:00:00:01  no        5.38
  1     82:7a:bf:ee:e8:5e  yes       0.00

[root@home01 ~]#

We see two interresting MAC addresses. the first one is the MAC address of the Windows XP guest, which indeed is not local. The second one is the MAC address of the tap0 interface on the host side, which apparently is local. But where's the mac address of br0 itself? It's missing.

This seems unintentional to me.

Rolf

Quoted 5 lines · Stephen Hemminger

The address you change the address, it is like you changed the MAC address of a card on the network. Windows ARP cache is no longer valid and has to time out.

#3 lore raw
Quoted 103 lines · On Mon, 20 Dec 2010 21:03:56 +0100 Rolf Fokkens <[email protected]> wrote:

Hi,

I think that the bridge interface no longer sees unicast messages addressed to it, after changing the MAC address. I'll explain:

I chose a different MAC address, 02:77:00:00:01:02. This MAC address is absolutely not present on another interface. The MAC address of the Windows XP client is 02:00:00:00:00:01. The bridge interface br2 now only has one interface tap0 which links to the Windows XP client.

[root@home01 ~]# brctl show

bridge name    bridge id        STP enabled    interfaces
br0        8000.002215b81084    no        eth0.3
br1        8000.002215b81084    no        eth0.4
br2        8000.027700000102    no        tap0
br3        8000.002215b81084    no        eth0.1253

The IP address of the Windows XP guest is 192.168.252.1, the IP address of the bridge interface is 192.168.252.254, which is the default gateway address of the Windows XP guest.

Now let's look at the ARP entries. First the Windows XP guest:

C:\>arp -a

Interface 192.168.252.1 --- 0x2
Internet Address Physical Address Type
192.168.252.254 02-77-00-00-01-02 dynamic

Next on the Linux host:

[root@home01 ~]# arp -n
Address HWtype HWaddress Flags
Mask Iface
192.168.254.7 ether 00:18:f3:fd:09:7a
C br1
192.168.254.18 ether 00:16:e8:29:bc:e3
C br1
192.168.1.1 ether 00:0e:50:64:7f:74
C br0
192.168.254.16 ether 90:84:0d:6f:26:1c
C br1
192.168.1.128 ether 00:21:85:98:45:84
C br0
192.168.252.1
(incomplete) br2
192.168.254.9 ether 18:a9:05:39:14:95
C br1
[root@home01 ~]#

So now we see that the Windows XP guest is aware of the new MAC address of the bridge. However the Linux host is not aware of the guest's MAC address! Time to see what's happening when we use tcpdump:

[root@home01 ~]# tcpdump -n -e -i tap0 arp
tcpdump: WARNING: tap0: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on tap0, link-type EN10MB (Ethernet), capture size 65535 bytes

20:42:23.606319 02:00:00:00:00:01 > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.168.252.254 tell 192.168.252.1, length 28 20:42:23.606359 02:77:00:00:01:02 > 02:00:00:00:00:01, ethertype ARP (0x0806), length 42: Reply 192.168.252.254 is-at 02:77:00:00:01:02, length 28

20:47:42.503536 02:77:00:00:01:02 > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.168.252.1 tell 192.168.252.254, length 28 20:47:42.504039 02:00:00:00:00:01 > 02:77:00:00:01:02, ethertype ARP (0x0806), length 42: Reply 192.168.252.1 is-at 02:00:00:00:00:01, length 28 20:47:43.505541 02:77:00:00:01:02 > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.168.252.1 tell 192.168.252.254, length 28 20:47:43.506316 02:00:00:00:00:01 > 02:77:00:00:01:02, ethertype ARP (0x0806), length 42: Reply 192.168.252.1 is-at 02:00:00:00:00:01, length 28 20:47:44.507539 02:77:00:00:01:02 > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.168.252.1 tell 192.168.252.254, length 28 20:47:44.508319 02:00:00:00:00:01 > 02:77:00:00:01:02, ethertype ARP (0x0806), length 42: Reply 192.168.252.1 is-at 02:00:00:00:00:01, length 28

First we see an ARP request from the Windows XP guest to find the host's 192.168.252.254. There is a fast ARP response, so this is consistent with the ARP table on the Windows XP guest.

Next we see an ARP request from the Linux host to find the guest's 192.168.252.1. This is followed by a fast ARP response. Despite the response both the request and the response are repeated 3 times. This is consistent with the fact that the ARP table on the Linux host is missing the guest's MAC address.

So, apparently both interfaces (br2 and tap0) see the ethernet broadcast, but only the guest's interface (tap0) sees the unicast. This is confirmed by brctl's output:

[root@home01 ~]# brctl showmacs br2
port no mac addr is local? ageing timer

   1     02:00:00:00:00:01  no        5.38
   1     82:7a:bf:ee:e8:5e  yes       0.00

[root@home01 ~]#

We see two interresting MAC addresses. the first one is the MAC address of the Windows XP guest, which indeed is not local. The second one is the MAC address of the tap0 interface on the host side, which apparently is local. But where's the mac address of br0 itself? It's missing.

Quoted 11 lines

This seems unintentional to me.

Rolf

Quoted 5 lines · Stephen Hemminger

The address you change the address, it is like you changed the MAC address of a card on the network. Windows ARP cache is no longer valid and has to time out.

Yes, that is a problem.
If address does not match any of the interfaces assigned to bridge, then it won't be in the forwarding table.

But, fixing it would introduce more issues because the forwarding table entry would match any port in bridge.. Therefore for sanity, don't assign mac address to something not in the bridge.

#4 lore raw
In reply to Rolf Fokkens

In this particular situation it's not possible to do so as all interfaces are tap interfaces, with random generated MAC addresses. Changing the tap interface's MAC address results in this:

[root@home01 ~]# ifconfig tap0 hw ether BA:B7:73:58:E6:E2
SIOCSIFHWADDR: Device or resource busy [root@home01 ~]#

So that doen't work. I found a trick however: I added a dummy ethernet interface to the bridge, of which i can specify the MAC address, It works fine, but in syslog there's the following message:

   Dec 26 17:45:21 home01 kernel: [   29.316480] br0: new device dummy0
   does not support netpoll (disabling)

This means that the bridge won't use/support netpoll at all, which may mean there's an impact on performance. I'm not sure. I can imagine that a netpoll interface for a dummy interface shouldn't be hard to implement.

Attempting to summarize:

* specifying the MAC address of a bridge interface can result in confusing results
* Allowing the changing of tap interfaces' MAC addresses could be sensible
* A netpoll interface for dummy ethernet might be usefull for bridge users

Quoted 7 lines · On Mon, 20 Dec 2010 Stephen Hemminger wrote:

Yes, that is a problem.
If address does not match any of the interfaces assigned to bridge, then it won't be in the forwarding table.

But, fixing it would introduce more issues because the forwarding table entry would match any port in bridge.. Therefore for sanity, don't assign mac address to something not in the bridge.

Quoted 71 lines · Rolf Fokkens

Hi,

I think that the bridge interface no longer sees unicast messages addressed to it, after changing the MAC address. I'll explain:

I chose a different MAC address, 02:77:00:00:01:02. This MAC address is absolutely not present on another interface. The MAC address of the Windows XP client is 02:00:00:00:00:01. The bridge interface br2 now only has one interface tap0 which links to the Windows XP client.

[root@home01 ~]# brctl show

bridge name    bridge id        STP enabled    interfaces
br0        8000.002215b81084    no        eth0.3
br1        8000.002215b81084    no        eth0.4
br2        8000.027700000102    no        tap0
br3        8000.002215b81084    no        eth0.1253

The IP address of the Windows XP guest is 192.168.252.1, the IP address of the bridge interface is 192.168.252.254, which is the default gateway address of the Windows XP guest.

Now let's look at the ARP entries. First the Windows XP guest:

C:\>arp -a

Interface 192.168.252.1 --- 0x2
Internet Address Physical Address Type
192.168.252.254 02-77-00-00-01-02 dynamic

Next on the Linux host:

[root@home01 ~]# arp -n

Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.254.7            ether   00:18:f3:fd:09:7a   C                     br1
192.168.254.18           ether   00:16:e8:29:bc:e3   C                     br1
192.168.1.1              ether   00:0e:50:64:7f:74   C                     br0
192.168.254.16           ether   90:84:0d:6f:26:1c   C                     br1
192.168.1.128            ether   00:21:85:98:45:84   C                     br0
192.168.252.1                    (incomplete)                              br2
192.168.254.9            ether   18:a9:05:39:14:95   C                     br1

[root@home01 ~]#

So now we see that the Windows XP guest is aware of the new MAC address of the bridge. However the Linux host is not aware of the guest's MAC address! Time to see what's happening when we use tcpdump:

[root@home01 ~]# tcpdump -n -e -i tap0 arp
tcpdump: WARNING: tap0: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on tap0, link-type EN10MB (Ethernet), capture size 65535 bytes

20:42:23.606319 02:00:00:00:00:01 > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.168.252.254 tell 192.168.252.1, length 28 20:42:23.606359 02:77:00:00:01:02 > 02:00:00:00:00:01, ethertype ARP (0x0806), length 42: Reply 192.168.252.254 is-at 02:77:00:00:01:02, length 28

20:47:42.503536 02:77:00:00:01:02 > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.168.252.1 tell 192.168.252.254, length 28 20:47:42.504039 02:00:00:00:00:01 > 02:77:00:00:01:02, ethertype ARP (0x0806), length 42: Reply 192.168.252.1 is-at 02:00:00:00:00:01, length 28 20:47:43.505541 02:77:00:00:01:02 > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.168.252.1 tell 192.168.252.254, length 28 20:47:43.506316 02:00:00:00:00:01 > 02:77:00:00:01:02, ethertype ARP (0x0806), length 42: Reply 192.168.252.1 is-at 02:00:00:00:00:01, length 28 20:47:44.507539 02:77:00:00:01:02 > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.168.252.1 tell 192.168.252.254, length 28 20:47:44.508319 02:00:00:00:00:01 > 02:77:00:00:01:02, ethertype ARP (0x0806), length 42: Reply 192.168.252.1 is-at 02:00:00:00:00:01, length 28

First we see an ARP request from the Windows XP guest to find the host's 192.168.252.254. There is a fast ARP response, so this is consistent with the ARP table on the Windows XP guest.

Next we see an ARP request from the Linux host to find the guest's 192.168.252.1. This is followed by a fast ARP response. Despite the response both the request and the response are repeated 3 times. This is consistent with the fact that the ARP table on the Linux host is missing the guest's MAC address.

So, apparently both interfaces (br2 and tap0) see the ethernet broadcast, but only the guest's interface (tap0) sees the unicast. This is confirmed by brctl's output:

[root@home01 ~]# brctl showmacs br2

port no mac addr           is local? ageing timer
  1     02:00:00:00:00:01  no        5.38
  1     82:7a:bf:ee:e8:5e  yes       0.00

[root@home01 ~]#

We see two interresting MAC addresses. the first one is the MAC address of the Windows XP guest, which indeed is not local. The second one is the MAC address of the tap0 interface on the host side, which apparently is local. But where's the mac address of br0 itself? It's missing.

This seems unintentional to me.

Rolf

#5 lore raw
Quoted 12 lines · On Sun, 26 Dec 2010 18:21:58 +0100 Rolf Fokkens <[email protected]> wrote:

In this particular situation it's not possible to do so as all interfaces are tap interfaces, with random generated MAC addresses. Changing the tap interface's MAC address results in this:

    [root@home01 ~]# ifconfig tap0 hw ether BA:B7:73:58:E6:E2
    SIOCSIFHWADDR: Device or resource busy
    [root@home01 ~]#

So that doen't work. I found a trick however: I added a dummy ethernet interface to the bridge, of which i can specify the MAC address, It works fine, but in syslog there's the following message:

Quoted 7 lines
    Dec 26 17:45:21 home01 kernel: [   29.316480] br0: new device dummy0
    does not support netpoll (disabling)

This means that the bridge won't use/support netpoll at all, which may mean there's an impact on performance. I'm not sure. I can imagine that a netpoll interface for a dummy interface shouldn't be hard to implement.

The message means you can't use kdump/netconsole/kgdb over that bridge device.