How to config single wan with vlan?

hello everyone , I have two ISP providers , but due to physical restriction I can only use 1 Ethernet wire to connect them to my router , with some research, seems that what I need is a managed switch , and my setup should be as following:

is such setup correct ?( I've found some topic on how to configure vlan inside LAN, but didn't found too much about how to use single physical wan to work with vlan)

if my setup if correct, two ISP will be different vlan, and mixed traffic goes through the only 1 wire into my openwrt wan port, but how can I configure openwrt to create two 'logical wan interface' based on different vlan ? thanks for any advise.

BTW, I've read that vlan function can be hardware based or device driver based, my rounter is R7500v2 (IPQ806x), which type is my device ?

1 Like

I believe you can check if your device supports VLANs by using the swconfig command (https://openwrt.org/docs/techref/swconfig). But I'm betting the support is there, check LUCI -> Network -> Switch.

Once your VLANs are configured, you can target them specifically by appending the VLAN ID to the interface name (example: eth0.2 is interface eth0, VLAN ID 2). If you're configuring via Luci, the VLANs will be visible in the interface drop down menu when you create a new PPPoE interface.

In your case you'll create for example VLAN 2 and 3, assign both to the WAN port (set to tagged), and then create a PPPoE interface on both eth0.2 and eth0.3 (assuming eth0 is the WAN port in the first place).

Take note, if you create a new VLAN for WAN, make sure the appropriate CPU is tagged in that VLAN. Identifty which CPU is tagged to the WAN port, and make sure it's tagged in the second VLAN you attach to the WAN port as well.

Example from my device, CPU (eth0) is for WAN (ID 2, 3), and CPU (eth1) is for LAN (ID 1):

Granted I'm talking from memory, setup might be a bit more complicated. This page from the OpenWRT wiki might also help for the command line: https://openwrt.org/docs/guide-user/network/vlan/switch

3 Likes

nice diagram... this topology is 'the best' imho, if you could call it that...

while it is not functionally ( only the extra uci wan interface ) different from many similar use cases passing the two 'access@wanx2' connections into the switch makes things uber clear...

what helps (me) and what i'd recommend is using an alternate device(linux host->half windows hosts will do it too if you dig around) which supports interface tagging on the trunk side to the switch BEFORE you touch a single OpenWrt config setting... the test host doesn't need to route or tag/ip BOTH vlans on the trunk at the same time... so long as it's tagging... test one vlan... switch over the ip and tagNUM then test the other vlan...

this way one half of the complexity ( the switch ) is done ... make a backup...

then you can just search for guides on adding an extra wan/vlan as discussed above... although I 'see' things more clearly at a config level... on openwrt+vlan I find using the gui and looking at the config ( and backing up ) after each setup works the best...( for the majority of the initial setup elements )

2 Likes

Great thanks for the information, I've read the vlan/switch docs , If I understood correctly,my router already configure eth0 as vlan enabled (one for lan and another for wan) , and vlan needs 802.1q header in ethernet frame, so that means the vlan id must be unified across inside openwrt and the managed switch ? in your example, vlan id 2/3 goes through wan as tagged so the vlan tag inside openwrt also goes to switch, so I must also configure my managed switch to makes DSL using vlan id 2/3 to makes all things match and work ?

Thanks for the advise , using a host to test switch first is a good idea

Yep, you'll want both managed switch and router to have the same VLANs configured, and set as tagged on the port that will be transferring the data. It's also known as a trunk port if you search online.

I've read the trunk port before , but I didn't realize the vlan id must be matched across wrt and switch before read your answer. I'm thinking the switch vlan id only apply between switch and wan port, and wan lan vlan id only apply inside openwrt. your answer makes it clear ,so the unique vlan id goes through the whole topology, no matter in switch or inside openwrt.

1 Like

Yes, because traffic could be tagged (with specified tag), or untagged. Tag is common for all devices.

1 Like

finally I made it work, both PPPoE got address correctly, load balancer will be my next try.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.