OpenWrt Forum Archive

Topic: Knowing which Ethernet device a switch corresponds to

The content of this topic has been archived on 21 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

For an OpenWrt package I am working on, I need to know the following things:

1) How many Ethernet switches are in the router
2) To which Ethernet interface they are attached to

Right now, I am using the output of "swconfig list" to know how many switches I have. For instance:

root@OpenWrt:~# swconfig list
Found: switch0 - eth0

However, sometimes swconfig does not give me the information as I would like. On a lantiq-based ARV7518PW:

root@OpenWrt:~# swconfig list
Found: switch0 - 1e180000.etop-ff

On a MT7620-based router:

root@OpenWrt:/# swconfig list
Found: switch0 - mt7620

Therefore, if I have more than one Ethernet devices in the router, how can I know for sure that "switch0" corresponds to "eth0" and not to another one (i.e. "eth1")?

Thank you very much for your help.

Furthermore, on a Lamobo BPi-R1:

root@qMp-1108:~# swconfig list
Found: switch0 - eth0
Found: switch1 - eth0

yikes

The discussion might have continued from here.