Bridged LAN as default

Hi all

I got a beginner question in which I hope you can help to clarify.
I've just flashed my wireless router WR841N. Below is the fresh unmodified
/etc/config/network configuration file. In the third verse config interface 'lan', can someone
explain why this interface is configured as a bridge by default, with only one slave interface eth0.1 as member?

Thank you in advance for your time and help sharing knowledge.

config interface 'loopback' 
        option ifname 'lo' 
        option proto 'static'
        option ipaddr '127.0.0.1' 
        option netmask '255.0.0.0' 
  
config globals 'globals' 
        option ula_prefix 'fde3:d6d8:eb9e::/48'   

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

config device 'lan_eth0_1_dev' 
        option name 'eth0.1' 
        option macaddr 'c4:71:00:00:b9:ea'   

config interface 'wan' 
        option ifname 'eth0.2' 
        option proto 'dhcp' 

  config device 'wan_eth0_2_dev' 
        option name 'eth0.2' 
        option macaddr 'c4:71:00:00:b9:eb' 

  config interface 'wan6' 
        option ifname 'eth0.2' 
        option proto 'dhcpv6'   

config switch 
        option name 'switch0' 
        option reset '1' 
        option enable_vlan '1'   

config switch_vlan 
        option device 'switch0' 
        option vlan '1' 
        option ports '1 2 3 4 6t'   

config switch_vlan 
        option device 'switch0' 
        option vlan '2' 
        option ports '0 6t'

A wifi AP is also usually bridged in. Since wifi interfaces are created at runtime with dynamic names, wifi interfaces are attached to a network with option network in their configuration in /etc/config/wireless. In other words do not refer to wifi interfaces in /etc/config/network because the naming may not be consistent.

brctl show shows the kernel bridges that have been set up and their members.

2 Likes

The output of brctl show is as shown below, which is consistent with the configuration in /etc/config/network. What I don't really understand is, what is the purpose of creating a bridge with only one member interface?

root@OpenWrt:~# brctl show
bridge name bridge id STP enabled interfaces
br-lan 7fff.c4715448b9ea no eth0.1
root@OpenWrt:~#

Yes you could set that up as a single interface if that's all you ever need.

By default it is a bridge so it is easy to add to it such as when the wifi is turned on. Bridges consume little CPU or memory resources.

1 Like

Thanks for your replies mk24.
So in a openwrt wireless router, the wireless interface is dynamically bridged with the LAN,
is that what actually happens behind the scene? Because you can't really see how the communication between wlan0, LAN and WAN is handled internally, by studying the configuration files. I just want to have a deeper understanding of how things works. Hope you and the experts in here can help me out.

Regards

Em

@mk24 already noted this to you:

It is bridged; but I don't know why you're referring to this scenario as a "dynamic bridge". This is the default LAN config made by the developers for across-device uniformity of OpenWrt. If this was not done, users would have to add/configure switch ports and WiFi cards; as well as enumerate a LAN bridge themselves (likely breaking their connectivity in the process). This is confusing even for some seasoned OpenWrt power users. The OpenWrt developers conveniently set this [usually necessary] LAN bridge up by default.

It works like any other router. The Linux kernel has its IPv4 and IPv6 routing enabled, so the kernel is the Network Operating System (NOS) itself. So, the kernel is the "routing plane"; and everything else is handled via routing rules and the iptables firewall. Simple.

What help do you need?

Thanks for taking your time to explain. I am just trying to get a deeper understanding of how things work, and by answering my questions, you are actually helping me to be less confused ;-). I really appreciate that.

1 Like