microtic basic commands
MikroTik RouterOS (or MikroTik only) is an operating system based on the Linux kernel. MikroTik RouterOS can be installed on RouterBOARD series hardware, or on x86 standard-based computers, the computer is used as a network router and applies various additional features, such as various types of firewall services, virtual private network (VPN), MikroTik RouterOS Administration can be done using software based on a GUI or console, here are the MikroTik basic commands that are generally run on a CLI (Command Line Interface) based console.
1. ip address add
The "IP Address Add" command is used to add or set an IP Address to an NIC (Network Interface Card), just type the "ip address add" command then follow with the IP Address that will be set for example "address = 10.10.10.1 / 24 ″ then followed by the name NIC for example "interface = ether1".
[admin @ MikroTik]> ip address add address = 10.10.10.1 / 24 interface = ether1
Note: You must know the name of the interface that you want to set the IP Address, the name of the interface can actually be changed with certain commands to make it easier for users to recognize each port of the NIC (Network Interface Card), we will discuss these commands in the next section .
2. ip address print
The "IP Address Print" command is used to view the IP address of each Network Interface Card, how to just type the "ip address print" command on the console then press Enter.
[admin @ MikroTik]> ip address print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK BROADCAST INTERFACE
0 2.2.2.1/24 2.2.2.0 2.2.2.255 ether2
1 10.5.7.244/24 10.5.7.0 10.5.7.255 ether1
2 10.10.10.1/24 10.10.10.0 10.10.10.255 ether2
The address column contains the IP Address, if it is not set then the column is empty, the network column contains the IP Address for the network, this parameter can only be configured for addresses with / 32 netmask (point to point links), the broadcast column contains IP Address broadcasting calculated from the IP Address and Network Mask, the interface column contains the specified IP Address interface name.
3. IP DNS set
The "IP DNS Set" command is used to set a specific IP Address as a DNS (Domain Name System) server and create a RouterBoard or computer with MikroTik RouterOS having server computer functions, how to do it simply type the command "ip dns set" then follow with the IP Address will be set for example "servers = 159.148.60.3" then followed by "allow-remote-requests = yes" to allow network requests.
[admin @ MikroTik]> ip dns set servers = 159.148.60.3 allow-remote-requests = yes
4. IP DNS print
You can type the "ip dns print" command to see the details of the DNS server status of the IP Address specified above.
[admin @ MikroTik]> ip dns print
servers: 159.148.60.3
allow-remote-requests: yes
cache-size: 2048KiB
cache-max-ttl: 1w
cache-used: 7KiB
Line servers contain a list of DNS IPs that have been assigned to either IPv4 or IPv6 (by default it is 0.0.0.0), for IP DNS that contains more than one (the example above is only one IP Address only), each IP Address is separated by comma, allow-remote-requests line is a setting to allow (yes) or reject (no) requests from the network (by default it is "no").
The cache-size line contains the size of the DNS cache in units of KiB (Kilo Bytes) ranging from 512 KiB to a maximum of 10240 KiB (10MB, Mega Bytes) by default worth 2048 KiB (2MB, Mega Bytes). The cache-max-ttl line contains the maximum time-to-live time of the cache, by default it is worth 1w (1 week or 1 week), after the TTL period has passed the cache will expire. the cache-used line displays the cache size currently used in KiB (Kilo Bytes).
5. ip firewall address-list add
The command "ip firewall address-list add" allows users to list IP addresses that are grouped together with common names. That way the firewall filter, mangle and NAT facility can then use the address list to match the package with the package at the address in the list.
To make a list of IP addresses, just type the command "ip address-list add firewall" then follow with the IP Address that will be added for example "address = 192.0.34.166 / 32" then follow with the name of the list created for example "list = site_blocked ".
[admin @ MikroTik]> firewall ip address-list add list = Situs_diblock address = 192.0.34.166 / 32
6. ip firewall address-list print
If you have created an address list (address list) and added an IP address to the list as in the steps above, you can see a list of IP addresses on that address list (and on another list of addresses if there are any), just type the command " address-list print ”firewall ip on the console then press Enter.
[admin @ MikroTik]> ip address-list print firewall
Flags: X - disabled, D - dynamic
# LIST ADDRESS
0 site_diblok 192.0.34.166
7. system backup save
The "System Backup Save" command is used to backup (back up) the configuration on the router device, meaning that all configurations that have been set by the user will be backed up into a file, how to backup the router configuration via the console is by typing the command "system backup save" followed by the backup file name that you want to save for example "name = backup-1" then press Enter.
[admin @ MikroTik]> system backup save name = backup-1
Configuration backup saved
With the above command, the configuration will be stored on the disk drive in the form of a file called "backup-1" (with the extension ".backup").
8. backup system load
The "System Backup Load" command is used to restore the saved settings, type the "system backup load" command on the console followed by the backup file name you want to restore for example "name = backup-1" then press Enter. To be able to apply the restore configuration, the router will reboot automatically.
[admin @ MikroTik]> system backup loads name = backup-1
Restore and reboot? [y / N]: y
Restoring system














