ROS FirstTimeConfiguration 050823 0704 128
ROS FirstTimeConfiguration 050823 0704 128
More information about the current default configuration can be found in the Quick Guide document that came with your device. The quick guide document
will include information about which ports should be used to connect for the first time and how to plug in your devices.
This document describes how to set up the device from the ground up, so we will ask you to clear away all defaults.
When connecting the first time to the router with the default username admin and no password (for some models, check user password on the sticker), you
will be asked to reset or keep the default configuration (even if the default config has only an IP address). Since this article assumes that there is no
configuration on the router you should remove it by pressing "r" on the keyboard when prompted or click on the "Remove configuration" button in WinBox.
Connect Routers ether1 port to the WAN cable and connect your PC to ether2. Now open WinBox and look for your router in neighbor discovery. See
detailed example in Winbox article.
If you see the router in the list, click on MAC address and click Connect.
The simplest way to make sure you have absolutely clean router is to run
Since MAC connection is not very stable, the first thing we need to do is to set up a router so that IP connectivity is available:
The next step is to set up a DHCP server. We will run the setup command for easy and fast configuration:
[admin@MikroTik] /ip dhcp-server setup [enter]
Select interface to run DHCP server on
Open
Ip -> DHCP Server window, DHCP tab should be selected;
Click on the DHCP Setup button, a new dialog will open, enter DHCP Server
Interface local and click on Next button;
Follow the wizard to complete the setup.
Now connected PC should be able to get a dynamic IP address. Close the Winbox and reconnect to the router using IP address (192.168.88.1)
Dynamic Public IP
Dynamic
address
configuration is
the simplest
one. You just
need to set up
a DHCP client
on the public
interface.
DHCP client
will receive
information
from an
internet service
provider (ISP)
and set up an
IP address,
DNS, NTP
servers, and
default route
for you.
After adding the client you should see the assigned address and status should be bound
Static Public IP
In the case of static address configuration, your ISP gives you parameters, for example:
IP: 1.2.3.100/24
Gateway: 1.2.3.1
DNS: 8.8.8.8
These are three basic parameters that you need to get the internet connection working
To set this in RouterOS we will manually add an IP address, add a default route with a provided gateway, and set up a DNS server
PPPoE Connection
PPPoE connection also gives you a dynamic IP address and can configure dynamically DNS and default gateway. Typically service provider (ISP) gives
you a username and password for the connection
/interface pppoe-client
add disabled=no interface=ether1 user=me password=123 \
add-default-route=yes use-peer-dns=yes
Winbox/Webfig actions:
Further in config
WAN interface is now pppoe-out interface, not ether1.
Verify Connectivity
After successful configuration, you should be able to access the internet from the router.
Verify IP connectivity by pinging known IP address (google DNS server for example)
Minimum 12 characters;
Include numbers, Symbols, Capital and lower case letters;
Is not a Dictionary Word or Combination of Dictionary Words;
/password
We strongly suggest using a second method or Winbox interface to apply a new password for your router, just to keep it safe from other unauthorized
access.
Make sure you remember the password! If you forget it, there is no recovery. You will need to reinstall the router!
You can also add more users with full or limited router access in /user menu
The best practice is to add a new user with a strong password and disable or remove the default admin user.
Note: login to the router with new credentials to check that the username/password is working.
Then, add your previously created bridge named "local" to the interface list:
Winbox/Webfig actions:
Open Interfaces → Interface List → Lists window and add a new list by clicking "+";
Input the interface list name "listBridge" into the Name field and click OK;
Go back to the Interfaces → Interface List section and click "+";
Select "listBridge" from the dropdown List options and select "local" from the dropdown Interf
ace options and click OK;
Open Tools -> Mac Server window;
Click on the "MAC Telnet Server" button, a new dialog will open;
Select the newly created list "listBridge" from the dropdown list and click on OK button to
apply settings.
Do the same in the MAC Winbox Server tab to block Mac Winbox connections from the internet.
Neighbor Discovery
MikroTik Neighbor discovery protocol is used to show and recognize other MikroTik routers in the network. Disable neighbor discovery on public interfaces:
/ip neighbor discovery-settings set discover-interface-list=listBridge
IP Connectivity Access
Besides the fact that the firewall protects your router from unauthorized access from outer networks, it is possible to restrict username access for the
specific IP address
IP connectivity on the public interface must be limited in the firewall. We will accept only ICMP(ping/traceroute), IP Winbox, and ssh access.
In case if a public interface is a pppoe, then the in-interface should be set to "pppoe-out".
The first two rules accept packets from already established connections, so we assume those are OK to not overload the CPU. The third rule drops any
packet which connection tracking thinks is invalid. After that, we set up typical accept rules for specific protocols.
If you are using Winbox/Webfig for configuration, here is an example of how to add an established/related rule:
To add other rules click on + for each new rule and fill the same parameters as provided in the console example.
Administrative Services
Although the firewall protects the router from the public interface, you may still want to disable RouterOS services.
Most of RouterOS administrative tools are configured at the /ip service menu
Change default service ports, this will immediately stop most of the random SSH brute force login attempts:
Other Services
A bandwidth server is used to test throughput between two MikroTik routers. Disable it in the production environment.
A router might have DNS cache enabled, which decreases resolving time for DNS requests from clients to remote servers. In case DNS cache is not
required on your router or another router is used for such purposes, disable it.
It is good practice to disable all unused interfaces on your router, in order to decrease unauthorized access to your router.
/interface print
/interface set x disabled=yes
RouterOS utilizes stronger crypto for SSH, most newer programs use it, to turn on SSH strong crypto:
Following services are disabled by default, nevertheless, it is better to make sure that none of then were enabled accidentally:
NAT Configuration
At this point, PC is not yet able to access the Internet, because locally used addresses are not routable over the Internet. Remote hosts simply do not
know how to correctly reply to your local address.
The solution for this problem is to change the source address for outgoing packets to routers public IP. This can be done with the NAT rule:
In case if a public interface is a pppoe, then the out-interface should be set to "pppoe-out".
Another benefit of such a setup is that NATed clients behind the router are not directly connected to the Internet, that way additional protection against
attacks from outside mostly is not required.
Port Forwarding
Some client devices may need direct access to the internet over specific ports. For example, a client with an IP address 192.168.88.254 must be
accessible by Remote desktop protocol (RDP).
After a quick search on Google, we find out that RDP runs on TCP port 3389. Now we can add a destination NAT rule to redirect RDP to the client's PC.
If you have set up strict firewall rules then RDP protocol must be allowed in the firewall filter forward chain.
Setting up Wireless
For ease of use bridged wireless setup will be made so that your wired hosts are in the same Ethernet broadcast domain as wireless clients.
The important part is to make sure that our wireless is protected, so the first step is the security profile.
Security profiles are configured from /interface wireless security-profiles menu in a terminal.
in Winbox/Webfig click on Wireless to open wireless windows and choose the Security Profile tab.
If
t
h
e
r
e
a
r
e
l
e
g
a
c
y
d
e
v
i
c
e
s
t
h
a
t
d
o not support WPA2 (like Windows XP), you may also want to allow WPA protocol.
/interface wireless
enable wlan1;
set wlan1 band=2ghz-b/g/n channel-width=20/40mhz-Ce distance=indoors \
mode=ap-bridge ssid=MikroTik-006360 wireless-protocol=802.11 \
security-profile=myProfile frequency-mode=regulatory-domain \
set country=latvia antenna-gain=3
Open Wireless window, select wlan1 interface, and click on the enable button;
Double click on the wireless interface to open the configuration dialog;
In the configuration dialog click on the Wireless tab and click the Advanced mode button on
the right side. When you click on the button additional configuration parameters will appear
and the description of the button will change to Simple mode;
Choose parameters as shown in the screenshot, except for the country settings and SSID.
You may want to also choose a different frequency and antenna gain;
Next, click on the HT tab and make sure both chains are selected;
Click on the OK button to apply settings.
Now wireless should be able to connect to your access point, get an IP address, and access the internet.
A ruleset is similar to input chain rules (accept established/related and drop invalid), except the first rule with action=fasttrack-connection. This
rule allows established and related connections to bypass the firewall and significantly reduce CPU usage.
Another difference is the last rule which drops all new connection attempts from the WAN port to our LAN network (unless DstNat is used). Without this
rule, if an attacker knows or guesses your local subnet, he/she can establish connections directly to local hosts and cause a security threat.
For more detailed examples on how to build firewalls will be discussed in the firewall section, or check directly Building Your First Firewall article.
First, we need to add a NAT rule to redirect HTTP to our proxy. We will use RouterOS built-in proxy server running on port 8080.
Using Winbox:
In the "Web Proxy Access" dialog click on "+" to add a new Web-proxy rule
Enter Dst hostname that you want to block, in this case, "www.facebook.com", choose the
action "deny"
Then click on the "Ok" button to apply changes.
Repeat the same to add other rules.
Troubleshooting
RouterOS has built-in various troubleshooting tools, like ping, traceroute, torch, packet sniffer, bandwidth test, etc.
We already used the ping tool in this article to verify internet connectivity.
m your computer
If you are not sure how exactly configure your gateway device, please reach MikroTik's official consultants for configuration support.