wiki:Bridge

Version 2 (modified by krit, 22 months ago) (diff)

--

Bridge WAN LAN

On GLiNet X300B has 2 RJ-45 port one for LAN the other for WAN. We want to use both RJ-45 as LAN port. We edit /etc/config/network.
WAN port was on eth1 so we just add eth1 to br-lan.

root@OpenWrt:~# brctl addif br-lan eth1 
root@OpenWrt:~# brctl show
bridge name     bridge id               STP enabled     interfaces
br-lan          7fff.9483c41c5c43       no              wlan0
                                                        eth1
                                                        eth0.1

To make it permanent bridge, use following config.

root@OpenWrt:~# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd5f:8996:7c19::/48'

config interface 'wan'
        option device 'eth1'
        option proto 'dhcp'

config interface 'wan6'
        option device 'eth1'
        option proto 'dhcpv6'

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

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'
        option gateway '192.168.1.2'
        list dns '8.8.8.8'

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

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '4 0t'

config interface 'LTE4G'
        option proto 'qmi'
        option device '/dev/cdc-wdm0'
        option auth 'none'
        option apn 'internet'
        option pdptype 'ipv4'