Routing/Mangle issues with multiple WG tunnels
Posted: Mon Jun 20, 2022 5:35 pm
Hi,
I was about to make some changes to my setup (using 2 providers with failover) but I saw that my setup was not working.
I have 4 tunnels (4 different countries), I do routing 2 ways:
a) I sent traffic to 3 tunnels using IP rages (based on country IP allocation) - it created about 23k address entires
b) I use local address lists to force entire traffic from certain computers to specific tunnels (I use enable/disable addresses as it makes it easier to route certain IP at times)
It was working but it stopped - I assume maybe issue with rOS?. Code below. Please assume that wireguard is set up properly.
When the computer is in local lists with this scenario, it can't even log in to MT router
I tried route list:
But it is not reliable all the time
Any advice?
I was about to make some changes to my setup (using 2 providers with failover) but I saw that my setup was not working.
I have 4 tunnels (4 different countries), I do routing 2 ways:
a) I sent traffic to 3 tunnels using IP rages (based on country IP allocation) - it created about 23k address entires
b) I use local address lists to force entire traffic from certain computers to specific tunnels (I use enable/disable addresses as it makes it easier to route certain IP at times)
It was working but it stopped - I assume maybe issue with rOS?. Code below. Please assume that wireguard is set up properly.
Code: Select all
/routing table add comment="Table for WireGuard - Poland" disabled=no fib name=wg-pl
/routing table add comment="Table for WireGuard - Germany" disabled=no fib name=wg-de
/routing table add comment="Table for WireGuard - UK" disabled=no fib name=wg-uk
/routing table add comment="Table for WireGuard - France" disabled=no fib name=wg-fr
/ip route add dst-address=0.0.0.0/0 gateway=KeepSolidVPN-UK routing-table=wg-uk
/ip route add dst-address=0.0.0.0/0 gateway=KeepSolidVPN-France routing-table=wg-fr
/ip route add dst-address=0.0.0.0/0 gateway=KeepSolidVPN-Germany routing-table=wg-de
/ip route add dst-address=0.0.0.0/0 gateway=KeepSolidVPN-Poland routing-table=wg-pl
/ip firewall nat add action=masquerade chain=srcnat out-interface=KeepSolidVPN-Poland
/ip firewall nat add action=masquerade chain=srcnat out-interface=KeepSolidVPN-Germany
/ip firewall nat add action=masquerade chain=srcnat out-interface=KeepSolidVPN-UK
/ip firewall nat add action=masquerade chain=srcnat out-interface=KeepSolidVPN-France
/ip firewall mangle add action=mark-connection chain=prerouting connection-mark=no-mark new-connection-mark=VPN-IP-PL passthrough=yes src-address-list=local-pl
/ip firewall mangle add action=mark-connection chain=prerouting connection-mark=no-mark new-connection-mark=VPN-IP-UK passthrough=yes src-address-list=local-uk
/ip firewall mangle add action=mark-connection chain=prerouting connection-mark=no-mark new-connection-mark=VPN-IP-FR passthrough=yes src-address-list=local-fr
/ip firewall mangle add action=mark-connection chain=prerouting connection-mark=no-mark new-connection-mark=VPN-IP-DE passthrough=yes src-address-list=local-de
/ip firewall mangle add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-list=IP-Poland new-connection-mark=VPN-IP-PL passthrough=yes
/ip firewall mangle add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-list=IP-Germany new-connection-mark=VPN-IP-DE passthrough=yes
/ip firewall mangle add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-list=IP-UK new-connection-mark=VPN-IP-UK passthrough=yes
/ip firewall mangle add action=mark-routing chain=prerouting connection-mark=VPN-IP-DE in-interface=LAN new-routing-mark=wg-de passthrough=no
/ip firewall mangle add action=mark-routing chain=prerouting connection-mark=VPN-IP-UK in-interface=LAN new-routing-mark=wg-uk passthrough=no
/ip firewall mangle add action=mark-routing chain=prerouting connection-mark=VPN-IP-FR in-interface=LAN new-routing-mark=wg-fr passthrough=no
/ip firewall mangle add action=mark-routing chain=prerouting connection-mark=VPN-IP-PL in-interface=LAN new-routing-mark=wg-pl passthrough=no
I tried route list:
Code: Select all
/routing rule add action=lookup disabled=no src-address=Internal-IP/32 table=wg-de
Any advice?