Community discussions

MikroTik App
 
ansari
newbie
Topic Author
Posts: 27
Joined: Mon Jan 23, 2017 8:04 am

Divide users on 2 WAN from same LAN

Fri Sep 29, 2017 9:29 am

Hi,
i have 2 WAN and 1 LAN on mikrotik x86
WAN1 ip is: 192.168.0.2 - and gateway is: 192.168.0.1
WAN2 ip is: 192.168.2.2 - and gateway is: 192.168.1.1
and LAN ip: is 192.168.88.0/24

and nat rule in firewall is:
/ip firewall nat
add action=masquerade chain=srcnat

now i want a user with an ip 192.168.88.100 and 192.168.88.184 should use WAN1 and the rest of the users should use WAN2, i don't want loadbalancing. Please help me.
 
User avatar
morituruz
newbie
Posts: 33
Joined: Fri Oct 17, 2014 9:00 am

Re: Divide users on 2 WAN from same LAN

Fri Sep 29, 2017 1:59 pm

Hello.
1. In mangle mark outgoing traffic from these users with some routing mark
2. In routes set bigger distance in existing "0.0.0.0/0" routes
3. add route with routing mark from 1. to wan1
 
djfrancis
Frequent Visitor
Frequent Visitor
Posts: 78
Joined: Thu Feb 02, 2012 12:01 am

Re: Divide users on 2 WAN from same LAN

Fri Sep 29, 2017 2:17 pm

Hi, try this:
/ip firewall addresss-list
add list=WAN1 address=192.168.88.100
add list=WAN1 address=192.168.88.184
add list=WAN2 address=192.168.88.2-192.168.88.99
add list=WAN2 address=192.168.88.101-192.168.88.183
add list=WAN2 address=192.168.88.185-192.168.88.254
/ip firewall mangle
add chain=prerouting src-address-list=WAN1 action=mark-routing new-routing-mark=to_wan1
add chain=prerouting src-address-list=WAN2 action=mark-routing new-routing-mark=to_wan2
At this point, remove any default route and then:
/ip route
add dst-address=0.0.0.0/0 distance=1 gateway=192.168.0.1 routing-mark=to_wan1
add dst-address=0.0.0.0/0 distance=2 gateway=192.168.1.1 routing-mark=to_wan2
I hope this helps you.

Regards.
 
ansari
newbie
Topic Author
Posts: 27
Joined: Mon Jan 23, 2017 8:04 am

Re: Divide users on 2 WAN from same LAN

Fri Sep 29, 2017 3:55 pm

Hi, try this:
/ip firewall addresss-list
add list=WAN1 address=192.168.88.100
add list=WAN1 address=192.168.88.184
add list=WAN2 address=192.168.88.2-192.168.88.99
add list=WAN2 address=192.168.88.101-192.168.88.183
add list=WAN2 address=192.168.88.185-192.168.88.254
/ip firewall mangle
add chain=prerouting src-address-list=WAN1 action=mark-routing new-routing-mark=to_wan1
add chain=prerouting src-address-list=WAN2 action=mark-routing new-routing-mark=to_wan2
At this point, remove any default route and then:
/ip route
add dst-address=0.0.0.0/0 distance=1 gateway=192.168.0.1 routing-mark=to_wan1
add dst-address=0.0.0.0/0 distance=2 gateway=192.168.1.1 routing-mark=to_wan2
I hope this helps you.

Regards.
yes it works, thanks.
 
djfrancis
Frequent Visitor
Frequent Visitor
Posts: 78
Joined: Thu Feb 02, 2012 12:01 am

Re: Divide users on 2 WAN from same LAN

Fri Sep 29, 2017 5:12 pm

:D :D

Who is online

Users browsing this forum: magchiel, Qanon and 20 guests