Community discussions

MikroTik App
 
wilburt
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 84
Joined: Tue Aug 24, 2010 3:07 am

One Eth Port - 2 gateway addresses

Tue Sep 19, 2017 4:16 am

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
 
Azma
newbie
Posts: 40
Joined: Sat Sep 27, 2014 8:10 am

Re: One Eth Port - 2 gateway addresses

Wed Sep 20, 2017 4:54 am

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.
 
wilburt
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 84
Joined: Tue Aug 24, 2010 3:07 am

Re: One Eth Port - 2 gateway addresses

Fri Sep 22, 2017 2:16 am

Thanks Azma. Will try that and report back on success
 
wilburt
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 84
Joined: Tue Aug 24, 2010 3:07 am

Re: One Eth Port - 2 gateway addresses

Fri Sep 22, 2017 2:42 am

Azam, is it necessary for firewall mangle rules to mark those packets? or the configuration you provide will suffice?
 
wilburt
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 84
Joined: Tue Aug 24, 2010 3:07 am

Re: One Eth Port - 2 gateway addresses

Wed Sep 27, 2017 3:01 pm

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?
 
User avatar
karlisi
Member Candidate
Member Candidate
Posts: 297
Joined: Mon May 31, 2004 8:09 am
Location: Latvia

Re: One Eth Port - 2 gateway addresses

Wed Sep 27, 2017 4:04 pm

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
---
Karlis
 
wilburt
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 84
Joined: Tue Aug 24, 2010 3:07 am

Re: One Eth Port - 2 gateway addresses

Wed Oct 04, 2017 12:50 pm

Thanks All. The configurations listed above work as expected.

Who is online

Users browsing this forum: No registered users and 63 guests