Basic RouterOS Commands
RouterOS, the operating system used by MikroTik devices, offers a wide range of commands to manage and secure your network. Understanding these basic commands is essential for anyone aspiring to become a MikroTik Certified Security Engineer (MTCSE). This page will cover three fundamental commands: /ip address, /ip firewall filter, and /system reboot.
/ip address
The /ip address command is used to configure IP addresses on interfaces. This is crucial for enabling communication between devices on the network.
To add an IP address to an interface, you would use the following command:
/ip address add address=192.168.1.1/24 interface=ether1
This command assigns the IP address 192.168.1.1 with a subnet mask of 255.255.255.0 to the interface named "ether1".
Think of this command as labeling a door with an address so that mail (network traffic) can be delivered to the correct location.
/ip firewall filter
The /ip firewall filter command is used to create firewall rules that control incoming and outgoing traffic. This is essential for securing your network by allowing or denying specific types of traffic.
To create a rule that blocks all incoming traffic except SSH (port 22), you would use the following command:
/ip firewall filter add chain=input action=drop protocol=tcp dst-port=!22
This command adds a rule to the input chain that drops all TCP traffic except for those destined for port 22 (SSH).
Imagine this command as a bouncer at a club who only allows certain people (traffic) to enter based on specific criteria (port number).
/system reboot
The /system reboot command is used to restart the RouterOS device. This can be necessary to apply new configurations or resolve issues.
To reboot the device, you would simply use:
/system reboot
This command initiates a restart of the RouterOS system, similar to turning off and then back on a computer.
Think of this command as the reset button on a toy that restores it to its default state, ready for new configurations or to fix any malfunctions.
By mastering these basic RouterOS commands, you will be well-equipped to manage and secure your network effectively.