Mapping Lan traffic to specific WAN

The gateway is set dynamically via DHCP. Even if you retrieve it, it may change after the next pppoe negotiation.

So don't disable the gateways, set metric 10 for wan1 and make both pppoe interfaces active.

By default the lan clients will use wan, because it will have higher priority.
To make them use wan1, for testing purposes create these rules manually:

ip rule add from 192.168.1.0/24 table 100 prio 1
ip route add default dev pppoe-WAN1 table 100

Pay attention to the interface name - lowercase or uppercase as defined in /etc/config/network.

The uci syntax should look like this, but I can't test it with this old version:

uci add network rule
uci set network.@rule[-1].src='192.168.1.0/24'
uci set network.@rule[-1].lookup='100'

uci add network route
uci set network.@route[-1].target='0.0.0.0'
uci set network.@route[-1].netmask='0.0.0.0'
uci set network.@route[-1].interface='WAN1'
uci set network.@route[-1].table='100'
uci commit network
/etc/init.d/network restart

EDIT:
Here is a link with a good explanation:

https://lartc.org/howto/lartc.rpdb.html

3 Likes