Community discussions

MikroTik App
 
kryztoval
newbie
Topic Author
Posts: 27
Joined: Tue Sep 07, 2021 10:46 pm

Finding out Multi-wan IP per interface

Sun Oct 17, 2021 10:58 pm

I have a multiwan setup with 2 wans in load balancing by using PCC (in two steps, tcp port 443 hashes on both addresses, everything else hashes on both addresses and ports) and a third wan acting as fail over in ip routing table main in case both of the main ones are not working.

Route list has both wans in distance 1 and backup wan in distance 2 - this allows router to have internet

I have a small dumb service that replies with the ip from where it was pinged (pretty much like checkip.dyndns.org) except that my service listens on more ports so I can use IP firewall mangle rules to route the server:XXXX1 to use WAN1, server:XXXX2 to use WAN2 and server.XXXX3 to use WAN3 - This works amazing for any device in my network .... except for my main router.

There is one caveat tho, if the wan interface is down it will fail over to the load balanced one or if both are down it will go to the bakcup one. I would really like it to fail instead.

So here is what I need help with
  • How do I tell the main router to send requests for an ip:port to go thru a specific conneciton just like I do when any other client in the network requests it?
  • What if I want this specific ip:port to not have a response if the wan it is meant for is not online?
Thanks for taking the time to read this
I will gladly answer any questions regarding this :)
 
kryztoval
newbie
Topic Author
Posts: 27
Joined: Tue Sep 07, 2021 10:46 pm

Re: Finding out Multi-wan IP per interface

Tue Mar 15, 2022 2:47 pm

After a while this became surprisingly simple to execute.
For anyone that encounters this in the future here is the solution I found

For this I had to create the service in different IPs

Q: How do I tell the main router to send requests for an ip:port to go thru a specific conneciton just like I do when any other client in the network requests it?
Tag the connection that targets the specific IP and port to go to a specific routing table
Have the routing table each of the IPs thru an specific WAN for each IP (you can't specify ports here, this is why you need different IPs)

Q: What if I want this specific ip:port to not have a response if the wan it is meant for is not online?
This part is seriously easy, add a wormhole at the end of this routing table. if the WAN interface that responds to that IP is not up, it will fail.

And that is how easy that was!

Who is online

Users browsing this forum: chindo, mkx, NGiannis and 59 guests