Community discussions

MikroTik App
 
OKNET
Member
Member
Topic Author
Posts: 354
Joined: Mon Jun 22, 2015 9:22 am

Routing by destination port

Fri Jul 08, 2016 12:03 pm

I want to choose a particular WAN interface to be used for calls to particular destination ports in internet.

In a rule like :

chain=prerouting action=mark-routing new-routing-mark=to_WAN3  protocol=tcp  dst-port=8888

shoud I specify addresses not belong to my lan subnet ?  i.e. add  dst-address=!192.168.1.0/24  (my LAN)

Thank you
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4047
Joined: Wed May 11, 2011 6:08 pm

Re: Routing by destination port

Fri Jul 08, 2016 6:44 pm

That would work - you could also exempt your local networks from all policy routing with a route rule:

/ip route rule add dst=192.168.0.0/16 action=lookup-only-in-table table=main
 
OKNET
Member
Member
Topic Author
Posts: 354
Joined: Mon Jun 22, 2015 9:22 am

Re: Routing by destination port

Thu Jul 14, 2016 3:34 pm

I mean, the rule 

chain=prerouting action=mark-routing new-routing-mark=to_WAN3  protocol=tcp  dst-port=8888

is it processed also when a packet comes from a LAN machine to a LAN machine (so connection fails because routed to WAN3) ??

I have just checked LAN to LAN connection on port 8888 works despite that mangle rule exists, any thought ??
 
savage
Forum Guru
Forum Guru
Posts: 1263
Joined: Mon Oct 18, 2004 12:07 am
Location: Cape Town, South Africa
Contact:

Re: Routing by destination port

Thu Jul 14, 2016 4:08 pm

If your definition of LAN to LAN is two hosts on the same subnet, then no, the rule won't touch that traffic.  The traffic never even makes it to the router.

Who is online

Users browsing this forum: neki, TheWeegee and 53 guests