Multiple WAN range Ip Routing

Hey Chaps,
I’m sure I’m just having a brain fart and missing something simple but I’ve had a small issue with some gateway routing and I’m hoping someone can help.

Basically I have three WAN ranges which I route to various Vlans through one RB using src-nat each range has its own gateway but for some reason they currently routing through one of the gateways.

I tried creating an address list which assigns a routing mark and giving the routes different routing marks but this just left me with nothing routing out! can anyone point me in the right direction?

Thanks

/interface ethernet
set [ find default-name=ether1 ] name="ether1 (Internet)"
set [ find default-name=ether2 ] name="ether2 (Tennant LAN)"

/interface vlan
add interface="ether2 (Tennant LAN)" l2mtu=1594 name="VLAN4 (Tennant 4)" vlan-id=4
add interface="ether2 (Tennant LAN)" l2mtu=1594 name="VLAN5 (Tennant 5)" vlan-id=5

/ip address
add address=94.*.*.159/26 interface="ether1 (Internet)" network=94.*.*.128
add address=83.*.*.70/26 interface="ether1 (Internet)" network=83.*.*.64
add address=192.168.4.1/24 interface="VLAN18 (Tennant 1)" network=192.168.4.0
add address=192.168.5.1/24 interface="VLAN18 (Tennant 2)" network=192.168.5.0

/ip firewall filter
add chain=forward in-interface="ether1 (Internet)" out-interface="VLAN4 (Tennant 1)"
add chain=forward in-interface="ether1 (Internet)" out-interface="VLAN5 (Tennant 2)"
add chain=forward in-interface="VLAN4 (Tennant 1)" out-interface="ether1 (Internet)"
add chain=forward in-interface="VLAN5 (Tennant 2)" out-interface="ether1 (Internet)"
   
/ip firewall nat
add action=src-nat chain=srcnat src-address=192.168.4.0/24 to-addresses=83.*.*.75
add action=src-nat chain=srcnat src-address=192.168.5.0/24 to-addresses=94.*.*.158

/ip route
add distance=1 gateway=83.*.*.65
add distance=1 gateway=94.*.*.129

Are these IPs static?

You could add a to-address with action=src-nat and a out-interface to be 150% sure it’s getting out of your router with the correct address (and hence gateway)

Cheers
-Chris

they are static yes, I’m not sure how that would work as they all go out on one interface.

Below is an example of my config:

/interface ethernet
set [ find default-name=ether1 ] name="ether1 (Internet)"
set [ find default-name=ether2 ] name="ether2 (Tennant LAN)"

/interface vlan
add interface="ether2 (Tennant LAN)" l2mtu=1594 name="VLAN4 (Tennant 4)" vlan-id=4
add interface="ether2 (Tennant LAN)" l2mtu=1594 name="VLAN5 (Tennant 5)" vlan-id=5

/ip address
add address=94.*.*.159/26 interface="ether1 (Internet)" network=94.*.*.128
add address=83.*.*.70/26 interface="ether1 (Internet)" network=83.*.*.64
add address=192.168.4.1/24 interface="VLAN18 (Tennant 1)" network=192.168.4.0
add address=192.168.5.1/24 interface="VLAN18 (Tennant 2)" network=192.168.5.0

/ip firewall filter
add chain=forward in-interface="ether1 (Internet)" out-interface="VLAN4 (Tennant 1)"
add chain=forward in-interface="ether1 (Internet)" out-interface="VLAN5 (Tennant 2)"
add chain=forward in-interface="VLAN4 (Tennant 1)" out-interface="ether1 (Internet)"
add chain=forward in-interface="VLAN5 (Tennant 2)" out-interface="ether1 (Internet)"
	
/ip firewall nat
add action=src-nat chain=srcnat src-address=192.168.4.0/24 to-addresses=83.*.*.75
add action=src-nat chain=srcnat src-address=192.168.5.0/24 to-addresses=94.*.*.158

/ip route
add distance=1 gateway=83.*.*.65
add distance=1 gateway=94.*.*.129

Ah, now I see…

Since you have two default routes with the same distance, you router will catch ANY of them.
Unfortunately, I don’t have a solution for this in my pocket.
I guess you should somehow work with routing marks or mangle to ensure that traffic originating from either subnet is routed to its corresponding gateway.
But I’m not (yet) an expert in this , sorry.

-Chris

At the weekend I spent some more thoughts on this .
The only problem is that you have two default routes with the same distance - now you’re messed with your router catching any of them.

So we need to seperate these default routes.
I’d say this would be a perfect job for a METArouter - and its setup should be quite simple as you have seperated the LAN sides perfectly with your VLANs and subnets.
Just add one of the Tennant IPs and gateways to the meta router and strip it from your “real” router.
Add a bridge to ether 1 (remember to now assign the IP address to the bridge and not to ether1) and attach the METArouter’s WAN side to that bridge.
Forward the appropriate VLAN to a LAN port of the METArouter and off you go…

Does this also make sense outside my head?

Cheers
-Chris

Thanks for the idea but I think that would just be over complicating my setup!

I have found a way to do the routing but it is a tad tedious as I need to add a mangle rule for every network and would still like it to be automated somehow!

What I’ve done is this:

/interface ethernet
set [ find default-name=ether1 ] name="ether1 (Internet)"
set [ find default-name=ether2 ] name="ether2 (Tennant LAN)"

/interface vlan
add interface="ether2 (Tennant LAN)" l2mtu=1594 name="VLAN4 (Tennant 4)" vlan-id=4
add interface="ether2 (Tennant LAN)" l2mtu=1594 name="VLAN5 (Tennant 5)" vlan-id=5

/ip address
add address=94.*.*.159/26 interface="ether1 (Internet)" network=94.*.*.128
add address=83.*.*.70/26 interface="ether1 (Internet)" network=83.*.*.64
add address=192.168.4.1/24 interface="VLAN18 (Tennant 1)" network=192.168.4.0
add address=192.168.5.1/24 interface="VLAN18 (Tennant 2)" network=192.168.5.0

/ip firewall filter
add chain=forward in-interface="ether1 (Internet)" out-interface="VLAN4 (Tennant 1)"
add chain=forward in-interface="ether1 (Internet)" out-interface="VLAN5 (Tennant 2)"
add chain=forward in-interface="VLAN4 (Tennant 1)" out-interface="ether1 (Internet)"
add chain=forward in-interface="VLAN5 (Tennant 2)" out-interface="ether1 (Internet)"
	
/ip firewall nat
add action=src-nat chain=srcnat src-address=192.168.4.0/24 to-addresses=83.*.*.75
add action=src-nat chain=srcnat src-address=192.168.5.0/24 to-addresses=94.*.*.158

/ip firewall mangle
add action=mark-routing chain=prerouting new-routing-mark="Gateway 1" src-address=192.168.4.0/24
add action=mark-routing chain=prerouting new-routing-mark="Gateway 2" src-address=192.168.5.0/24

/ip route
add distance=1 gateway=83.*.*.65 routing-mark="Gateway 1"
add distance=1 gateway=94.*.*.129 routing-mark="Gateway 2"