Community discussions

MikroTik App
 
ntabish47
just joined
Topic Author
Posts: 2
Joined: Sun Nov 03, 2019 1:28 pm

Two subnets not communicating after Mangle rule

Sun Nov 03, 2019 1:42 pm

Dear Friends and Mikrotik experts,

I have two different networks: eth1 192.168.138.1 and eth2 192.168.137.1 with DHCP enabled on both networks. I have two gateways, eth3 10.x.x.x and eth4 103.215.x.x.
I have created route marking mangle rule for 192.168.137.1 and then created a static route so all traffic from eth2 goes through eth4 (my second gateway). Everything work perfect but only I can't ping or access servers between two networks.
Please let me know if you guys need more information. BTW this is my first post on this forum so bear with me if you feel confused.

Thanks a lot
 
User avatar
cdiedrich
Forum Veteran
Forum Veteran
Posts: 997
Joined: Thu Feb 13, 2014 2:03 pm
Location: Basel, Switzerland // Bremen, Germany
Contact:

Re: Two subnets not communicating after Mangle rule

Mon Nov 04, 2019 1:11 pm

Your mangle rule sets the routing mark no matter what the dst-address is.
So add a route with the appropriate routing mark like this:
/ip route
add dst-address=192.168.138.0/24 gateway=ether1 routing-mark=your-routing-mark-eth3-wan
add dst-address=192.168.138.0/24 gateway=ether1 routing-mark=your-routing-mark-eth4-wan
add dst-address=192.168.137.0/24 gateway=ether2 routing-mark=your-routing-mark-eth3-wan
add dst-address=192.168.137.0/24 gateway=ether2 routing-mark=your-routing-mark-eth4-wan
This has to be done for every attached network and with every routing-mark you have used.

-Chris
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Two subnets not communicating after Mangle rule  [SOLVED]

Mon Nov 04, 2019 9:08 pm

Or two other options:

b) Don't set the routing mark when destination is local subnet (add dst-address=!192.168.0.0/16; "!" means "not").

c) Ignore routing marks when destination is local subnet (/ip route rule add action=lookup-only-in-table dst-address=192.168.0.0/16 table=main).

(I used whole 192.168.0.0/16, you can use only what you actually have, but the whole subnet should be fine too)
 
ntabish47
just joined
Topic Author
Posts: 2
Joined: Sun Nov 03, 2019 1:28 pm

Re: Two subnets not communicating after Mangle rule

Wed Nov 06, 2019 9:34 am

Or two other options:

b) Don't set the routing mark when destination is local subnet (add dst-address=!192.168.0.0/16; "!" means "not").

c) Ignore routing marks when destination is local subnet (/ip route rule add action=lookup-only-in-table dst-address=192.168.0.0/16 table=main).

(I used whole 192.168.0.0/16, you can use only what you actually have, but the whole subnet should be fine too)
Thank you, tried c) and worked perfectly.

Who is online

Users browsing this forum: Dendik and 58 guests