Commands For Mikrotik 1
Commands For Mikrotik 1
The console will open in this way and there we will execute our commands.
Press the TAB key twice, we can see the list of main options:
ip address
To see the IPs on our Mikrotik
From this, we rescue the PRINT command, which displays data, lists
settings, in this case the IP settings.
We can see in the command result under the # sign column the numbers that are
are called IDs and are used to identify each entry, next to the '1' we see an 'X' that
It means that this IP is configured but Disabled: Flags: X - disabled, I - invalid,
D - dynamic.
]> ip proxy to configure the proxy, to see the options press the Tab key
pr equal to print
To go back a directory
Setup to make a basic system configuration, configure IP, gateway, among others
others,
System name
Here is the example of system name configuration:
UGEL Acomayo - Acomayo -
Cusco
WPA/2 Security
Here is the example of WPA/2 security configuration:
At each point of the network, security is configured at the link layer WPA and WPA2.
Since TLS certifications are not used for authentication, the eap-method is
configure as passthrough, which means that the process is trusted
identification on the RADIUS server if it exists. Both the unicast data and
broadcast uses the aes-ccm protocol for encryption, which is much more secure than
tkip. The mode in dynamic-
]> log
log>pr to see log
real-time follow log
to exit Ctrl + C
system resource
PPP active
To see the connected pppoe clients
pinging a host
to exit we press Ctrl + C
Example
>user
]user> add
provider
Site Administrator
Mensajes:71
Registered: Sat, Nov 20, 2010, 09:04
System Resets used to delete all the router's configuration. Before doing this,
It can be useful to create a backup file for the configuration.
let's create a backup in our system with the manual of
http://wiki.mikrotik.com/wiki/Configuration_Management_Spanish
[admin@MikroTik] system backup save name=test
Configuration backup saved
[admin@MikroTik] system backup
to see that the backup was made with the name test.backup
[admin@MikroTik] file
[admin@MikroTik] file>pr
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
BASIC CONSOLE COMMANDS GUIDE
Well, as I promised you, a mini guide with the most important commands and combinations.
common for the console.
What importance does it have? For example: our RB died and we cannot access it via Winbox, neither by IP nor
through MAC, then we connect a serial cable and we can gain access via command line
to try to solve the problem, or in a less extreme case we could meet with
a PC with RouterOS and no working port with Windows or Linux where we can run
a Winbox to access its configuration, then we would have to use the console to be able to
do it. It is also good to know that there are commands or options in the console that are not
reflected in the Winbox interface, so to configure them we must use the console for sure.
For this example, we are going to use a program called PuTTY (Open Source, free) that is
available for all operating systems, or at least most of them.
PuTTY functions as a client that connects to a server that can be TELNET or SSH (in
our case). The first is an old service that is still being used to perform
remote connections and obtain a 'virtual' or 'emulated' console in such a way that it would be the same
What typing the data while sitting in front of the PC is that we are connecting. The disadvantage of
this service means that no type of encryption is applied to the transmitted data
security, meaning that any kid who is watching the traffic on our network could see everything
what we entered. To confront this issue, SSH (Secure Shell) emerged, whose objective
it's the same but with advanced encryption techniques, so we can be sure
making a connection of this type. So we are going to use PuTTY for our example and
SSH connections (PuTTY allows you to choose the type of connection you want)
The first time we log in, a message pops up that we click 'Yes'.
Then a window opens with a black background (by default) with a message that says 'login as: '
here where we need to enter the username (It's the same data we use for Winbox),
we confirm with an enter and then we enter a password which will not be displayed in
screen nor the number of characters entered. We confirm again with an enter.
Finally we get our beloved console : )
There it is, waiting for us to enter something... think that the most sophisticated systems and
world complexes such as routers, servers, telephone exchanges, production robots in
series, etc, etc, use a simple command line for their programming.
Now let's go with the most used and necessary commands (we always use lowercase in the
console):
This means that we are at the top level of the tree or the
menu. If the TAB key is pressed twice in a row, we can see the list of main options:
Code:
Code:
ip address print
Flags: X - disabled, I - invalid, D - dynamic
ADDRESS NETWORK BROADCAST INTERFACE
0 10.10.128.128/24 10.10.128.0 10.10.128.255 lan
1 X 192.168.100.120/23 192.168.100.0 192.168.101.255 lan
[admin@Tests] >
From this, we rescue the PRINT command, which displays the data, lists
configurations, in this case the IP configurations.
We can see in the command result under the # sign column the numbers that are
They are called IDs and serve to identify each entry, next to the '1' we see an 'X' which means
saying that this IP is configured but Disabled: Flags: X - disabled, I - invalid, D - dynamic.
Let's assume that now we want to see what the IP menu offers us:
Code:
[admin@Tests] > ip
[admin@Tests] ip>(press TAB twice in a row)
accounting dhcp-client dns hotspot packing route telephony
vrrp
address dhcp-relay export ipsec pool service traffic
flow
arp dhcp-server firewall neighbor proxy socks upnp
[admin@Tests] ip>
So what we get would be what we see when we expand the options we see in Winbox.
When we click the IP button in the menu. Is it making sense?
Now we will enter the proxy configuration:
Code:
[admin@Tests] ip> proxy
[admin@Tests] ip proxy> print
no
0.0.0.0
port: 8080
0.0.0.0:0
cache-drive: (unknown)
webmaster
none
unlimited
no
maximal-client-connections: 1000
maximal-server-connections: 1000
4096KiB
3d
[admin@Tests] ip proxy>
And now let's see what options we have in the proxy menu:
Code:
/
[admin@Tests] >
So with the '/' we go back to the root
Another way:
Code:
admin@Tests] ip proxy> ..
..
[admin@Tests] >
NOTE: We can use the TAB key while typing the name of the menus or options to
complete the word, for example: if we write in the main menu:
Code:
Well, so far we already know how to navigate the menus and list configurations.
Let's now look at the options we have or what we can do with a rule that is already in place.
created:
We use a firewall filter, for that we have to go there:
Code:
[admin@Tests] > ip firewall filter
[admin@Tests] ip firewall filter> print
Flags: X - disabled, I - invalid, D - dynamic
0 chain=input protocol=icmp action=accept
[admin@Tests] ip firewall filter>
There we see the rule with ID 0 that blocks the incoming ping on the input chain.
Let's suppose we want to ask a friend about this rule and he asks us to pass it to him.
code for you to see, then we do the following:
Code:
Code:
/ ip firewall filter
add chain=input protocol=icmp action=accept comment="" disabled=no
The command modifier 'from=' selects 'What to export', in this case
we export the rule with ID 0, the export command alone returns ALL the configuration, which means that
If we have 50 rules, it will be quite an extensive code.
Now our friend tells us that to block ping in the input chain we should change the
value action=accept for action=drop, we would do it like this:
Code:
Code:
set 0 action=drop
We confirm with enter and view the new configuration:
Code:
Code:
print
Flags: X - disabled, I - invalid, D - dynamic
0 chain=input protocol=icmp action=accept
And we edit the ACTION value of rule 0
Code:
Code:
Code:
[admin@Tests] ip firewall filter> set 0 disabled=yes
To enable it:
Code:
Code:
Code:
Perfect, we add edit, set, enable, disable, delete, and move to what has been learned.
rules.
For example, we want to add an IP to an interface that does not have one:
Let's go to IP ADDRESS:
Code:
admin@Tests] ip address>
[admin@Tests] ip address> print
Flags: X - disabled, I - invalid, D - dynamic
ADDRESS NETWORK BROADCAST INTERFACE
[admin@Tests] ip address>
We see that it has no ID, therefore there is nothing configured, we are going to add the IP.
10.10.128.128 with mask 255.255.255.0:
Code:
Let's take a more complex example with some firewall rules, let's assume now that
we need to block TCP port 23 for all hosts except for the network 10.10.128.0/24
in the LAN input interface:
We write add and see all the options we have for a firewall rule, let's go to
use only a few, so:
Code:
Code:
Code:
Code:
Code:
Code:
To ping a host:
Code:
Code:
Code:
With that, you can now set up a RouterOS from the console without any problems, I hope it's helpful.
very useful, anything else you want to know that is not covered ask it here
same. Greetings!
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
Code:
MikroTik v5.18
Login
Hierarchy
In terminal mode (prompt) it allows us to configure the router using text commands.
These commands are set within each selected level. Generally, it is better to
explain with an example:
Normally one enters the ARP table via winbox this way:
but through the console or terminal we can also enter in the same way,
we simply write IP-->ARP-->:
Code:
[admin@MikroTik] >
[admin@MikroTik] >ip
[admin@MikroTik]/ip>arp
[admin@MikroTik]/ip arp>
But you will ask, where is the ARP little box?
Well, that's why this post is called 'general commands', to be able to know which commands are
They can write only we have to type the symbol '?' (question mark)
This symbol will be a very helpful element since if we don't know something while writing, it will tell us.
What options exist at the level we are at.
Code:
admin@MikroTik]/ip arp> ?
Once we have typed that letter, the options will appear.
Code:
[admin@MikroTik]/ip arp>
Address Resolution Protocol is used to map IP address to MAC layer
address. Router has a table of
currently used ARP entries. Normally the table is built dynamically, but to
increase network security, s
c entries can be added.
..-- go up to ip
add-- Create a new item
comment-- Set comment for items
disable-- Disable static ARP entry
edit--
enable-- Enable static ARP entry
Export-- Print or save an export script that can be used to restore
configuration
Find items by value
get-- Gets value of item's property
print-- Print values of item properties
Remove item
set-- Change item properties
[admin@MikroTik]/ip arp>
As you can see, there is an option called print. With this option we can 'print'.
say show in text the ARP table that appeared in winbox
Code:
[admin@MikroTik]/ip arp>print
Flags: X - disabled, I - invalid, H - DHCP, D - dynamic
ADDRESS MAC ADDRESS INTERFACE
0 192.168.1.55 B0:48:7A:AA:67:EFLAN
1 192.168.1.169 00:1D:0F:F7:48:A2 LAN
2 192.168.1.54 B0:48:7A:0F:F7:48LAN
3 192.168.1.71 00:23:CD:F4:EC:D3LAN
4 192.168.1.8 00:11:5B:00:23:CDLAN
192.168.1.198
192.168.1.181
7 192.168.1.180 00:23:CD:D8:94:CF LAN
8 192.168.1.89 D8:94:CF:F7:42:65LAN
9 192.168.1.205 C0:D5:21:F4:EC:D3 LAN
192.168.1.206
192.168.1.182
12 192.168.1.1 00:06:5B:96:DD:FC LAN
13 192.168.1.7 74:EA:3A:FF:38:D9LAN
14 192.168.1.2 F4:EC:D3:C0:D5:21LAN
-- [Q quit|D dump|down]
Well then, let's move forward by explaining some 'shortcuts' (hotkeys) and then explain
the general commands that are associated with Mikrotik
We have reduced the number of commands so we don't get lost, let's first observe the most...
The purpose of this forum is aimed at being able to use Mikrotik with few
knowledge in networks so we hope for your understanding
Shortcut keys
F1 or the letter?
It shows us the help in the context in which it may be working (whether in interfaces or in the area
of the IP, etc.). It is placed after the command to query.
Example:
Code:
[admin@MikroTik] > ?
Key '/'
We use it in two ways, the first to exit a level. Using the previous example, we had
I needed to write three times '..' to go back to the base level, but thanks to the key / it is enough.
with writing it so I can go straight to the point.
Code:
[admin@MikroTik]/ip firewall mangle>/
The other way to use it is by jumping from one level to another level.
Normally we would do this if we want to go from one level to another, (helping ourselves with the letters '..')
Code:
[admin@MikroTik]/ip firewall>mangle
[admin@MikroTik]/ip firewall mangle>..
[admin@MikroTik]/ip firewall>..
[admin@MikroTik]/ip>..
[admin@MikroTik] >
[admin@MikroTik] >interface
[admin@MikroTik]/interface>
[admin@MikroTik]/interface>ethernet
[admin@MikroTik]/interface ethernet>
But thanks to the letter '/', it becomes easier.
Code:
[admin@MikroTik]/ip firewall mangle>/interface ethernet
[admin@MikroTik]/interface ethernet>
The TAB key
This letter will help us complete the syntax in the commands while typing.
word you will see changes from a black color to either a blue, green, or fuchsia color and this is
because Mikrotik recognizes some commands automatically and to avoid typing
we just have to press TAB
It will continue...