How to know the mac adress location of ethernet port in the router?

i want to port openwrt to alcatel hh41v, there is a current hh40v image which i have successfully installed on hh41v but the eth0 (lan2/wan) port is not working
so ithnk the problem may be in the mac adress?
i'm trying to find the mac adress location of eth port

i read that it is stored in the u-boot partition

root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00100000 00010000 "oem"
mtd3: 00ea0000 00010000 "firmware"
mtd4: 00280000 00010000 "kernel"
mtd5: 00c20000 00010000 "rootfs"
mtd6: 00850000 00010000 "rootfs_data"
mtd7: 00010000 00010000 "art"

i try to show the u-boot content and manually search for the mac adress shown in the router interface
root@OpenWrt:~# cat /dev/mtd0 |hexdump

i get a full list of numbers like these:

0000000 1000 00ff 0000 0000 1000 00fd 0000 0000
0000010 1000 0175 0000 0000 1000 0173 0000 0000
0000020 1000 0171 0000 0000 1000 016f 0000 0000

i could not find something similare to the mac adress:
88:9E:33:F0:DE:CF

and in the file of hh40v:


				nvmem-layout {
					compatible = "fixed-layout";
					#address-cells = <1>;
					#size-cells = <1>;

					cal_art_1000: cal@1000 {
						reg = <0x1000 0x440>;
					};

					macaddr_art_0: macaddr@0 {
						reg = <0x0 0x6>;
					};

					macaddr_art_6: macaddr@6 {
						reg = <0x6 0x6>;
					};
				};

does this means that the mac adress is stored in: <0x6 0x6>? what is this number and how to verify the mac adress in that location?

i could not find a detailed guide on how to do this?
i hope that you can help.

mtd0 is the one least likely to have it stored.

2 Likes

so where to find it?

Derived from your nvmem layout I would guess that the ART partition is the correct one, likely /dev/mtd7 on the HH41V stores calibration and MAC data.
If so, dump the first 12 bytes, which include both MACs, and format them for readability, e.g.:

dd if=/dev/mtd7 bs=1 skip=0 count=12 2>/dev/null | hexdump -e '6/1 "%02X:" "\n"'

...of course, completely untested ... :wink:

2 Likes

thank you, it is working well. and i find that the adress showmn in luci are the same in that partition.
so the problem of the port not worknig may be due to other thing?


&eth0 {
	status = "okay";

	nvmem-cells = <&macaddr_art_0>;
	nvmem-cell-names = "mac-address";

	phy-handle = <&swphy4>;
};

&eth1 {
	compatible = "qca,qca9530-eth", "syscon", "simple-mfd";

	nvmem-cells = <&macaddr_art_6>;
	nvmem-cell-names = "mac-address";
};

the problem is in the eth0 (lan2/wan) port.
why there is: status = okay? while it does not exist in the second port?
and why the second has compatible qca and the other doesn't have?

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.