Page 1 of 1

One Eth Port - 2 gateway addresses

Posted: Tue Sep 19, 2017 4:16 am
by wilburt
I have 3 Vlans setup on my RB1100 with one physical port as the connection to the outside world. How can I ensure specific VLANS go out a specific Gateway?

Vlan10 192.168.10.x/24
Vlan20 192.168.20.x/24
Vlan30 192.168.30.x/24

Eth1 --> Gateways (172.16.1.1/32 & 172.16.2.1/32) outside world (WWW)

What is the best configuration to ensure the following routing is acheived

Vlan10 --> 0.0.0.0/0 Via 172.16.1.1/32

Vlan20&30 --> 0.0.0.0/0 Via 172.16.2.1/32

Thanks

Re: One Eth Port - 2 gateway addresses

Posted: Wed Sep 20, 2017 4:54 am
by Azma
Hi,
1. create static route with mark routing under /ip route.
/ip route add gateway="ip wan1" routing-mark=wan1
/ip route add gateway="ip wan2" routing-mark=wan2
2. create rule to implement static route for your desired clients.
/ip route rule add interface=vlan10 action=lookup table=wan1
/ip route rule add interface=vlan20 action=lookup table=wan2
/ip route rule add interface=vlan30 action=lookup table=wan2
3. check gateway for every client of vlans using tool tracert to ensure the clients get routed through the gateway as your plan.

Re: One Eth Port - 2 gateway addresses

Posted: Fri Sep 22, 2017 2:16 am
by wilburt
Thanks Azma. Will try that and report back on success

Re: One Eth Port - 2 gateway addresses

Posted: Fri Sep 22, 2017 2:42 am
by wilburt
Azam, is it necessary for firewall mangle rules to mark those packets? or the configuration you provide will suffice?

Re: One Eth Port - 2 gateway addresses

Posted: Wed Sep 27, 2017 3:01 pm
by wilburt
Applied the following codes but network not able to get out. Does NAT rules need to be updated from out-interface to the specific IP address to NAT on?

Re: One Eth Port - 2 gateway addresses

Posted: Wed Sep 27, 2017 4:04 pm
by karlisi
Don't mess with routes, make src-nat rules for each of subnets like this:
/ip firewall nat
add action=src-nat chain=srcnat out-interface=WAN \
    src-address=192.168.10.0/24 to-addresses=172.16.1.1/32
add action=src-nat chain=srcnat out-interface=WAN \
    src-address=192.168.20.0/24 to-addresses=172.16.2.1/32

Re: One Eth Port - 2 gateway addresses

Posted: Wed Oct 04, 2017 12:50 pm
by wilburt
Thanks All. The configurations listed above work as expected.