But the problem is that api.XXX.YYY resolves to multiple IP addresses, and I need all of them in the routing table. Can you give me an example script please?
PS I have tried the /ip/firewall/address-list + route-mark solution but it did not work well for me. It works, but for some reason the response from api.XXX.YYY is much slower in this case (in comparison with the situation when the IPs are simply added as static /32 routes to the main table). Sorry I do not know the reason.
So you suggest using /ip/firewall/address-list just as a mechanism to expand a name into multiple IPs? It is a clever trick, if there are no other mechanisms, thank you very much for the idea!
That aside, do you think there could be reasons why the /ip/firewall/address-list + route-mark solution could be slow? I see it even visually while running “kubectl get something”, and Lens simply chokes and refuses to work with such a delay but does work when I have static routes in the route table.
Ahhh :resolve does appear to work round robin, I didn’t think it did.
I guess then you should be able to do a :while loop of :resolve putting the results into an array each time then exit when the next address is already in the array. Maybe add a max iterations counter as well.
You’ll need to post a config export for us to have a chance of working it out.
I can tell you I use policy based routing all the time and it works well for me.
Very similar to a lot of config I use. Except I don’t have the /routing rule.
Out of interest, since you’re matching on dst-address, is there a specific subnet you’re trying to hit over the tunnel?
In which case you can simply put a route to that subnet in your table instead.
is sufficient to direct the traffic into an alternative routing table. However, removing the
/routing rule
did not help the situation: the API queries are still very slow, Lens does not tolerate such response times. I had to revert to explicit ip routes.
Of course there is no specific subnet. The addresses are public, dynamic and very distant. If there were a subnet, such a question would never have arisen. Unless I want to send several /19 AWS blocks into the tunnel which I do not.