Bridge option : still valid?

Continuing the discussion from Connecting ethernet port to different interface on R7800:

Looking further into what @pavelgl said (thanks again for your help!), I am surprised by that. The documentation still indicates this option:

If set to bridge, creates a bridge containing the given ifname and wireless interfaces assigned using the network option in wireless configuration

Is the documentation too outdated ? Or is this option still valid in certain cases?

1 Like

I guess I have to take my words back.

The combination of option type 'bridge' and option ifname 'eth.X' seems to still work (at least the bridge is being created) with versions 21.02 and 22.03.

This statement is only valid if option device is (wrongly) used instead of option ifname.
Sorry for misleading you.

1 Like

@pavelgl - please correct me if I'm wrong about any of this...

@pavelgl - So is it still considered valid to use ifname? I thought the new syntax used ports like this:

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

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

One thing that I think should also be clarified is that the old syntax used to allow the bridge to be defined inside the network interface stanza... this is no longer valid as bridges must now be created as a device:

# this is an INVALID configuration because of the use of the bridge inside the interface stana

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

# This is also INVALID due to the ifname in this stanza here (with or without the bridge in the stanza):

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

Within a config interface, option ifname and option type bridge are both deprecated and should not be used in version 22 or beyond.

The netifd scripts still parse the old syntax for compatibility reasons but it could be dropped at any time.

5 Likes

Valid or not, it still works in versions 21.02.5 and 22.03.3.
I just had to correct my adamant opinion that this would never work because it simply isn't true.

1 Like

No problem, thanks for clarifying!

1 Like

So, to make sure I have this right.

If the current configuration looks like this:

config interface 'net4'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.4.1'
        option netmask '255.255.255.0'

I should modify it to look like this, to be future proof :

config interface 'net4'
        option type 'br-net4'
        option proto 'static'
        option ipaddr '192.168.4.1'
        option netmask '255.255.255.0'

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

Is that correct?

Also, I would like to make sure that I understand precisely what a bridge is, in this context.
Is the bridge here what allows me to combine a physical ethernet port to a wifi network, and treat it as 1 logical network ?

If that is correct, then say I have a network interface that is only used for wifi, not ethernet, should I configure it this way:

config interface 'net_wifi_only'
        option proto 'static'
        option ipaddr '192.168.5.1'
        option netmask '255.255.255.0'

?

And if I have a network interface that only has an ethernet port, and no wifi, should I configure it in the following way:

config interface 'net_ethernet_only'
        option device 'net_ethernet_only_device'
        option proto 'static'
        option ipaddr '192.168.6.1'
        option netmask '255.255.255.0'

config device
        option name 'net_ethernet_only_device'  
        list ports 'eth1.5'  

There really isn’t a way to truly future proof. The best action is to use the correct syntax for the current version. Wherever possible, there will be a migration path in subsequent versions of OpenWrt. (Usually just one major version at a time).

A bridge is the same idea as a switch, but in software rather than hardware. It allows you to connect multiple physical interfaces to a network - for example, WiFi + Ethernet or multiple WiFi radios. Without the bridge, you can only associate a single physical interface.

Your bridge names in the example are a bit unusual, but they will work.

1 Like

ipq806x is still pending its migration from swconfig to dsa, which should happen at some point in the future (it's already fully functional, but can't quite meet swconfig's performance figures, which is the only reason for this having been held back so far, at some point a decision will have to be made about this), which precludes any form of migration or forward compatibility.

1 Like