Community discussions

MikroTik App
 
prd0000
just joined
Topic Author
Posts: 7
Joined: Tue Apr 02, 2013 6:53 am

Mikrotik mulitple gateway problem

Thu Apr 28, 2022 10:35 am

Hello, I am trying to run some IP to a specific provider, while letting the other connection to a default provider.

Here is my configuration below:
/ip firewall mangle
add action=accept chain=prerouting dst-address=192.168.100.1 in-interface=LocalBridge
add action=accept chain=prerouting dst-address=192.168.1.1 in-interface=LocalBridge
add action=mark-connection chain=prerouting connection-mark=no-mark in-interface=01-Indihome new-connection-mark=Indihome_out
add action=mark-connection chain=prerouting connection-mark=no-mark in-interface=02-Higo new-connection-mark=Higo_out
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address=!10.0.0.0/8 in-interface=LocalBridge new-connection-mark=Indihome_out passthrough=yes
add action=mark-connection chain=prerouting dst-address-list=priority in-interface=LocalBridge new-connection-mark=Higo_out
add action=mark-routing chain=prerouting connection-mark=Higo_out in-interface=LocalBridge new-routing-mark=r_higo passthrough=yes
add action=mark-routing chain=prerouting connection-mark=Indihome_out in-interface=LocalBridge new-routing-mark=r_indihome passthrough=yes routing-mark=r_indihome
add action=mark-routing chain=output connection-mark=Higo_out new-routing-mark=r_higo passthrough=yes
add action=mark-routing chain=output connection-mark=Indihome_out new-routing-mark=r_indihome passthrough=yes

/ip firewall nat
add action=masquerade chain=srcnat out-interface=01-Indihome
add action=masquerade chain=srcnat out-interface=02-Higo

/ip route
add check-gateway=ping distance=3 gateway=192.168.1.1 routing-mark=r_indihome
add check-gateway=ping distance=3 gateway=192.168.100.1 routing-mark=r_higo

/ip dhcp-client
add default-route-distance=250 disabled=no interface=01-Indihome use-peer-dns=no use-peer-ntp=no
add add-default-route=no disabled=no interface=02-Higo use-peer-dns=no use-peer-ntp=no

/ip firewall address-list
add address=104.21.69.162/24 list=priority
I have disabled everything in /ip firewall filter

My PC is at 10.12.2.14, and I tried to ping 104.21.69.162. When it couldn't get through, I tried to look at packet sniffer.
It seems, that the packet correctly forrwarded to 192.168.100.3, then sent through 192.168.100.1. But when 104.21.69.162 replied, the packet only reached 192.168.100.3, and then discarded.

Similar thing happened with 01-Indihome. If I didn't put any default route, I couldn't reach internet at all. Anything with routing mark simply didn't work for the reply.

Actually, my goal is very simple. I need 01-Indihome to be the default gateway, except for priority addresses which have to go through 02-Higo.
Screenshot 2022-04-28 142820.jpg
Is there anything I missed from my configuration?

Thank you for your help.
You do not have the required permissions to view the files attached to this post.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Mikrotik mulitple gateway problem

Sun May 01, 2022 4:44 pm

I see some problems:

- This ping shouldn't use 02-Higo at all, because first packet gets connection marked by rule #5, then gets remarked by #6, but because it doesn't have passthrough=yes, it will stop there. It won't get its routing marked, because it won't get to #7.
- Rule #8 marks routing with r_indihome mark, but only for packets that already have this mark, so it doesn't do anything, because it can't happen.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19323
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Mikrotik mulitple gateway problem

Sun May 01, 2022 6:09 pm

So you have two ISPs, and want to 'force' some users to go out a specific gateway while the rest should use the 'normal gateway'?
What do you mean by some users.
-how many?
-an entire subnet?
-two subnets out of 30 subnets?

Who is online

Users browsing this forum: jmszuch1, NxtGen [Bot], swom and 57 guests