Securing your router: Difference between revisions

From MikroTik Wiki
Jump to navigation Jump to search
Rieks (talk | contribs)
No edit summary
 
Rieks (talk | contribs)
No edit summary
Line 2: Line 2:


== Change admin's password ==
== Change admin's password ==
Just select the Password menu within the winbox GUI or type the following command in the CLI:
[admin@MikroTik] > / password
old password:
new password: ******
retype new password: ******
This will change your current admin's password to what you have entered twice. Note, that if you forget the password, there is no recovery. You need to reinstall the router!


== Set up packet filtering ==
== Set up packet filtering ==
Line 28: Line 37:


You may need to include additional rules to allow access from certain hosts, etc. Remember that firewall rules are processed in the order they appear on the list! After a rule matches the packet, no more rules are processed for it. After adding new rules, move them up using the '''move''' command.
You may need to include additional rules to allow access from certain hosts, etc. Remember that firewall rules are processed in the order they appear on the list! After a rule matches the packet, no more rules are processed for it. After adding new rules, move them up using the '''move''' command.
Note, if you mis-configured the firewall and have locked yourselves out from the router, you may use '''MAC telnet''' from another router or workstation on the same LAN to connect to your router and correct the problem.

Revision as of 15:35, 18 December 2005

To protect your MikroTik RouterOS™, you should do following things:

Change admin's password

Just select the Password menu within the winbox GUI or type the following command in the CLI:

[admin@MikroTik] > / password 
old password: 
new password: ******
retype new password: ******

This will change your current admin's password to what you have entered twice. Note, that if you forget the password, there is no recovery. You need to reinstall the router!

Set up packet filtering

All packets with destination to the router are processed against the ip firewall filter's input chain. Note, that the input chain does not affect packets which are being transferred through the router!

You can add following rules to the input chain under /ip firewall filter (just 'copy and paste' to the router using Terminal Console or configure the relevant arguments in WinBox):

/ ip firewall filter
add chain=input connection-state=established comment="Accept established connections"
add chain=input connection-state=related comment="Accept related connections"
add chain=input connection-state=invalid action=drop comment="Drop invalid connections" 
add chain=input protocol=udp action=accept comment="UDP" disabled=no 
add chain=input protocol=icmp limit=50/5s,2 comment="Allow limited pings" 
add chain=input protocol=icmp action=drop comment="Drop excess pings" 
add chain=input protocol=tcp dst-port=22 comment="SSH for secure shell"
add chain=input protocol=tcp dst-port=8291 comment="winbox" 
# Edit these rules to reflect your actual IP addresses! # 
add chain=input src-address=159.148.172.192/28 comment="From Mikrotikls network" 
add chain=input src-address=10.0.0.0/8 comment="From our private LAN"
# End of Edit #
add chain=input action=log log-prefix="DROP INPUT" comment="Log everything else"
add chain=input action=drop comment="Drop everything else"

Use /ip firewall filter print input stats command to see how many packets have been processed against these rules. Use reset-counters-all command to reset the counters. Examine the system log file /log print to see the packets which have been dropped.

You may need to include additional rules to allow access from certain hosts, etc. Remember that firewall rules are processed in the order they appear on the list! After a rule matches the packet, no more rules are processed for it. After adding new rules, move them up using the move command.

Note, if you mis-configured the firewall and have locked yourselves out from the router, you may use MAC telnet from another router or workstation on the same LAN to connect to your router and correct the problem.