2 WAN access by 1 eth cable

Hi,

my ISP give me 2 internet access, 1 pppoe with static IP and 1 dhcp natted.
Just now I use it by cabling 2 separate routers with 1 simple switch to provide the WAN ports of routers.
Now I would like to use only 1 router with mwan3.
To configure a second WAN port instead one LAN I have no problem, but how to configure 3 LANs ports as a pure switch? I would attach physically the WANs ports to a LANs ports configured as simple switch of the same router. Can someone post a network file as sample? Thank you

I have a similar situation except both are pppoe. There is information about using vlans to configure a single port of the lan switch as a wan port on the mwan3 doc page.
I actually used the second method there, veths with kmod-macvlan on the wan port of my router, you could then plug the ISP cable direct into this port and don't have to repurpose a lan port. Unfortunately I don't currently have access to my router to get the network file but there is an example config on the doc page.

2 Likes

@Shloimy is correct that you shouldn't actually need to use the switch/lan ports to 'break out' the 2 WANs, but you will need mwan3 in order to use them.

Let's see some config information and we can hopefully get the hardware to do what you need (then you can install mwan3):

Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/network
1 Like

Thank you @Shloimy and @psherman for reply.

I installed mwan3 and kmod-macvlan but something goes wrong. I think must to operate on VLANs but I don't know how.
To connect pppoe I don't need specific MAC, but dhcp need a specific MAC (clone). I noted that both WANs brings the same MAC despite option macaddr selected.
I need interface WAN as default gateway and interface WANstatic only for incoming connections. Please take a look to files, thank you very much

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 'xxxxx:xxxxx:xxxx::/x8'

config interface 'wan'
	option device 'eth0.1'
	option macaddr 'xx:xx:xx:xx:xx:80'
	option proto 'dhcp'
	option metric '2'

config interface 'WANstatic'
	option proto 'pppoe'
	option device 'eth0.1'
	option macaddr 'xx:xx:xx:xx:xx:FF'
	option username '12345678'
	option password 'abcdefgh'
	option ipv6 'auto'
	option metric '3'

config interface 'wan6'
	option device 'eth0.1'
	option proto 'dhcpv6'
	option auto '0'
	option reqaddress 'try'
	option reqprefix 'auto'

config device:
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0.2'

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

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

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

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

config interface 'tun0'
	option proto 'none'
	option auto '0'
	option device 'tun0'

config device
	option name 'tun1'
	option mtu '1500'
	option txqueuelen '500'
	option mtu6 '1500'

config interface 'tun1'
	option proto 'dhcp'
	option device 'tun1'

config interface 'ZT'
	option device 'xxxxxxxxxxx'
	option proto 'none'

mwan3

config globals 'globals'
	option mmx_mask '0x3F00'

config interface 'wan'
	option enabled '1'
	option reliability '1'
	option count '1'
	option timeout '2'
	option interval '5'
	option down '5'
	option up '10'
	option initial_state 'online'
	option family 'ipv4'
	list track_ip '208.67.222.222'
	list track_ip '208.67.220.220'
	list track_ip '8.8.4.4'
	list track_ip '8.8.8.8'
	option track_method 'ping'
	option size '56'
	option max_ttl '60'
	option failure_interval '5'
	option recovery_interval '5'

config interface 'WANstatic'
	option enabled '1'
	option reliability '1'
	option count '1'
	option timeout '2'
	option interval '5'
	option down '3'
	option up '8'
	option initial_state 'online'
	option family 'ipv4'
	list track_ip '208.67.222.222'
	list track_ip '208.67.220.220'
	list track_ip '8.8.4.4'
	list track_ip '8.8.8.8'
	option track_method 'ping'
	option size '56'
	option max_ttl '60'
	option failure_interval '5'
	option recovery_interval '5'

config policy 'wan_WANstatic'
	list use_member 'wan_m1_w1'
	list use_member 'WANstatic_m2_w2'
	option last_resort 'unreachable'

config member 'wan_m1_w1'
	option interface 'wan'
	option metric '1'
	option weight '1'

config member 'WANstatic_m2_w2'
	option interface 'WANstatic'
	option metric '2'
	option weight '2'

config rule 'default'
	option proto 'all'
	option sticky '0'
	option use_policy 'wan_WANstatic'
	option dest_ip '0.0.0.0/0'
	

EDIT
I delete the 'option macaddr 'xx:xx:xx:xx:xx:FF' on interface 'WANstatic' and now is OK! :slight_smile:

Thank you

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