Thursday, June 11, 2020

Net Devs: Is there any benefit/positives to re-using MAC addresses across interfaces?

Layer 2 MAC addresses are sometimes re-used across network interfaces. The most common case for this is likely VLAN interfaces, where each VLAN interface assumes the MAC address belonging to the physical interface to which it is bound, but there are a surprising number of IoT and small networking device types which re-use MAC addresses across their ethernet and 802.11/wifi interfaces.

Ethernet VLAN-type layer 3 interfaces are logical interfaces, and thus the MAC address must be generated somehow. The easiest/laziest solution to this problem is to simply re-use the MAC address already assigned to the physical port. The only reason this works is that each VLAN interface is of course in a unique layer 2 network.

This is what Cisco and most other switch vendors do on their platforms. On some older platforms it isn't even possible to assign another MAC address to a VLAN interface in configuration.

The linux kernel inherits this behavior too. A newly created eth0.1 and eth0.2 interface will have the same MAC address as interface eth0. This sounds okay... at first.

Here I have in front of me today a small travel router type device which is supported by OpenWRT. It has two physical RJ45 jacks and an 802.11n radio. And all three network interfaces use the same MAC address. This is because the mt76 SoC actually has a single ethernet interface internally, and then it also has a manageable VLAN-aware ethernet switch. The interfaces are named eth0.1 (LAN) and eth0.2 (WAN). The WLAN/802.11 interface also uses the same MAC address, just because why the fuck not.

For most people this works fine, but let's say I want to use my little device here to connect two of it's interfaces to the same layer 2 network. There's a variety of reasons we might want to do this, including bridging, or redundancy, but it's not possible because all of the MAC addresses are the same.

Now let's say I was to make an argument to developers of the linux kernel, Cisco, or whomever that they should select unique MAC addresses for their VLAN interfaces. Are there any good counter-arguments, other than being lazy? Re-using MACs on 802.11 interfaces is of course pure lazy, but for VLAN interfaces it works fine most of the time.



No comments:

Post a Comment