OpenWrt Forum Archive

Topic: uci bridge configuration

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

My /etc/config/network says:

config interface 'lan'
    option ifname 'eth0.2'
    option type 'bridge'
    option proto 'static'
    option ipaddr '192.168.1.1'
    option netmask '255.255.255.0'
    option ip6assign '60'

Why? Wouldn't it need to be
    option ifname 'eth0.2'wlan0'

Of course if the concept is to define things only once, then the option in /etc/config/wireless
    option network  lan

would make sure, wlan0 is bridged together with with eth0.2 to br-lan, which is called lan inside of uci.
It is just a little bit confusing.

Wlan interface names are not predictable, therfore you cannot reference them directly in the network config. For example if you work with dynamic wifi vlans or with wds station mode you have a wlan0 and a lot of wlan0.staX which need to be added and removed at runtime, you cannot write those all into /etc/config/network.

@jow: is that still the case?

This is my current bridge setup:

root@router-casa-andrea:~# brctl show
bridge name     bridge id               STP enabled     interfaces
br-guest                7fff.940c6daf6004       yes             eth0.3
                                                        wlan0-1
br-lan          7fff.940c6daf6004       yes             eth0.1
                                                        wlan0

and corresponding config:

config interface 'lan'
        option ifname 'eth0.1 wlan0'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.2.1'
        option netmask '255.255.255.0'
        option stp '1'
config interface 'guest'              
        option ifname 'eth0.3 wlan0-1'
        option type 'bridge'          
        option proto 'static'         
        option ipaddr '192.168.3.1'   
        option netmask '255.255.255.0'
        option stp '1'                

EDIT: I don't actually need a second bridge per se but I needed WDS on the second wifi interface and that, unsurprisingly, requires a bridge otherwise I get tons of errors like this: "DHCP packet received on wlan0-1.sta1 which has no address"

(Last edited by aboaboit on 17 Dec 2013, 08:08)

You're still not supposed to use wifi ifnames in /e/c/network

jow wrote:

You're still not supposed to use wifi ifnames in /e/c/network

@jow: given that in my case it works, what kind of issues do you anticipate?

Not using wifi ifnames effectively means only one bridge may have a wifi segment.

P.S.: sorry, coffee still not in bloodstream, I clicked "report" instead of "reply"... oh well ^_^

Not sure what you mean with "only one bridge may have a wifi segment". You can have as many bridges with wifi as you want.

The fact that "wlan0-1.sta1" is not automatically joined to the bridge proves exactly my point why you shouldn't put wifi ifnames into the network config. If you use "option network guest" in the wifi-iface which declares the guest ssid then wlan0-1 and all its slave interfaces are automatically put into br-guest as needed.

jow wrote:

Not sure what you mean with "only one bridge may have a wifi segment". You can have as many bridges with wifi as you want.

Here is the relevant segment from /e/c/wireless:

config wifi-iface
        option device 'radio0'
        option mode 'ap'
        option encryption 'psk-mixed'
        option key '...'
        option ssid 'Abo-casa'
        option network 'lan'
        option wmm '1'
        option wds '1'

config wifi-iface
        option device 'radio0'
        option mode 'ap'
        option encryption 'psk-mixed'
        option key ...
        option ssid 'Abo-guest'
        option network 'guest'
        option wmm '1'
        option wds '1'

Unless I add option ifname 'eth0.3 wlan0-1' to config interface 'guest' in /e/c/network, I will get loads of "DHCP from missing address" entries on the router and the remote end of the bridge (Fonera) will be unconfigured.


jow wrote:

The fact that "wlan0-1.sta1" is not automatically joined to the bridge proves exactly my point why you shouldn't put wifi ifnames into the network config. If you use "option network guest" in the wifi-iface which declares the guest ssid then wlan0-1 and all its slave interfaces are automatically put into br-guest as needed.

Ok, now I think I understand your remark. Thing is, I'd like to have:
-physical port 1,2,3 and wifi "Abo-casa" SSID in "lan"
-physical port 4 and wifi "Abo-guest" SSID in "guest"
-both "lan" and "guest" masqueraded to "wan" but no routing or bridging at all between them

Is this possible in a clean way?
EDIT: at the moment, it *is* working, even if the config is wrong.
EDITv2: both "lan" and "guest" should support WDS and, again, at present it works.

(Last edited by aboaboit on 17 Dec 2013, 15:57)

netifd will ignore any wlan* device in /etc/config/network anyway. So whether you add it there or not should make no difference at all.

Jow, thanks for the help: you are, of course, absolutely right.
Perhaps my mistake was not adding the "network" option in /e/c/wireless from the beginning.
I'm a happy camper now smile

The discussion might have continued from here.