Understanding the Basic Commands in Mikrotik OS
MikroTik RouterOS is a versatile and powerful routing software that has gained popularity due to its simplicity, affordability, and extensive features. In this blog post, we will explore some basic commands that every MikroTik user should be familiar with.
Table of Contents
- Connecting to MikroTik RouterOS
- Checking System Information
- Configuring Interfaces
- Setting Up Firewall Rules
- Managing Users and Access
- Saving and Rolling Back Configurations
Connecting to MikroTik RouterOS
Before you can start issuing commands, you need to establish a connection to your MikroTik router. This can be done via the SSH or Winbox protocols using an terminal emulator application such as PuTTY or SecureCRT.
Checking System Information
The /info
command displays a comprehensive system report, including hardware details, operating system version, uptime, and other useful information.
/info
Configuring Interfaces
Interfaces are configured using the /interface
command followed by the interface type and name. For example, to configure an Ethernet interface named "ether1", use:
/interface ethernet add name=ether1
To set the IP address and netmask of the interface, use the following commands:
/ip address-pool add name=my_pool start-address=192.168.0.100 end-address=192.168.0.150
/interface ethernet set ether1 ip-address-pool=my_pool
/interface ethernet set ether1 netmask 255.255.255.0
Setting Up Firewall Rules
Firewall rules can be configured using the /ip firewall filter
command. For example, to create a rule that allows incoming SSH connections on port 22, use:
/ip firewall filter add chain=input comment="Allow SSH" protocol=tcp src-address=0.0.0.0/0 dst-port=22
Managing Users and Access
To create a new user named "admin", set the password to "password123", and grant full access, use:
/user add name=admin password=[hashed-password] level=read-write
/ip firewall filter add chain=input src-address=0.0.0.0/0 action=accept comment="Allow Admin Access" \
protocol=tcp dst-port=80,443 application=http,https user=admin
Saving and Rolling Back Configurations
The MikroTik router can save its configuration to a file using the /system script save
command. To load a saved configuration, use:
/system script load backup_config.rsc
Additionally, you can roll back to a previous configuration by specifying the configuration filename followed by the number of configurations back to go:
/system script rollback backup_config.rsc 3
By learning and mastering these basic commands in MikroTik RouterOS, you will be well on your way to effectively managing your network infrastructure. Stay tuned for future blog posts covering more advanced topics and features.