Community discussions

MikroTik App
 
alexflint
just joined
Topic Author
Posts: 2
Joined: Thu Oct 20, 2022 4:44 pm

Use "/tool fetch" with a particular WAN interface

Thu Oct 20, 2022 4:52 pm

I have two WANs and I would like to send an HTTP GET request on a particular interface (not the default according to the route table). While logged into the router I can send my request using
/tool fetch url="https://api.ipify.org/" output=user
However, this always goes out over the default WAN. Can I change that?

For reference what I am looking for is conceptually similar to "/ping interface=" command that goes like this:
/ping example.com interface=ether10
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12657
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Use "/tool fetch" with a particular WAN interface

Thu Oct 20, 2022 6:32 pm

On routing set the api.ipify.org reachable only from the WAN you want to.
/ip route
add distance=1 dst-address=54.91.59.199/32 gateway=ether10 comment="api.ipify.org"
 
varkey
just joined
Posts: 5
Joined: Fri Jul 20, 2018 2:51 pm

Re: Use "/tool fetch" with a particular WAN interface

Mon Apr 03, 2023 6:49 am

It would have been great if the `fetch` tool supported specifying an interface. The use case for me is, I have multiple WAN interfaces, and I want to send a health check request from each WAN indicating that it's able to reach the internet.

I use this service to do this -- https://healthchecks.io/

So basically, every minute, the script gets run every minute and a request is made to the remote endpoint, and if there is no such request for 5-10 minutes, I get notified. This indicates that something is wrong with the WAN link that it's unable to reach the internet.

Adding a more specific route to this site may not help cause I want to monitor multiple WAN interfaces this way, so each WAN should be able to send a request to the site.