Single CPU port vs two ports Archer C7

I'm building a firmware to Archer C7 V5 and noticed it has only one CPU port. My old hardware is Archer C7 V2 came with two CPU ports. I have some doubts regarding MAC address definition and VLAN settings.

This is Archer C7 V2

# ls -l /sys/class/net
lrwxrwxrwx    1 root     root             0 May  8 16:37 br-lan -> ../../devices/virtual/net/br-lan
lrwxrwxrwx    1 root     root             0 Dec 31  1969 eth0 -> ../../devices/platform/ag71xx.0/net/eth0
lrwxrwxrwx    1 root     root             0 Dec 31  1969 eth1 -> ../../devices/platform/ag71xx.1/net/eth1

This is Archer C7 V5

# ls -l /sys/class/net
lrwxrwxrwx    1 root     root             0 Jun 27 12:20 br-lan -> ../../devices/virtual/net/br-lan
lrwxrwxrwx    1 root     root             0 Jan  1  1970 eth0 -> ../../devices/platform/ag71xx.0/net/eth0
lrwxrwxrwx    1 root     root             0 Jun 27 12:20 eth0.1 -> ../../devices/virtual/net/eth0.1
lrwxrwxrwx    1 root     root             0 Jun 27 12:20 eth0.2 -> ../../devices/virtual/net/eth0.2

In V5 one of the MAC address is definided by the UCI system:

/etc/config/network

config device 'wan_dev'
        option name 'eth0.2'
        option macaddr '98:da:c4:30:a6:94'

If I remove this lines both eth0.1 and eth0.2 will assume the same MAC 98:da:c4:30:a6:93. How does Openwrt define the wan_dev MAC address. Does it extract this value from somewhere or is it just CPU MAC + 1. At what point is it defined?

Regarding the VLAN configuration I have the following in V5:

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '2 3 4 5 0t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '1 0t'

What is the 0t in this configuration?

This is the CPU.

The latter, to avoid MAC address conflicts.

2 Likes
openwrt/target/linux/ath79/base-files/etc/board.d/02_network
        tplink,archer-a7-v5|\
        tplink,archer-c7-v4|\
        tplink,archer-c7-v5|\
        tplink,tl-wr1043nd-v4|\
        tplink,tl-wr1043n-v5)
                base_mac=$(mtd_get_mac_binary info 0x8)
                wan_mac=$(macaddr_add "$base_mac" 1)
                ;;
3 Likes

Thanks Trendy!

1 Like

You can have different MACs on different VLANs on the same CPU eth port. By default they inherit the same MAC unless you explicitly change it.

1 Like

Hi Jeff, thanks for taking the time to show me how it's done! I'm assuming this is applied when the image is flashed.

That kind of code is executed at boot, either configuring the device(s) directly, or writing the config-related files to the overlay.

If I remove the lines

config device 'wan_dev'
        option name 'eth0.2'
        option macaddr '98:da:c4:30:a6:94'

they're not rewriten at boot, just confirmed it.

1 Like

Config files are generally only rewritten if they don't exist at all.

2 Likes

I see. Thanks a lot!