Aramil
2
yeah you are right, something like this :
# create routing tables
echo "100 wan1" >> /etc/iproute2/rt_tables
echo "101 wan2" >> /etc/iproute2/rt_tables
# blueprints for gateways
ip route add default via 192.0.2.1 dev eth1 table wan1
ip route add default via 192.0.2.9 dev usb0 table wan2
# netfilter marking (OpenWrt nft syntax)
nft add table inet mangle
nft 'add chain inet mangle prerouting { type filter hook prerouting priority mangle; }'
nft 'add chain inet mangle output { type filter hook output priority mangle; }'
# mark incoming on WAN1
nft 'add rule inet mangle prerouting iif "eth1" connmark set 1'
nft 'add rule inet mangle prerouting iif "eth1" mark set 1'
# apply policy routing based on mark
ip rule add fwmark 1 table wan1