Vlan, bridge or multiwan issues

Hello, I'm running openwrt21.02 on MT7621.

In the default configuration, the device has a wan port and a br-lan(lan1, lan2, lan3, lan4).

  1. Here is what I want to do:

1.1. br-lan(lan2, lan3, lan4) and wan act as a general router.
1.1.1 wan port use dhcp protocol to get an ip address from RouterA.
1.1.2 Terminals(like pc) wired to br-lan will get ip address from router.
1.1.3 Data from Terminals will be sent from wan with NAT.

1.2. Bridge lan1 port with wan.10(or wanmac0) port as br-vlan10
1.2.1 br-vlan10 has no ip address
1.2.2 Terminals(like pc) wired to lan1 should get ip address from RouterA.
1.2.3 Data from Terminals should be sent through wan.10(or wanmac0) without NAT.

  1. Following is my configuration:
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 packet_steering '1'
	option ula_prefix 'fdf6:7da6:4e63::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan2'
	list ports 'lan3'
	list ports 'lan4'

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

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

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

config device
	option type '8021q'
	option ifname 'wan'
	option vid '10'
	option name 'wan.10'

config device
	option type 'bridge'
	option name 'br-vlan10'
	list ports 'lan1'
	list ports 'wan.10'

config interface 'vlan10'
	option device 'br-vlan10'
	option proto 'none'

config bridge-vlan
	option device 'br-vlan10'
	option vlan '10'
	list ports 'lan1:u*'
	list ports 'wan.10:t*'

root@OpenWrt:~# 
  1. However, terminal connected to lan1 can't get ip address from RouterA.

Using tcpdump, I can see these:
3.1 tcpdump -i lan1 -nn --> capture ipv4 dhcp discover and ipv6 dhcp xxx from terminal
3.2 tcpdump -i br-vlan10 -nn --> capture ipv4 dhcp discover and ipv6 dhcp xxx from terminal
3.3 tcpdump -i wan.10 -nn --> no ipv4 dhcp discover, capture ipv6 dhcp xxx from terminal
3.4 On RouterA, tcpdump -i br-lan10 port 67 or port 547 -nn --> no ipv4 dhcp discover, capture ipv6 dhcp xxx from terminal

Backup your current config and try this one.

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 packet_steering '1'
	option ula_prefix 'fdf6:7da6:4e63::/48'

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

config interface 'wan'
	option device 'br-wan.10'
	option proto 'dhcp'

config interface 'wan6'
	option device 'br-wan.10'
	option proto 'dhcpv6'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan2'
	list ports 'lan3'
	list ports 'lan4'

config device
	option name 'br-wan'
	option type 'bridge'
	list ports 'lan1'
	list ports 'wan'

config bridge-vlan
    option device 'br-wan'
    option vlan '10'
    list ports 'lan1:u*'
    list ports 'wan:t'
1 Like

Thank you!
Your configuration file makes terminal connected to lan1 get a right ip address(vlan10) from RouterA.
However, it lost wan interface in vlan1.

If I add a wanb interface like this, wanb can't get address(vlan1) from RouterA.

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

The vlan id is must be different from the default one (VLAN 1), but the frames are not tagged, so it won't matter.

config interface 'wanb'
        option proto 'dhcp'
        option device 'br-wan.5'

config bridge-vlan
        option device 'br-wan'
        option vlan '5'
        list ports 'wan:u*'
1 Like