Community discussions

MikroTik App
 
douglasn27
just joined
Topic Author
Posts: 1
Joined: Tue Sep 25, 2018 8:03 pm

Route specific IP traffic from LAN Subnet to WAN specific IP

Fri Sep 28, 2018 3:37 pm

I have today in my Mikrotik the following scenario:

LAN + 2 WAN / 29

On the WAN I include 2 addresses from each ISP in their respective interface.

In mangle I have created connection marks to direct the traffic that comes through an interface to return by the same and also a basic failover on the routes with ping check in the gateway.

I need to direct an IP of the LAN Subnet to exit by specific IP of the WAN and I am having difficulty doing this. I saw many posts indicating use src-nat and to-adress = "WAN SPECIFIC IP" but it did not work.

Any tips?
 
solar77
Long time Member
Long time Member
Posts: 569
Joined: Thu Feb 04, 2016 11:42 am
Location: Scotland

Re: Route specific IP traffic from LAN Subnet to WAN specific IP

Fri Sep 28, 2018 4:53 pm

use mangle rule to mark-routing, apply this to the source IP you specify.
then add a routing rule that route all traffic with this routing mark , towards specific gateway of your IP.
MTCNA MTCTCE UEWA
 
Sob
Forum Guru
Forum Guru
Posts: 5590
Joined: Mon Apr 20, 2009 9:11 pm

Re: Route specific IP traffic from LAN Subnet to WAN specific IP

Fri Sep 28, 2018 5:03 pm

It's simple. If you already mastered connection marking, just add another rule like:
/ip firewall mangle
add chain=prerouting src-address=<your LAN IP> connection-mark=no-mark action=mark-connection new-connection-mark=<your WANx mark>
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply. Not intended as incentive for masochists.
 
stoser
Member Candidate
Member Candidate
Posts: 118
Joined: Sun Aug 21, 2016 12:04 am

Re: Route specific IP traffic from LAN Subnet to WAN specific IP

Fri Sep 28, 2018 5:57 pm

Like the previous two posts state, but I will clarify and add preferencial source in route:

-- Add a connection mark for src address
-- add routing mark for the new connection mark
-- add static route for new routing mark, but clearly state preferential source in the route. That way all connections from source address will go out using the specific WAN ip. In this way you can specify which of the two WAN IP addresses you will use for this source IP, instead of letting the NATfunction of the router decide.
 
anav
Forum Guru
Forum Guru
Posts: 4596
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada

Re: Route specific IP traffic from LAN Subnet to WAN specific IP

Wed Oct 10, 2018 5:55 pm

Good advice from the usual 'suspects' but I am less knowledgeable and a tad (okay a ton) slower.
I prefer to better understand the setup/scenario before ascertaining the requirements.

1. Two WANs
2. What kind of load balancing is used?
3. Do you have one as primary and the other just for failover?
4. Do you have any port forwarding requirements (external users that need to connect to equipment or servers at your location)
5. How many Lans do you have on your network?
6. Do you have just one IP that needs access to WAN 2 (assuming WAN2).
7. Do you have a service that needs access to WAN 2, or an IP (for example mail service could affect more than one IP)
I'd rather manage rats than software. Follow my advice at your own risk! (Sob & mkx forced me to write that!)

Who is online

Users browsing this forum: No registered users and 40 guests