How to Use the Fetch Tool on Mikrotik

How to Use the Fetch Tool on Mikrotik

The Mikrotik Fetch Tool is one of the tools on the Mikrotik RouterOS console/terminal that functions to copy files via the ftp, http, and https protocols. This Fetch tool can copy files from other devices to the Mikrotik Router (download) or copy files from the Mikrotik Router to other devices (upload). So its use is similar to wget on linux, with different commands.

Until the RouterOS 6.38.1 version, the Mikrotik fetch tool still doesn’t have a fetch menu in the Winbox GUI. So to use this fetch tool we still have to type the command on the Mikrotik terminal. This is not a problem, because we will discuss the use of the commands one by one in this Mikrotik Tutorial so that it is easy to understand.

How to Use the Fetch Tool on Mikrotik

Although this fetch tool only runs on the console/terminal, but I recommend logging in using Winbox Mikrotik to make it easier to implement.

Open Mikrotik Terminal. Here I will give some examples of the application of the Mikrotik fetch tool.

1. An example of using the Mikrotik Fetch Tool to download files from the FTP Public folder

Intsall Foam Inside The Keyboards C...
Intsall Foam Inside The Keyboards Case

Here I will give an example to download the mikrotikindo.rsc file from the Public/Mikrotik folder on FTP. Given that the FTP folder used is Public, so we don’t need to enter the FTP username and password in the Mikrotik fetch command.

The following is an example of the Mikrotik Fetch Tool command for FTP Public folders:

tool fetch address=ip.address.ftp src-path=direktori.file.ftp mode=ftp dst-path=direktori.tujuan port=21 keep-result=yes

Please replace the text marked in yellow according to your data. For more details, see the following image:

The picture above shows the status parameter: finished, meaning that the file on the ftp has been successfully downloaded to the Mikrotik Router. We can see the downloaded file on the Files menu:

2. Example of using the Mikrotik Fetch Tool to upload files from Mikrotik to the FTP Public folder

To upload files to the FTP Public folder, the command is as follows:

tool fetch address=ip.address.ftp src-path=direktori.file.router mode=ftp  port=21 upload=yes

For more details, see the following sample images:

After the upload process is complete, which is marked with the status parameter: finished, try checking the FTP folder to see if the uploaded file has entered successfully.

3. Example of using the Mikrotik Fetch Tool to download files from a non-Public FTP folder

This example is similar to example number 1, the difference is that the FTP folder/directory that is used is not a public folder but another folder that requires a certain username and password to download and upload files. This example can also be applied to FTP where there is no public folder and indeed you have to enter a username and password to login.

I gave an example of downloading files from FTP in the MikrotikIndo directory with the file name winbox.exe
The following is an example of a Mikrotik Fetch Tool command for FTP with a username & password:

tool fetch address=ip.address.ftp src-path=direktori.file.ftp mode=ftp port=21 user=user.ftp password=password.ftp

For more details, please see the following image:

The results are as follows:

4. Examples of Using the Mikrotik Fetch Tool to Download files from the Website

In this example, there are 4 methods that I will demonstrate for downloading files from the website using the Mikrotik Fetch Tool. Because to fetch downloads from the website we can use several different parameters, namely address, host, and url. In addition, I will also give an example of downloading files from websites with SSL/HTTPS encryption.

4.1. Use of Address Parameters on the Mikrotik Fetch Tool to Download Files from the Website (http)

The address parameter in the Mikrotik fetch tool can be filled with an IP address or a specific website domain. To be able to download from the http website, the mode parameter is filled with mode=http. Example of its use:

tool fetch address=ixp.mikrotik.co.id src-path=/download/nice.rsc mode=http

4.2. Use of Address and Host Parameters on the Mikrotik Fetch Tool to Download Files from the Website (http)

In some cases, there are websites that cannot be fetched with only the address parameter, because the website’s location is on a certain host in the website’s ip address. To fix this, you can add a host parameter. Example of its use:

tool fetch address=rizkyagung.net host=rizkyagung.net src-path=winbox.exe dst-path= winbox.exe mode=http 

4.3. Using Url Parameters in the Mikrotik Fetch Tool to Download Files from Websites (http)

For the use of the fetch tool in the previous 2 examples, I think it’s too complicated. To make it simpler, we can use the url parameter. The condition is that we must know the url of the full path of the file that we want to fetch. An example of its use is as follows:

tool fetch url="http://rizkyagung.net/winbox.exe" mode=http

4.4. Using Url Parameters in the Mikrotik Fetch Tool to Download Files from Websites (https)

What if the website uses https encryption? Still can, how to use mode = https. For example :

tool fetch url="https://download2.mikrotik.com/routeros/winbox/3.11/winbox.exe" mode=https

That’s all for now, the discussion about the Mikrotik Fetch Tool. In the next article I will share the application of the Fetch Tool to backup & export Mikrotik configuration automatically to an FTP Server.