2. Multiple bridged networks
OpenWrt can set up its switch to group multiple ports together into different bridge interfaces so their traffic remains separate, even though devices are plugged into the same router. For example, it might be useful to set aside certain ports for “home use” and others for “office use”.
You need only create two bridge devices: one for home and one for office, and assign different ports to each. You then create separate interfaces, and assign different IP address ranges (“subnets”) to each of those bridge devices. For example, home devices might have addresses from the range 192.168.1.1 to 192.168.1.254, while the office devices will be 192.168.13.1 to 192.168.13.254. Devices plugged into the home ports will be able to communicate with each other, and the devices in the office ports can also talk together. But the “home” ports will not be able to communicate with “office” ports unless there is a routing or firewall rule to allow it.
Configuring the LuCI web interface for multiple bridged networks: The LuCI interface created two separate bridge devices - br-home with the first two lan ports, and office with the next two ports. Next, two interfaces are created:
- HOME, that uses the br-home bridge device, and assigns the address range 192.168.1.1 to 192.168.1.254
- OFFICE, that uses the office bridge device, and assigns the address range 192.168.13.1 to 192.168.13.254
Configuration file for multiple bridged LANs:
Here's the same example in /etc/config/network.
The first half of the file below shows how each config device section groups two physical ports into a bridge device
named br-home and two more ports into office.
The ''config interface 'home' '' section defines an interface that incorporates the br-home device, and sets its IP protocol type, address, etc.
Similarly, the ''config interface 'office' '' section incorporates the office device, and sets its configuration.
# ... in /etc/config/network config device option name 'br-home' option type 'bridge' list ports 'lan1' list ports 'lan2' config device option name 'office' option type 'bridge' list ports 'lan3' list ports 'lan4' config interface 'home' option device 'br-home' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' config interface 'office' option device 'office' option proto 'static' option ipaddr '192.168.13.1' option netmask '255.255.255.0'

