Community discussions

 
sebdar
just joined
Topic Author
Posts: 2
Joined: Tue Feb 17, 2015 2:48 pm

Forcing single IP to use specific WAN

Tue Feb 17, 2015 4:15 pm

Hi ,
I wonder if someone can help me.
I have 3 interfaces configured.

ethernet 2 WAN1 (192.168.5.3) (behind there is ADSL router 192.168.5.1)
ethernet 3 WAN2 (192.168.3.3) (behind there is aDSL router 192.168.3.1)
ethernet 5 LAN (192.168.1.254) connected to a network (192.168.1.0)

IP routes are set as follow:

First:
Dst. address: 0.0.0.0/0
Gateway: 192.168.5.1

Second:

Dst. address: 0.0.0.0/0
Gateway: 192.168.3.1

I have also set up 2 NAT rules to masquerade Src. Address 192.168.1.0/24 for both WAN Out Interfeces.

Now when I will disconnect WAN1 interface, clients on the LAN network automatically will switch to WAN2.

What I'm trying to achieve is to force a single IP (for example 192.168.1.244) to use only specific WAN (for example WAN1).
How can I achieve that?

Any help appreciated.
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6616
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: Forcing single IP to use specific WAN

Tue Feb 17, 2015 4:30 pm

Just configure /ip firewall nat rule, that specifies that client src-address is always masqueraded over specific WAN.


Another thins is that you need additional configuration for such configuration,
First:
Dst. address: 0.0.0.0/0
Gateway: 192.168.5.1

Second:

Dst. address: 0.0.0.0/0
Gateway: 192.168.3.1
otherwise first gateway will be used all the time.
 
sebdar
just joined
Topic Author
Posts: 2
Joined: Tue Feb 17, 2015 2:48 pm

Re: Forcing single IP to use specific WAN

Wed Feb 18, 2015 10:39 am

What do you mean by "Another thins is that you need additional configuration for such configuration"?

My NAT config for the single IP looks as follow:

Chain: scr-nat
Src. address: 192.168.1.81
Out. Interface: WAN1
Action: masquerade

Is that what I'm looking for?
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6616
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: Forcing single IP to use specific WAN

Wed Feb 18, 2015 10:51 am

What do you mean by "Another thins is that you need additional configuration for such configuration"?
If you just set two default gateways, only one of them is going to work (without additional configuration).
 
Cetalfio
Member Candidate
Member Candidate
Posts: 224
Joined: Sat Sep 20, 2008 6:19 pm
Location: Italy

Re: Forcing single IP to use specific WAN

Sat Feb 21, 2015 10:11 pm

sergejs invites you to explore this topic, have you looked at some examples on wiki.mikrotik.com.
This can help you
http://wiki.mikrotik.com/wiki/Load_Balancing

In the past I used the ECMP and to force some LAN ip to use specific gateway I did:

/ip firewall mangle add chain=prerouting action=mark-routing new-routing-mark=goGW1 passthrough=no src-address=LAN-IP-Address192.168.1.244

/ip route add dst-address=0.0.0.0/0 gateway=192.168.5.3 gateway-status=192.168.5.3 distance=1 scope=30 target-scope=10 routing-mark=goGW1

cetalfio
 
jprasad
just joined
Posts: 19
Joined: Sun Apr 27, 2014 10:12 pm

Re: Forcing single IP to use specific WAN

Sun Feb 22, 2015 4:50 am

you can use mangle in the firewall tab.

put your source ip adress go to action tab choose mark routing then make routing mark "wan1"

now go to routes
make route to 0.0.0.0/0
gateway 192.168.5.1%(YOUR WAN1 INTERFACE NAME) (the % forces it to use that interface)
routing mark "wan1"

then your masqurade is like normal

Who is online

Users browsing this forum: No registered users and 31 guests