openwrt / openwrt

This repository is a mirror of https://git.openwrt.org/openwrt/openwrt.git It is for reference only and is not active for check-ins. We will continue to accept Pull Requests here. They will be merged via staging trees then into openwrt.git.
Other
18.9k stars 9.99k forks source link

ZyXEL NBG6817 - eth0 and eth1 MAC addresses changes randomly #10735

Open NilsRo opened 1 year ago

NilsRo commented 1 year ago

I facing the issue with OpenWrt 21.02.3 r16554-1d4dea6d4f / LuCI openwrt-21.02 branch git-22.213.35964-87836ca, OpenWrt 22.03.0 r19685-512e76967f / LuCI openwrt-22.03 branch git-22.245.77528-487e58a and snapshot of 17.09.2022 for ZyXEL NBG6817 that the MAC addresses changes randomly for eth0 and eth1 after reboot.

My actual network configuration file is included and I opened a discussion https://forum.openwrt.org/t/zyxel-nbg6817-mac-is-set-on-virtual-devices-and-not-eth0-and-eth1/137353

Also I found a similar issue but different device and also correction, but perhaps they are linked: https://github.com/openwrt/openwrt/issues/9766#issuecomment-1248124941

I cannot see a similar behavior with my Netgear R7800 devices which have the same architecture. All MACs are stable and derived from eth0 and eth1.

opera_2022-09-17 221558

Difference to Netgear R7800

The issue seems to be caused because the MAC is not assigned to eth0 and eth1 but to the virtual devices. This leads in my configuration that the MAC is lost. According my Netgear R7800 it should be assigned to the main device.

MAC is set differently to R7800, so this command should better set the MAC to the physical interfaces instead. https://github.com/openwrt/openwrt/blob/40874f0934973fd8a1b00de16db824a5b4ec75a9/target/linux/ipq806x/base-files/etc/board.d/02_network#L85-L91

ifconfig - Clean install

You can see that the MAC is assigned to virtual devices only.

OpenWrt SNAPSHOT, r20661-e785ca05e9

=== WARNING! ===================================== There is no root password defined on this device! Use the "passwd" command to set up a new password in order to prevent unauthorized SSH logins.

root@OpenWrt:~# ifconfig br-lan Link encap:Ethernet HWaddr DELETEDBYME:97:3E:89:26 inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fd5f:272e:5e4::1/60 Scope:Global inet6 addr: fe80::6231:97ff:fe3e:8926/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:9148 errors:0 dropped:492 overruns:0 frame:0 TX packets:2194 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:923939 (902.2 KiB) TX bytes:287710 (280.9 KiB)

eth0 Link encap:Ethernet HWaddr 5E:D8:18:48:87:17 inet6 addr: fe80::5cd8:18ff:fe48:8717/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:423 errors:0 dropped:0 overruns:0 frame:0 TX packets:184 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:32994 (32.2 KiB) TX bytes:57986 (56.6 KiB) Interrupt:36

eth0.2 Link encap:Ethernet HWaddr DELETEDBYME:97:3E:89:26 inet6 addr: fe80::6231:97ff:fe3e:8927/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:423 errors:0 dropped:423 overruns:0 frame:0 TX packets:177 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:25380 (24.7 KiB) TX bytes:56452 (55.1 KiB)

eth1 Link encap:Ethernet HWaddr DA:29:3E:AC:A4:DA inet6 addr: fe80::d829:3eff:feac:a4da/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:11196 errors:0 dropped:0 overruns:0 frame:0 TX packets:2214 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1221809 (1.1 MiB) TX bytes:300462 (293.4 KiB) Interrupt:37

eth1.1 Link encap:Ethernet HWaddr DELETEDBYME:97:3E:89:26 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:11066 errors:0 dropped:16 overruns:0 frame:0 TX packets:2194 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1008183 (984.5 KiB) TX bytes:287710 (280.9 KiB)

lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:429 errors:0 dropped:0 overruns:0 frame:0 TX packets:429 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:35608 (34.7 KiB) TX bytes:35608 (34.7 KiB)

opera_2022-09-17 221558

Network Configuration

config interface 'loopback' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0' option device 'lo'

config globals 'globals' option ula_prefix 'fd11:b2f0:a80f::/48'

config interface 'lan' option proto 'static' option netmask '255.255.255.0' option ip6assign '60' option ipaddr '192.168.177.1' option device 'br-lan'

config interface 'wan' option proto 'dhcp' option broadcast '1' option delegate '0' option device 'eth0.2'

config interface 'wan6' option proto 'dhcpv6' option reqprefix 'auto' option reqaddress 'try' option device 'eth0.2' option auto '0'

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

config switch_vlan option device 'switch0' option vlan '1' option vid '1' option ports '2 3 4 6t'

config switch_vlan option device 'switch0' option vlan '2' option ports '0t 5' option vid '2'

config interface 'VPN' option device 'tap_vpn' option proto 'none'

config route option netmask '255.255.255.0' option target '192.168.178.0' option interface 'lan' option gateway '192.168.177.6'

config interface 'IoT' option proto 'static' option ipaddr '192.168.175.1' option netmask '255.255.255.0' option device 'br-iot'

config device option name 'br-lan' option type 'bridge' list ports 'eth1.1' list ports 'tap_vpn'

config switch_vlan option device 'switch0' option vlan '3' option ports '1 6t' option vid '3'

config route option interface 'lan' option target '192.168.180.0' option netmask '255.255.255.0' option gateway '192.168.177.6'

config interface 'ELLERAU' option device 'vpn_ellerau' option proto 'dhcp'

config device option type 'bridge' option name 'br-iot' list ports 'eth1.3'

config interface 'GUEST' option proto 'static' option ipaddr '192.168.176.1' option netmask '255.255.255.0' option device 'br-guest'

config device option type 'bridge' option name 'br-guest' option bridge_empty '1'

The only difference in the system log between R7800 and Zyxel is the max address reported by the driver:

Sun Sep 4 11:20:56 2022 kern.err kernel: [ 2.355794] ar8327: qca,phy-rgmii-en is not specified Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.356949] ipq806x-gmac-dwmac 37200000.ethernet: IRQ eth_wake_irq not found Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.359930] ipq806x-gmac-dwmac 37200000.ethernet: IRQ eth_lpi not found Sun Sep 4 11:20:56 2022 kern.warn kernel: [ 2.367157] ipq806x-gmac-dwmac 37200000.ethernet: PTP uses main clock Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.373914] ipq806x-gmac-dwmac 37200000.ethernet: User ID: 0x10, Synopsys ID: 0x37 Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.379989] ipq806x-gmac-dwmac 37200000.ethernet: DWMAC1000 Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.387345] ipq806x-gmac-dwmac 37200000.ethernet: DMA HW capability register supported Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.393250] ipq806x-gmac-dwmac 37200000.ethernet: RX Checksum Offload Engine supported Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.400964] ipq806x-gmac-dwmac 37200000.ethernet: COE Type 2 Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.408784] ipq806x-gmac-dwmac 37200000.ethernet: TX Checksum insertion supported Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.414677] ipq806x-gmac-dwmac 37200000.ethernet: Wake-Up On Lan supported Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.422051] ipq806x-gmac-dwmac 37200000.ethernet: Enhanced/Alternate descriptors Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.428752] ipq806x-gmac-dwmac 37200000.ethernet: Enabled extended descriptors Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.436390] ipq806x-gmac-dwmac 37200000.ethernet: Ring mode enabled Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.443418] ipq806x-gmac-dwmac 37200000.ethernet: Enable RX Mitigation via HW Watchdog Timer Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.449579] ipq806x-gmac-dwmac 37200000.ethernet: device MAC address 82:0a:a1:e6:31:53 Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.458988] ipq806x-gmac-dwmac 37400000.ethernet: IRQ eth_wake_irq not found Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.465988] ipq806x-gmac-dwmac 37400000.ethernet: IRQ ethlpi not found Sun Sep 4 11:20:56 2022 kern.warn kernel: [ 2.473386] ipq806x-gmac-dwmac 37400000.ethernet: PTP uses main clock Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.479818] ipq806x-gmac-dwmac 37400000.ethernet: User ID: 0x10, Synopsys ID: 0x37 Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.486049] ipq806x-gmac-dwmac 37400000.ethernet: DWMAC1000 Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.493605] ipq806x-gmac-dwmac 37400000.ethernet: DMA HW capability register supported Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.499326] ipq806x-gmac-dwmac 37400000.ethernet: RX Checksum Offload Engine supported Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.507131] ipq806x-gmac-dwmac 37400000.ethernet: COE Type 2 Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.515020] ipq806x-gmac-dwmac 37400000.ethernet: TX Checksum insertion supported Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.520862] ipq806x-gmac-dwmac 37400000.ethernet: Wake-Up On Lan supported Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.528144] ipq806x-gmac-dwmac 37400000.ethernet: Enhanced/Alternate descriptors Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.534982] ipq806x-gmac-dwmac 37400000.ethernet: Enabled extended descriptors Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.542543] ipq806x-gmac-dwmac 37400000.ethernet: Ring mode enabled Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.549572] ipq806x-gmac-dwmac 37400000.ethernet: Enable RX Mitigation via HW Watchdog Timer Sun Sep 4 11:20:56 2022 kern.info kernel: [ 2.555670] ipq806x-gmac-dwmac 37400000.ethernet: device MAC address 16:d5:7d:02:a6:78_

Ansuel commented 1 year ago

@NilsRo can you compile a custom image and test your implementation?

NilsRo commented 1 year ago

@NilsRo can you compile a custom image and test your implementation?

Actually I have no solution as with ucidef_set_interface_macaddr I cannot set a MAC to eth0 and eth1. I have to set this in the network configuration manually. So we need a function for ethX devices I ask in the forum for without response.