Community discussions

MikroTik App
 
User avatar
anav
Forum Guru
Forum Guru
Topic Author
Posts: 19322
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Simplest Route Rule Possible.

Wed Mar 13, 2019 1:18 am

Requirement: There is only one IP used in vlan55,
I want to direct this ip 129.168.55.25 to go out my ether1 cable WANIP.
Right now the cable WANIP is my secondary fail over wanip, the primary is fibre bell.

For my email on cable I simply create a route rule with the mail server IP as the destination with the gateway of cable entered as well.
My primary connection has distance=2 and my email bypass has distance=1 and this simple method works.

Can what I require be accomplished by a Route Rule.
Source address=192.168.55.25
Destination address (is unknown) just has to go out the cable wanip
No routing marks yet (trying to keep it simple)
Interface=ethe1-cable
Action ??? Lookup or Lookup only in Table ??
Table= ??main??
 
joegoldman
Forum Veteran
Forum Veteran
Posts: 767
Joined: Mon May 27, 2013 2:05 am

Re: Simplest Route Rule Possible.

Wed Mar 13, 2019 2:01 am

There is kind of a way - if that is the ONLY thing in vlan55, then you can add VLAN 55 to a VRF and add the default route for that VRF out the ether1 cable WANIP.

If you are not wanting to put the interface into VRF and single out only the traffic for that one IP, then you will need to use a mangle rule to mark-routing to make those packets jump into the secondary route table.
 
User avatar
anav
Forum Guru
Forum Guru
Topic Author
Posts: 19322
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Simplest Route Rule Possible.

Wed Mar 13, 2019 3:00 am

So it would like this???
VRF
Routing Mark - "PS4"
Interface - vlan55
Route Distinguisher - 1:1
Import Route Targets - 1:1
Export Route Targets - 1:1

Route List Rule
source address = VLAN IP of device
destination address = wanip of cable on eth1
Routing Mark - "PS4"
Interface ?
Action - Lookup?
Table - Main?
 
Sob
Forum Guru
Forum Guru
Posts: 9120
Joined: Mon Apr 20, 2009 9:11 pm

Re: Simplest Route Rule Possible.

Wed Mar 13, 2019 5:42 am

This should be it:
/ip route
add dst-address=0.0.0.0/0 gateway=<WANx gateway> routing-mark=WANx
/ip route rule
add src-address=192.168.55.25/32 action=lookup table=WANx
 
User avatar
anav
Forum Guru
Forum Guru
Topic Author
Posts: 19322
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Simplest Route Rule Possible.

Wed Mar 13, 2019 8:11 pm

Okay I will give that try, but I still want to know the correct VRF settings to get that working but importantly to understand what the VRF settings are actually doing!!
 
User avatar
anav
Forum Guru
Forum Guru
Topic Author
Posts: 19322
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Simplest Route Rule Possible.

Wed Mar 13, 2019 10:36 pm

This should be it:
/ip route
add dst-address=0.0.0.0/0 gateway=<WANx gateway> routing-mark=WANx
/ip route rule
add src-address=192.168.55.25/32 action=lookup table=WANx
sob your rule is potentially incomplete as it stays blue on my setup (doesnt go black).

POLICY ROUTE
source-address=192.168.55.25
Action=lookup
table=ps4
(what about routing mark, assuming its not used as I identify one in the Route Rule??)
(what about interface should I put the vlan interface the ip runs on??)

ROUTE RULE
add dst-address=0.0.0.0/0 gateway=<cablegateway> routing-mark=ps4

??what about preferred source, do I need to put in the LANIP or not required? Would it hurt?
??What about distance, does it matter or is that after route mark in priority??

Going back to my first comment question, the wiki states only one instance of route can be active with the same destination address.
But my two secondary recursive router are NOT active and so not sure why my new rule is not active.
The email bypass doesn't count because the destination address is the WANIP of the email server, not 0.0.0.0 !!

Right now without any mangling or route marks etc..... the following is true.
distance=1 is set from my email bypass to cable connection. Any attempt to smtp is sent through this route.
distance=2 is set for the two recursive routes for my PRIMARY WAN to the first dns server
distance=3 is set for the two recursive routes for my PRIMARY WAN to the second dns server
distance=10 is set for the SECONDARY WAN connection (cable).
Do I need to set a distance for my new rule? Since its not routing from the Main table does it matter??
Last edited by anav on Wed Mar 13, 2019 10:52 pm, edited 1 time in total.
 
User avatar
JohnTRIVOLTA
Member
Member
Posts: 345
Joined: Sun Dec 25, 2016 2:05 pm
Location: BG/Sofia

Re: Simplest Route Rule Possible.

Wed Mar 13, 2019 10:49 pm

Requirement: There is only one IP used in vlan55,
I want to direct this ip 129.168.55.25 to go out my ether1 cable WANIP.
Right now the cable WANIP is my secondary fail over wanip, the primary is fibre bell.

For my email on cable I simply create a route rule with the mail server IP as the destination with the gateway of cable entered as well.
My primary connection has distance=2 and my email bypass has distance=1 and this simple method works.

Can what I require be accomplished by a Route Rule.
Source address=192.168.55.25
Destination address (is unknown) just has to go out the cable wanip
No routing marks yet (trying to keep it simple)
Interface=ethe1-cable
Action ??? Lookup or Lookup only in Table ??
Table= ??main??
Mark with routing mark 192.168.55.25 src-traffic in mangle section. After that add route with gateway WANIP and this routing mark !
 
User avatar
anav
Forum Guru
Forum Guru
Topic Author
Posts: 19322
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Simplest Route Rule Possible.

Thu Mar 14, 2019 12:11 am

Sorry this discussion is NOT to include mangling LOL.
 
User avatar
JohnTRIVOLTA
Member
Member
Posts: 345
Joined: Sun Dec 25, 2016 2:05 pm
Location: BG/Sofia

Re: Simplest Route Rule Possible.

Thu Mar 14, 2019 7:09 am

Sorry this discussion is NOT to include mangling LOL.
Ooo sorry .... by the way, all is clear and there is nothing to discuss, but I will follow the topic .
 
User avatar
anav
Forum Guru
Forum Guru
Topic Author
Posts: 19322
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Simplest Route Rule Possible.

Thu Mar 14, 2019 1:53 pm

No worries, the example is appreciated and should work I was just trying to avoid any other complications (keep the change solely in the ip route section).
 
Sob
Forum Guru
Forum Guru
Posts: 9120
Joined: Mon Apr 20, 2009 9:11 pm

Re: Simplest Route Rule Possible.

Thu Mar 14, 2019 3:40 pm

You wanted simple routing rule. If I expand the config a little, all routes would be:
/ip route
add dst-address=0.0.0.0/0 gateway=<WAN1 gateway> routing-mark=WAN1
add dst-address=0.0.0.0/0 gateway=<WAN2 gateway> routing-mark=WAN2
add dst-address=0.0.0.0/0 gateway=<WAN1 gateway> distance=1 check-gateway=arp
add dst-address=0.0.0.0/0 gateway=<WAN2 gateway> distance=2 check-gateway=arp
It's the usual dual WAN config with primary and backup connection. And the rule:
/ip route rule
add src-address=192.168.55.25/32 action=lookup table=WAN2
simply says "if packet comes from 192.168.55.25, then try to find route in routing table WAN2" (= use routes with routing-mark=WAN2). So in this case, device with 192.168.55.25 will use WAN2, while all others (if there's no other config) will use WAN1 when it's active.

- If you don't set any using mangle, packets won't have any routing mark.
- Source address as condition is enough.
- Correct preferred source should be chosen automatically, and you will srcnat it anyway.
- Distance just tells which route to same destination in same routing table should be preferred. So if in above example there's only one route in table WAN2, it doesn't matter what distance it has. It could maybe affect packets with low TTL, but to tell the truth, I never tested that.

How to make it work with your existing config, I can't really tell, I don't know what exactly you have.
 
User avatar
anav
Forum Guru
Forum Guru
Topic Author
Posts: 19322
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Simplest Route Rule Possible.

Thu Mar 14, 2019 3:53 pm

Hi Sob I will post my config, the juicy bits, later. Suffice to say I included the rules you mentioned without any mangling and they seem to not invoke any red text LOL.
Also my primary and backup rules are done without any mangling.............and they work............ see I like it simple!

My Route rules....
/ip route
add distance=2 gateway=BB.aa.ccc.x routing-mark=ps4
add distance=10 gateway=BB.aa.ccc.x
add comment=Email_bypass distance=1 dst-address=24.222.0.20/32 gateway=BB.aa.ccc.x\
/ip route rule
add src-address=192.168.55.5/32 table=ps4

If going this path, would this VRF rule be legit???
/ip route vrf
add disabled=yes export-route-targets=1:1 import-route-targets=1:1 interfaces=\
PS4_V55 route-distinguisher=1:1 routing-mark=PS4


Uh oh, I think you mean I still have to set a pre-routing mangle tool for connections from that IP address for the IP Route rules you gave me. Since not explicitly noted I did not.
I merely and perhaps blindly accepted the noting of route mark on the route rule as good enough........ oopsy.........
But I refuse to disable fasttrack for this, is it a concern??

My sad attempt.. and this is not simple there has to be a better way...........
/ip firewall mangle
add action=accept chain=prerouting connection-mark="" disabled=yes dst-address=myWANIP in-interface=PS4_V55
add action=mark-connection chain=prerouting connection-mark=no-mark disabled=yes in-interface=Eastlink_eth1 new-connection-mark=mark-ps4 passthrough=yes
add action=mark-connection chain=prerouting connection-mark=no-mark disabled=yes dst-address-type=!local in-interface=PS4_V55 new-connection-mark=mark-ps4 passthrough=yes routing-table=""
add action=mark-routing chain=prerouting connection-mark=mark-ps4 disabled=yes in-interface=PS4_V55 new-routing-mark=ps4 passthrough=yes
add action=mark-routing chain=output connection-mark=mark-ps4 disabled=yes new-routing-mark=ps4 passthrough=yes

Meanwhile if you know how VRF works, and can explain how it would work in my scenario, it would be much appreciated. I have the feeling this is a real power user function that needs to be used with caution but eagerly awaiting your elucidation.
 
Sob
Forum Guru
Forum Guru
Posts: 9120
Joined: Mon Apr 20, 2009 9:11 pm

Re: Simplest Route Rule Possible.

Fri Mar 15, 2019 12:36 am

My simple example is complete, that's all you need (plus some addresses and stuff, of course) to have dual-WAN config, with WAN1 being used when available and WAN2 when not. Except for 192.168.55.25, which would use WAN2. No mangle rules necessary.

I'm not sure about compatibility with fasttrack, I generally avoid it.

And sorry to disappoint you, but VRF is still on my "to learn" list.
 
User avatar
anav
Forum Guru
Forum Guru
Topic Author
Posts: 19322
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Simplest Route Rule Possible.

Fri Mar 15, 2019 5:30 am

My simple example is complete, that's all you need (plus some addresses and stuff, of course) to have dual-WAN config, with WAN1 being used when available and WAN2 when not. Except for 192.168.55.25, which would use WAN2. No mangle rules necessary.

I'm not sure about compatibility with fasttrack, I generally avoid it.

And sorry to disappoint you, but VRF is still on my "to learn" list.
Okay good so my assumption was correct and I dont need the mangle Thanks!!
VRF, hmmm well hopefully I've intrigued you into learning it LOL.

Who is online

Users browsing this forum: Mystique, tdw and 24 guests