Skip to content

Instantly share code, notes, and snippets.

@fanian
Last active August 30, 2022 12:55
Show Gist options
  • Save fanian/705458803e2a7558be75 to your computer and use it in GitHub Desktop.
Save fanian/705458803e2a7558be75 to your computer and use it in GitHub Desktop.
mikrotik 2 gateways and separate clients
How to add 2 gateways and seperate clients by Chupaka
/ip firewall mangle add chain=prerouting src-address=198.54.15.0/24 action=mark-routing new-routing-mark=r_178
/ip firewall mangle add chain=prerouting src-address=192.168.10.0/24 action=mark-routing new-routing-mark=r_178
/ip firewall mangle add chain=prerouting src-address=192.168.11.0/24 action=mark-routing new-routing-mark=r_172
/ip firewall mangle add chain=prerouting src-address=192.168.12.0/24 action=mark-routing new-routing-mark=r_172
/ip route add gateway=178.242.0.200 routing-mark=r_178
/ip route add gateway=172.16.0.200 routing-mark=r_172
something like that. and if you need routing between those subnets, then you should add one more rule on the top with 'action=accept' and dst-address-list=my_local_subnets, then add all your four subnets to that address list
maybe the best one: http://habrahabr.ru/post/227913/
http://www.slideshare.net/Basellof/load-balancing-over-multiple-gateways-28422296
http://blog.butchevans.com/2008/09/mikrotik-policy-routing-implementation-example/
http://wiki.mikrotik.com/wiki/Load_Balancing_over_Multiple_Gateways
http://wiki.mikrotik.com/wiki/ECMP_load_balancing_with_masquerade
http://habrahabr.ru/post/244385/
http://vasilevkirill.com/?p=45
http://www.linuxshop.ru/articles/a1614589-vpn_tunel_mikrotik_to_mikrotik_na_primere_dvukh_ofisov_pptp_l2tp_ip2ip_ppoe_vlan_ipsec_gre
http://lanmarket.ua/stats/mikrotik-routeros-dva-provajdera-balansirovka-marshrutizaciya-firewall-%28bez%20skriptov%29
http://geektimes.ru/post/186284/
@barankhan
Copy link

After implimenting your gist I'm unable to ping my router from the internet. I also failed to connect the VPNs using pptp. Please suggest.

@DavidBisschoff
Copy link

Thank you very much for this your comment "if you need routing between those subnets..." has been a solution I have been looking for for a very long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment