Where is my switch? and what are lan1 and lan2?

I use 21.02.0-rc2, and saw some strange thing in my config.

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'lan1'
        list ports 'lan2'

more strange thing is, I got this

root@OpenWrt:/etc/config# brctl show
bridge name     bridge id               STP enabled     interfaces
br-lan          7fff.40313c1d08f7       no              lan2
                                                        wlan1
                                                        lan1

I don't see wlan1 in /etc/config/network, where does this guy come from? ( and I have 2.4g and 5g wifi, why there is no wlan2 or something)
and where does lan1 and lan2 come from?
where is my switch tab under network?

This may help -

Thank you. Very helpful article. But I still don't know where do my wifi interface go? In 19.07, I remembered I have wlan1 and wlan2, but now I can't find wlan2, and I also don't know when wlan1 is bridged to br-lan. I haven't found any clue on Luci.

wireless physical interface device names can change across releases...

what is commonly the case... is that a 'network' name is listed in /etc/config/wireless for which network wireless will be connected to... (by default br-lan)...

It seems, I do have two wireless device

root@OpenWrt:~# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default 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 fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 40:31:3c:1d:08:f7 brd ff:ff:ff:ff:ff:ff
3: lan2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP mode DEFAULT group default qlen 1000
    link/ether 40:31:3c:1d:08:f7 brd ff:ff:ff:ff:ff:ff
4: lan1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP mode DEFAULT group default qlen 1000
    link/ether 40:31:3c:1d:08:f7 brd ff:ff:ff:ff:ff:ff
5: wan@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 40:31:3c:1d:08:f8 brd ff:ff:ff:ff:ff:ff
8: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 40:31:3c:1d:08:f7 brd ff:ff:ff:ff:ff:ff
9: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
    link/ether 40:31:3c:1d:08:f9 brd ff:ff:ff:ff:ff:ff
10: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP mode DEFAULT group default qlen 1000
    link/ether 40:31:3c:1d:08:fa brd ff:ff:ff:ff:ff:ff
11: pppoe-wan: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 3
    link/ppp

But only wlan1 is bridged to br-lan

root@OpenWrt:~# brctl show
bridge name     bridge id               STP enabled     interfaces
br-lan          7fff.40313c1d08f7       no              lan2
                                                        wlan1
                                                        lan1

The name of network is actually lan

config wifi-device 'radio0'
        option type 'mac80211'
        option hwmode '11g'
        option path '1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0'
        option htmode 'HT20'
        option cell_density '0'
        option channel '13'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'xxx'
        option encryption 'psk2'
        option key 'xxx'

config wifi-device 'radio1'
        option type 'mac80211'
        option channel '36'
        option hwmode '11a'
        option path '1e140000.pcie/pci0000:00/0000:00:01.0/0000:02:00.0'
        option htmode 'VHT80'
        option cell_density '0'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 'xxx-5g'
        option encryption 'psk2'
        option key 'xxx'

Still don't know how wlan1 joins br-lan.

1 Like

From /etc/config/wireless

If you have it enabled in /etc/config/wireless but there is no wlan0 interface up, it seems netfid or hostapd failed to bring it up. Check your systemlog (logread command).

As you are using channel 13, maybe you need to specify country in the 'radio0' config?

I don't get it. I mean there is no keyword like wlan0 or wlan1. How can you relate them together?

country????

Wireless devices in your router can be identified by PHY, device path, interface name. There doesn't need to be wlan0 / wlan1 name.

wlan0 is DOWN due to improper configuration of specifying channel 13, which is not allowed in most countries. Always set the radio country to your country to have the maximum performance that is legal where you live. If country is not set, it will only do a restricted set of channels and powers that are legal in every country.

If you set the country code (option country in the wifi-device section, on dual band set it on both devices) to a country where channel 13 is allowed, the 2.4 should come up and join the lan bridge. If channel 13 is not allowed in your country, change the channel to one that is.

1 Like

Oh god. I had no idea about that. Thank you.

I don't get what this mean. I just created another 2.4g wireless lan, and I get:

lrwxrwxrwx    1 root     root             0 Jun  6 06:06 br-lan -> ../../devices/virtual/net/br-lan
lrwxrwxrwx    1 root     root             0 Jan  1  1970 eth0 -> ../../devices/platform/1e100000.ethernet/net/eth0
lrwxrwxrwx    1 root     root             0 Jan  1  1970 lan1 -> ../../devices/platform/1e100000.ethernet/mdio_bus/mdio-bus/mdio-bus:1f/net/lan1
lrwxrwxrwx    1 root     root             0 Jan  1  1970 lan2 -> ../../devices/platform/1e100000.ethernet/mdio_bus/mdio-bus/mdio-bus:1f/net/lan2
lrwxrwxrwx    1 root     root             0 Jan  1  1970 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx    1 root     root             0 Jun  6 06:06 pppoe-wan -> ../../devices/virtual/net/pppoe-wan
lrwxrwxrwx    1 root     root             0 Jan  1  1970 wan -> ../../devices/platform/1e100000.ethernet/mdio_bus/mdio-bus/mdio-bus:1f/net/wan
lrwxrwxrwx    1 root     root             0 Jun  6 06:14 wlan0 -> ../../devices/platform/1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/net/wlan0
lrwxrwxrwx    1 root     root             0 Jun  6 06:14 wlan0-1 -> ../../devices/platform/1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/net/wlan0-1
lrwxrwxrwx    1 root     root             0 Jun  6 06:06 wlan1 -> ../../devices/platform/1e140000.pcie/pci0000:00/0000:00:01.0/0000:02:00.0/net/wlan1

I have no idea how these names work. Why is it called wlan0-1? why not wlan3... Can I specify the name manually?

Name it what you like

config wifi-iface 'iot_radio1'
	option device 'radio1'
	option network 'iot'
	option ifname 'wiot1'
	option mode 'ap'

To configure any device OpenWrt needs to identify it somehow so it can reference it. The most accurate way is physical device bus path. Example:

config wifi-device  radio0
	option type     'mac80211'
	option channel  '6'
	option hwmode   '11g'
	option path     '18000000.axi/bcma0:7/pci0000:00/0000:00:00.0/0000:01:00.0'
	option htmode   'HT20'
	option disabled '0'

Above you can see path. That lets OpenWrt configure my 2.4 GHz wireless physical device no matter if Linux kernel assigns it a name wlan0 or wlan1 or whatever (or PHY 0 or 1 or whatever).

So you don't need to see wlan0 in /etc/config/wireless in order for OpenWrt to configure your physical wireless device.

PHY id is assigned by Linux kernel based on order of devices probing. Default interface uses wlan<PHY_ID> name (e.g. wlan0 for PHY ID 0).
OpenWrt tries to recreate interfaces and AFAIR by default it uses:

  • wlan<PHY_ID> syntax for the first interface
  • wlan<PHY_ID>-<INTERFACE_ID> syntax for extra interfaces

Really: those are just names you just probably shouldn't care about them too much.

1 Like

Thanks so much. I finally got how to relate these names to the configuration.

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.