Making sense of physical devices

Hello everyone, I'm trying to understand how my router ports are mapped as physical devices.
I have an AP that has 2 Ethernet ports and radio. Those ports are appear as:

$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1504 qdisc mq state UP qlen 1000
    link/ether 7c:57:3c:37:99:f5 brd ff:ff:ff:ff:ff:ff
3: lan@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP qlen 1000
    link/ether 7c:57:3c:37:99:f5 brd ff:ff:ff:ff:ff:ff
4: wan@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN qlen 1000
    link/ether 7c:57:3c:37:99:f5 brd ff:ff:ff:ff:ff:ff
5: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 7c:27:3c:63:37:f7 brd ff:ff:ff:ff:ff:ff

TBH I don't understand why wan and lan are on top of eth0. Why do all have the same mac address? This is clear when you look at sys:

$ ls -l /sys/class/net/
lrwxrwxrwx    1 root     root             0 Jan  4 22:36 br-lan -> ../../devices/virtual/net/br-lan
lrwxrwxrwx    1 root     root             0 Jan  1  1970 eth0 -> ../../devices/platform/soc/15100000.ethernet/net/eth0
lrwxrwxrwx    1 root     root             0 Jan  1  1970 lan -> ../../devices/platform/soc/15100000.ethernet/mdio_bus/mdio-bus/mdio-bus:1f/net/lan
lrwxrwxrwx    1 root     root             0 Jan  1  1970 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx    1 root     root             0 Jan  1  1970 wan -> ../../devices/platform/soc/15100000.ethernet/mdio_bus/mdio-bus/mdio-bus:1f/net/wan

They clearly have some hierarchy. So far my best guess is that they are controlled by the same switch chip... does it make sense? Why do they have the same macaddr?

Since they're both obviously eth0 - I'm certain you're seeking more details.

When not bridged, they would generally be used for different networks (i.e., broadcast domain). Hence LAN and WAN are able to possess the same MAC without conflicting.

If bridging as in br-lan, you see a different MAC is used, therefore avoiding a MAC conflict.

Yes, it makes perfect sense.


https://openwrt.org/docs/guide-user/network/network_configuration#overview