Showing posts with label Mikrotik. Show all posts
Showing posts with label Mikrotik. Show all posts

Mar 13, 2013

Basic MikroTik RouterOS Configuration using winbox

This article ex"plains' ho\"w to c\'onfigure a Mikrotik device straight out of the box. It goes through the Winbox configuratoin utility and some of the basic setup procedures to turn your MikroTik device into a home or office wireless and wired router. In this tutorial we will go through a step by step guide to make it as simple as possible to learn and implement these setting s on your own routers.

Completed
  • Downloading and running winbox
  • Winbox in more detail including configuration files
  • Setting an identity on the router
  • Setting an IP address on the router
  • Setting a password
Coming soon...
  • Setting up dhcp client
  • Setting up a dhcp server on a bridge
  • Setting up a nat (Network Address Translation)
  • Securing services on the router
  • Setting up the wireless Access Point
  • Implementing a basic firewall for security

Downloading and running Winbox


Winbox is the graphical configuration utility for MikroTik RouterOS. It is a small application that can be downloaded from the MikroTik website at htttp://www.mikrotik.com Once you download winbox it can be run straight away, as no installation is required. It does however when running, setup a number of folders in your application data folder in order to save login data and plugins. This is transparent to the user but worthwhile to be aware, in order to diagnose problems and also understand the security implications of saving sensitive login information in the utility.

Winbox in more detail - including configuration files

Setting an identy on the router

1. Go to http://www.mikrotik.com/download.html and download the latest Winbox Configuration Tool under the Tools and Utilities section to you desktop.
2. Double click on the Winbox icon on your desktop.

3. Click on System menu item then on the Identy sub menu as in the image below.


4. The Identity dialog will open as in image below. Remove the default "Mikrotik" value and replace it with something meaning full. Usually the location of the router combiened with its purpose acts as a suitable Identity for your router.

To configure your router
Click IP >> Addresses on the left menu in winbox as in diagram below.
Winbox IP address

This will open the Address list dialog window as seen below. Click on the red plus button to open the add IP address window.
winbox IP address List Dialog

When the New IP address dialog opens enter the address details select an interface to set the adress on and press apply and OK button.
Winbox new ip address dialog
For information on what IP settings to use please see a basic tutorial in IP Networking. But just to explain one or two points about this dialog...
It is best to delete an address entirely instead of editing it, as I found that it a cleaner way of editing an address as to modify network or broadcast options can sometimes not apply 100% properly.
You have an option of entering the network and broadcast address explicitly in the boxes provided or is you prefer you can use the short slash notation and press the apply button, this will populate the broadcast and network boxes with the correct settings.


This tutorial demonistrates how to set the password of the current Mikrotik Winbox user.
Click on the menu item as shown below
System >> Password
winbox change a password menu item

This will open the password dialog box as shown below.
Mikroitk winbox Set Password dialog box
Enter the old or current password followed by the new password that you wish to use.
If this is your first time logging into the router or the router is on factory settings the Old password box should be just left blank. As the default username and password is admin and no password.

Note:
This is how you set the password of the current Winbox user. To change other users you must go to system >> users menu item open that dialog and set the password for that particular user. You must have adequate user privileges to perform this action.


 

How to configure a home router

The CLI

Winbox is a fantastic program. It is extremely powerful, and is a very quick way to edit or monitor RouterOS routers. It is, however, also a fairly poor tool for sharing configuration across the Internet. You can take screenshots, but screenshots are large files and might not display right. Depending on where they are hosted they might not stay around for very long as the file host takes them down. Most importantly there simply isn't enough space in most Winbox dialogs to show all the relevant information in one small area. Firewall rules in Winbox, for example, consist of many tabs. To adequately show all properties of a rule - when troubleshooting it, for example - you'd have to share one screenshot for each tab. CLI output, on the other hand, shows all that information in just one line. Text is also universal - everything can display text. You can also copy and paste text, which means it's much easier to apply a firewall rule that someone gave you as a CLI command than it is to click through all the tabs in Winbox and set all the fields accordingly.
The CLI may initially seem somewhat daunting but actuallt organized very well. There are only 9 different commands that really are important for basic configuration tasks.

Structure

The RouterOS CLI mirrors the GUI (or rather, the GUI mirrors the CLI). The configuration is divided into menu structures, several levels deep. For example, IP services are configured under "/ip" with subsections for the specific related tasks: ARP is configured under "/ip arp", the firewall is configured under "/ip firewall", and so on.
All commands can be prefaced with an absolute or relative reference to the context in which the command is to be executed. If no context is given, the current context is used. Below three examples:
[admin@Example-Router] /ip address> print
This "print" command will be executed in the "/ip address" context, and will therefore print all configured IP addresses.
[admin@Example-Router] /ip address> /ip arp print
This "print" command is prefaced with an absolute context of "/ip arp" and will be executed in that context, and will therefore print all ARP entries the router knows about.
[admin@Example-Router] /ip address> .. arp print
This "print" command is prefaced with a relative context of ".. arp". The current context is "/ip address", ".." goes one level up to "/ip", and "arp" goes into "/ip arp". Therefore the command will print all ARP entries the router knows about.
The <tab> key triggers auto completion, if the current word cannot be auto completed because several possibilities exist pressing <tab> a second time shows all possible completions. '?' shows help for existing options at the current position of the command.
Commands are syntax highlighted - command words are pink, items are cyan, and parameter names are green. When syntax highlighting stops the OS cannot parse the command, and the command will not execute properly.
Commands can be abbreviated when they are unambiguous. For example, "/ip address add address=1.1.1.2/24 interface=WAN" can - at an extreme - be abbreviated as "/ip ad a a=1.1.1/24 i=WAN".
Parameters are passed as key/value pairs separated by '=' signs. In the example above the address parameter is set to 1.1.1.2/24, and the interface parameter is set to the interface named "WAN".
There are two different types of configuration: one simply exists and has parameters set on it (e.g., the internal DNS server can be turned on or off), others are items added to a section as instances in a list of items in the same context (e.g., VLAN interfaces that can be freely created, or IP addresses assigned to interfaces).
For purposes of displaying commands it is possible to split one very long line over several lines. This is indicated by a backslash at the end of a line - the next line continues that line. Here an example:
[admin@Example-Router] > /ip address add \
   interface=outside \
   address=1.1.1.2/30
This is used in this tutorial to wrap long configuration commands.

Basic commands

The same basic commands are used to configure all aspects of the OS. Commands exist to look at configuration, to add configuration, to remove configuration, and to edit existing configuration.

print

The "print" command prints configuration items in the current context. It has several qualifiers that can be used to change what information is output, and how it is formatted. The most important qualifier is "print detail". "print detail"'" shows all properties of an item, ensures that everything gets printed ("print" by default shows everything neatly organized into rows and columns of a table, but may truncate strings to make them all fit on the screen), and outputs everything as neat key/value pairs. This is especially valuable when sharing information on the forums when asking for help.
[admin@Example-Router] > /ip arp print
Flags: X - disabled, I - invalid, H - DHCP, D - dynamic
 #   ADDRESS         MAC-ADDRESS       INTERFACE
 0 D 1.1.1.2         00:0B:BF:93:68:1B outside
[admin@Example-Router] >

[admin@Example-Router] > /ip arp print detail
Flags: X - disabled, I - invalid, H - DHCP, D - dynamic
 0 D address=1.1.1.2 mac-address=00:0B:BF:93:68:1B interface=outside
[admin@Example-Router] >
The print command in its first column returns an item number. In subsequent commands the item number can be used to refer to that item.

export

The "export" command prints the configuration applied in a format that can be copied and pasted to duplicate the same configuration on another router. The "export" command will return the configuration of the current section, and all child sections. For example, the "/ip firewall" context has child contexts for NAT and filters. "/ip firewall export" would return those child section configurations as well.

remove

The "remove" command deletes an item from a list of configuration items. It refers to an item number, or the result of a "find" command.
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2   10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] > /ip address remove 2
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
[admin@Example-Router] >

add

The "add" command adds an item to a list of configuration items. It will ask for all parameters that are required but not specified.
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
[admin@Example-Router] > /ip address add address=10.2.0.1/24 interface=dmz
[admin@Example-Router] > /ip address print                                      
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2   10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] >

set

The "set" command edits parameters of an existing item.
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2   10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] > /ip address set 2 interface=inside
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2   10.2.0.1/24        10.2.0.0        10.2.0.255      inside
[admin@Example-Router] > /ip address set 2 interface=dmz
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2   10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] >

disable

The "disable" command disables a configuration item rendering it inoperative, but leaving it in the configuration.
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2   10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] > /ip address disable 2
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2 X 10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] >

enable

The "enable" command enables a previously disabled item.
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2 X 10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] > /ip address enable 2
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2   10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] >

find

The "find" command returns a set of items that can then be acted on by other commands. When "find" is executed without any parameters, it returns all items. When "find" is executed with parameters only items that match the parameters are returned. The most common matcher is "=" to exactly match a parameter value, it is also possible to match regular expressions with the "~" operator.
The below enables all IP addresses that exist:
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2 X 10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] > /ip address enable [/ip address find]
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2   10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] >
The below disables all IP addresses that are on interface "dmz":
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2   10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] > /ip address disable [/ip address find interface=dmz]
[admin@Example-Router] > /ip address print                                      
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2 X 10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] >
The below enables all IP addresses that are on interfaces that start with the letter "d":
[admin@Example-Router] > /ip address print                                      
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2 X 10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] > /ip address enable [/ip address find interface~"^d"]
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2   10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] >

move

The "move" command moves items in ordered lists where order is important for flow of execution. Order is especially important for rules in the IP firewall filter, mangle, and NAT facilities. Items can be moved by referring to the ID of the item that is being moved, and the ID of the item the rule should be moved to. The below moves rule number 3 into the place of rule number 0, and all other rules shift down. The firewall rules shown are non-sensical and only for demonstration of the "move" command:
[admin@Example-Router] > /ip firewall mangle print where action="mark-routing"
Flags: X - disabled, I - invalid, D - dynamic
 0   chain=prerouting action=mark-routing new-routing-mark="mark-a"
 1   chain=prerouting action=mark-routing new-routing-mark="mark-b"
 2   chain=prerouting action=mark-routing new-routing-mark="mark-c"
 3   chain=prerouting action=mark-routing new-routing-mark="mark-d"
[admin@Example-Router] > /ip firewall mangle move 3 0
[admin@Example-Router] >
[admin@Example-Router] > /ip firewall mangle print where action="mark-routing"
Flags: X - disabled, I - invalid, D - dynamic
 0   chain=prerouting action=mark-routing new-routing-mark="mark-d"
 1   chain=prerouting action=mark-routing new-routing-mark="mark-a"
 2   chain=prerouting action=mark-routing new-routing-mark="mark-b"
 3   chain=prerouting action=mark-routing new-routing-mark="mark-c"
[admin@Example-Router] >

Context

Contexts can also be set for a set of commands by enclosing a set in braces, saving keystrokes. The below enables all IP addresses:
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2 X 10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] > /ip address { enable [find] };
[admin@Example-Router] > /ip address print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
 2   10.2.0.1/24        10.2.0.0        10.2.0.255      dmz
[admin@Example-Router] >

Example network

This tutorial uses an example network to explain configuration. The router has a public IP address of 1.1.1.2/30 with a default gateway of 1.1.1.1, and port 'ether1' (later renamed to 'outside') is used to connect to the ISP. Port 'ether2' (later renamed to 'dmz') is a network that is a true DMZ, this network uses IP address 10.2.0.1/24. Ports 'ether3' through 'ether5' are switched together and all are available for use on the LAN network, later renamed to 'inside'. This network uses 10.1.0.1/24.
Other SoHo routers refer to unconditional port forwarding to a LAN machine as a DMZ. In more advanced networks DMZ refers to a third network other than WAN and LAN, where hosts run services accessible to the Internet at large. Running this in a different network further protects the LAN network: hosts in the DMZ are exposed to the Internet and may be under attach. If breached this doesn't gain the attached access to the LAN network as a firewall doesn't permit DMZ hosts to establish new connections to the LAN.
How-to-configure-a-home-router-diagram.png

Router interfaces (ports)

Physical interfaces

Different router models have different sets of physical interfaces. RB1000s have a total of 4 1000Base-TX ports. RB1100s have 10 1000Base-TX ports (2 groups of 5 ports with a 1Gbps pipe to the CPU per group, each group has a switch chip for wire speed layer 2 throughput), and 3 100Base-TX ports. RB750Gs have 5 total 1000Base-TX ports with a switch chip for wire speed layer 2 throughput. routerboard.com has all the data sheets and specs.

Switch Chip

Some routers have a built in switch chip that can be activated on physical interfaces to permit wire speed throughput between those interfaces. Those interfaces will essentially act like a switch would. By default this is enabled in the SoHo models. While more advanced configuration is possible most small networks simply need to activate or deactivate the feature. Within the switch chips interfaces are either master ports or slave ports. The master port is where all the router configuration happens (such as the IP address), and the slave ports refer to the master port. The below configures interfaces ether3, ether4, and ether5 as slaves to interface ether2:
/interface ethernet
set [find name=ether3] master-port=ether2
set [find name=ether4] master-port=ether2
set [find name=ether5] master-port=ether2
The switch chip is capable for small networks, but can't do advanced VLAN configurations.

Bridging vs routing

Bridging (which is what switches do) is something that switches do a lot better than routers. This is just a personal opinion, but whenever I find myself thinking that I should bridge wired interfaces I almost always end up using a switch instead. One counterexample are wireless interfaces, which are commonly bridged into wired networks.

Named interfaces

All configuration of interfaces in RouterOS is done against the name of an interface. Names can be arbitrarily set.
It is good practice to make the names informative. A good name for the interface used to connect to the Internet is 'outside' or 'WAN', a good name for the the interface used to connect to inside customers or your home network is 'inside' or 'LAN'. When using the switch chip the names for the slaved interfaces are unimportant in all but fairly advanced configurations since any router configuration will be limited to the master port. It can still make good sense to name the interfaces after what they connect to.

Example network

In our example network we want ether1 to be named 'outside', ether2 to be named 'dmz', and ether3 - ether5 to be switched with an interface name of 'inside'.
/interface ethernet
set [find name=ether1] name=outside
set [find name=ether2] name=dmz
set [find name=ether3] name=inside
set [find name=ether4] name=inside-slave master-port=inside
set [find name=ether5] name=inside-slave2 master-port=inside

IP addresses

Each interface can carry one or more IP addresses on it. Usually only one IP address per interface is defined. While viewing IP addresses shows parameters for the network and broadcast address of the network, these should usually not be defined manually and will automatically be added when left out. When adding the IP address the subnet mask is given in CIDR notation.
[admin@Example-Router] /ip address> print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
[admin@Example-Router] /ip address> add address=1.1.1.2/29 interface=outside
[admin@Example-Router] /ip address> print
Flags: X - disabled, I - invalid, D - dynamic
 #   ADDRESS            NETWORK         BROADCAST       INTERFACE
 0   10.1.0.1/24        10.1.0.0        10.1.0.255      inside
 1   1.1.1.2/29         1.1.1.0         1.1.1.7         outside
[admin@Example-Router] /ip address>

DHCP client

In many small environments the router will receive a dynamic IP address via DHCP on its WAN interface from the ISP. The DHCP client can also be used to populate the routing table with a default route via the ISP, and pull in DNS servers for the router - and the networks behind it - to use. The DHCP client must be given an interface to run on, as well as whether to listen to the DHCP options for DNS and a default route.
/ip dhcp-client
add interface=outside add-default-route=yes use-peer-dns=yes

PPPoE client

The other common method for SoHo routers to receive a public IP address is via PPPoE, which is used in DSL connections. Most DSL modems can be set into a bridge mode where the modem performs the translation between the DSL network and regular Ethernet, the router then becomes the PPPoE client and directly talks to the ISP network through the modem. PPPoE assigns an IP address to the interface the PPPoE client is running on, and can also be used to learn about a default route as well as DNS servers. It is very important to note that the PPPoE client creates a new logical interface (in the example below it is named 'pppoe-WAN') which now becomes the interface to refer to for WAN traffic. The 'outside' interface will only be used for the PPPoE encapsulated traffic, as far as the router is concerned IP traffic will be leaving the router via the PPPoE client interface.
/interface pppoe-client
add name=pppoe-WAN interface=outside add-default-route=yes use-peer-dns=yes

Example network

In our example network we want the 'outside' interface to have a static IP address of 1.1.1.2/29, the 'dmz' interface to have a static IP address of 10.2.0.1/24, and the 'inside' interface to ave a static IP address of 10.1.0.1/24.
/ip address
add address=1.1.1.2/29 interface=outside
add address=10.2.0.1/24 interface=dmz
add address=10.1.0.1/24 interface=inside

IP routes

Just like on other routing platforms dynamic connected routes are created for all networks that the router has IP addresses to - after all, if the router has an IP address in the 10.1.0.1/24 network on the "inside" interface then it can reach hosts on that network via that interface. Static routes can be added by defining a destination address and a gateway. Usually at least one static route is required: a default route for the router pointing out to the ISP network. RouterOS can of course also run dynamic routing protocols such as RIP, OSPF, and BGP, but that is outside the scope of this article.
[admin@Example-Router] > /ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 ADC  10.1.0.0/24        10.1.0.1        inside             0
 1 ADC  1.1.1.0/29         1.1.1.2         outside            0
[admin@Example-Router] >
While RouterOS will let you configure an IP address within the smae network on two different routed interfaces it would be very bad to do so. The router now would think that it can reach the hosts within that network via either interface, which is unlikely to be the case.

Adding a default route

New static routes can be added as per below. The example shows adding a default route (a route for destination 0.0.0.0/0) via the ISP gateway 1.1.1.1:
[admin@Example-Router] > /ip route add dst-address=0.0.0.0/0 gateway=1.1.1.1
[admin@Example-Router] > /ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 A S  0.0.0.0/0                          1.1.1.1            1
 1 ADC  10.1.0.0/24        10.1.0.1        inside             0
 2 ADC  1.1.1.0/29         1.1.1.2         outside            0
[admin@Example-Router] >
It is interesting to note that technically two routes are now involved for traffic to the Internet: the router looks at the packet and finds that the default route matches, and that it should send traffic via 1.1.1.1. It then needs to figure out how to send traffic to 1.1.1.1, looks at its routing table again, and finds that it can get to 1.1.1.1 via the "outside" interface via the directly connected route for that network.
Also note that it is not necessary or recommended to add a static default route if your router receives its WAN IP address via DHCP or PPPoE. Static default routes should only be used when the public IP address on the WAN interface is also static.

Example network

In our example network we want the router to use 1.1.1.1 as a default gateway:
/ip route
add dst-address=0.0.0.0/0 gateway=1.1.1.1

DHCP server

DHCP server services consist of three components: the IP pool that defines the range of IP addresses clients can receive a lease for, the DHCP server network that defines the parameters clients are passed (such as gateway IP address and DNS servers), and the DHCP server instance itself that ties a pool to an interface.

IP Pools

IP pools define the range of IP addresses available for users to obtain as a DHCP lease. Any IP address in a subnet not covered by the pool range is available for static use.
IP pools simply consist of a name that they can be referred to by, as well as a range of IP addresses. The OS will let you set a range that is out of the bounds of the subnet of the network users will actually be on, leading to IP addresses unable to reach their default gateway. Be careful when adjusting ranges to check that the range chosen is actually covered by the IP network configured on the interface.
To add a pool:
[admin@Example-Router] /ip pool> export
/ip pool
add name=DHCP-Pool-inside ranges=10.1.0.10-10.1.0.100
[admin@Example-Router] /ip pool>
To edit a pool:
[admin@Example-Router] /ip pool> print                                           
# NAME               RANGES
 0 DHCP-Pool-inside  10.1.0.10-10.1.0.100
[admin@Example-Router] /ip pool> set [find name="DHCP-Pool-inside"] ranges=10.1.0.100-10.1.0.200
[admin@Example-Router] /ip pool> print
# NAME               RANGES
 0 DHCP-Pool-inside  10.1.0.100-10.1.0.200
[admin@Example-Router] /ip pool>

DHCP Server Networks

DHCP server networks define parameters (DHCP options) to pass on to DHCP clients. The minimum set of options include the default gateway and name servers. The default gateway is usually the IP address of the router on the network interface, and the name servers usually is as well - at least as long as the router is configured as a DNS caching resolver. That is covered in a different section of this document.
To add a DHCP server network:
[admin@Example-Router] /ip dhcp-server network> export
/ip dhcp-server network
add address=10.1.0.0/24 comment=inside dns-server=10.1.0.1 gateway=10.1.0.1
[admin@Example-Router] /ip dhcp-server network>
Note that multiple DNS servers are specified as a comma separated list without spaces.
To edit a DHCP server network:
[admin@Example-Router] /ip dhcp-server network> print
 # ADDRESS            GATEWAY         DNS-SERVER      WINS-SERVER     DOMAIN
 0 ;;; inside
   10.1.0.0/24        10.1.0.1        10.1.0.1
[admin@Example-Router] /ip dhcp-server network> set [find comment="inside"] dns-server=8.8.8.8
[admin@Example-Router] /ip dhcp-server network> print
 # ADDRESS            GATEWAY         DNS-SERVER      WINS-SERVER     DOMAIN
 0 ;;; inside
   10.1.0.0/24        10.1.0.1        8.8.8.8
[admin@Example-Router] /ip dhcp-server network>

DHCP Servers

DHCP server instances cause the DHCP server process in the router to listen for client requests on the specified interfaces. Each interface that is to offer DHCP to clients must have a dedicated DHCP server instance. The instance sets basic parameters such as whether the server is authoritative and the client lease time, and ties IP pools to interfaces.
To add a DHCP server instance:
[admin@Example-Router] /ip dhcp-server> export
/ip dhcp-server
add address-pool=DHCP-Pool-inside authoritative=yes bootp-support=static \
   disabled=no interface=inside lease-time=3h name=DHCP-inside
[admin@Example-Router] /ip dhcp-server>
To edit a DHCP server instance:
[admin@Example-Router] /ip dhcp-server> print
Flags: X - disabled, I - invalid
 #   NAME     INTERFACE     RELAY           ADDRESS-POOL     LEASE-TIME ADD-ARP
 0   DHCP-... inside                        DHCP-Pool-Ins... 3h
[admin@Example-Router] /ip dhcp-server> set [find interface=inside] lease-time=1h
[admin@Example-Router] /ip dhcp-server> print
Flags: X - disabled, I - invalid
 #   NAME     INTERFACE     RELAY           ADDRESS-POOL     LEASE-TIME ADD-ARP
 0   DHCP-... inside                        DHCP-Pool-Ins... 1h
[admin@Example-Router] /ip dhcp-server>

Lease time considerations

The below usually isn't really very important for home networks, but can become worth considering for routers that serve constantly changing clients.
Client's renew their DHCP lease after half the lease time interval has passed. It is generally better to create larger networks so that stale leases for clients no longer attached don't eat up all available IP addresses on the netowrk, and set long lease times.
By way of example, if a network has 1,200 users attached to it and a DHCP lease time of just 10 minutes each user will send lease renewal requests to the DHCP server on the router every 5 minutes. On average the DHCP server would see (1,200 users / 300 seconds) = 4 DHCP requests per second. With a lease time set to 2 hours the DHCP server would only see (1,200 users / 3600 seconds) = one DHCP request every 3 seconds, which leaves more router resources available to route packets, rate limit users, or do whatever else the router is configured to do. Private IP address space is free, it is better to optimize for router utilization than for IP address conservation.

The wizard

The above explained how DHCP servers work internally. Alternatively you can simply let the router create all the configuration items for you by running "/ip dhcp-server setup" and answering the interactive prompts, many of which will have pre-filled values that you can accept.

Example network

In our example network we want the router to act as a DHCP server for the 'inside' network on 10.1.0.0/24. The pool of DHCP leases is to be 10.1.0.200-10.1.0.254. The router will act as the default gateway for the DHCP clients, and will also act as the DNS server.
/ip pool
add name=DHCP-Pool-inside ranges=10.1.0.200-10.1.0.254
/ip dhcp-server network
add address=10.1.0.0/24 comment=inside dns-server=10.1.0.1 gateway=10.1.0.1
/ip dhcp-server
add address-pool=DHCP-Pool-inside authoritative=yes bootp-support=static \
   disabled=no interface=inside lease-time=3h name=DHCP-inside

IP firewall

The IP firewall is responsible for filtering packets (accepting or dropping them), as well as changing their properties. Three facilities exist: filter, mangle, and NAT. Only filter and NAT are discussed here.

Filters

Filters are used to drop or accept packets going through the router or going to the router. All packets that the router sees will traverse a series of chains. The default action - i.e., the action that is taken if the packet doesn't match any of the rules in a chain - is to accept the packet. This is called a 'default permit' firewall. 'Default permit' firewalls are related to the concept of blacklisting, which refers to the practice of explicitly identifying all things that are bad and accepting everything else as implicitly good. Blacklisting is generally not a very good or secure approach as it is very easy to forget to define a known bad thing. Additionally new bad things are continuously being developed. A more secure approach is whitelisting in 'default deny' firewall: first everything that is known to be good is permitted, and then everything else is denied. Because the RouterOS firewall filters are 'default permit' we will have to explicitly drop everything we didn't explicitly permit before.

Chains

The mangle and filter facilities have 5 built in chains:
  • prerouting
  • input
  • forward
  • output
  • postrouting
It is also possible to define custom chains and jump into them. That approach is very useful when the same actions should be applied to packets identified in different rules. However, custom chains are outside the scope of this article.
All packets being sent to the router always traverse the 'prerouting' chain. At the end of 'prerouting' the router determines whether a packet is destined to the router itself (for example a packet that is part of a Winbox connection going from the management host to the router), or whether the packet should be sent out another interface. Packets to the router itself will then traverse the 'input' chain. Packets that will go through the router will traverse the 'forward' chain. Packets to the router itself will never be in the 'forward' chain, and packets through the router will never be in the 'input' chain. Packets that are generated by the router itself (for example a packet that is part of a Winbox connection going from the router to the managment station) will traverse the 'output' chain. Both packets through the router as well as packets from the router will then traverse the 'postrouting' chain.
Though somewhat complicated, realistically only two chains are important for simple SoHo routers: the router itself is secured in the 'input' chain, and the hosts on networks behind the router are secured in the 'forward' chain.
To learn about all the details of chains and how packets move through the firewall refer to the single best page on the wiki: the Packet Flow page. While daunting at first it becomes easier to decipher the more time you spend with RouterOS, and answers most questions about where and when to do something.

State

Like other advanced firewall platforms RouterOS can keep state of connections by tracking them. That means that it knows what connection a packet belongs to, and can make decisions on the packet based on how other packets in the connection have been treated. This is very useful in that it allows a firewall approach where the only decisions being made are which connections can be established in the first place. All packets in connections that were allowed to be established are then simply permitted, and all other packets are dropped.
There are three connection states: 'established' means the packet is part of an already established connection, 'related' means that the packet is part of a connection that is related to an already established conncetion. The canonical example here is FTP, which has both a data and a control channel: first a control channel is established, which then negotiates the details of the data channel that will actually transfer files. By inspecting the control channel the router can learn about the dynamically negotiated data channel. And 'invalid' means that the packet is part of a connection that the router doesn't know anything about.

Example network

In our example network we want the router to permit devices on the 'inside' network to establish connections to the Internet behind the 'outside' interface, as well as to the web server in the DMZ. The web server is allowed to establish connections to the Internet behind the 'outside' interface, but can not establish connections to the 'inside' network. The Internet can establish HTTP and HTTPS connections to the web server in the DMZ, but cannot establish any other connections to local devices.
The router itself can only be managed from the 'inside' network - devices on the Internet or in the DMZ cannot establish any management connections to the router at all.
Those policies are all implement via connection state. The rules are surpsingly readadble in English:
/ip firewall filter
add chain=input connection-state=established action=accept
add chain=input connection-state=related action=accept
add chain=input connection-state=invalid action=drop
add chain=input in-interface=inside action=accept
add chain=input action=drop
First all packets in established and related connections are permitted. Then all invalid packets are dropped. Then packets coming in via the 'inside' interface are permitted - this allows hosts on the 'inside' network to establish connections to the router. Finally any packets that don't match those rules are dropped.
/ip firewall filter
add chain=forward connection-state=established action=accept
add chain=forward connection-state=related action=accept
add chain=forward connection-state=invalid action=drop
add chain=forward in-interface=inside action=accept
add chain=forward in-interface=dmz out-interface=outside action=accept
add chain=forward dst-address=10.2.0.10 protocol=tcp dst-port=80,443 action=accept
add chain=forward action=drop
First all packets in established and related connections are permitted. Then all invalid packets are dropped. Then packets coming in via the 'inside' interface are permitted - this allows hosts on the 'inside' network to establish connections to anywhere, including the Internet and the DMZ. Then any packets coming in via the 'dmz' interface are permitted as long as the router is going to send them out the 'outside' interface - this allows the DMZ hosts to access the Internet, but keeps them out of the 'inside' network. Then connections to 10.2.0.10 (the web server IP) on tcp/80 and tcp/443 are permitted - this allows the Internet to connect to the web server. Finally any packets that don't match those rules are dropped.

NAT

NAT refers to changing IP addresses in IP packet headers. This is often a requirement when private IP addresses from the RFC1918 range are used on a network: private IP addresses cannot be routed across the Internet, so the router has to subsitute its own public IP address in their places. There are two types of NAT: destination NAT changes the IP address in the destination header field, and source NAT changes the IP address in the source header field. They are processed in the 'srcnat' and 'dstnat' chains of the NAT facility. NAT requires connection tracking, and NAT is only evaluated for the first packet in a connection. All other packets in the same connection will then have the same action as the first packet applied to them, for the lifetime of the connection. For packets flowing in the other direction the opposite source NAT action is taken. This is best illustrated with an example:
10.1.0.10 on the 'inside' network is sending a packet to a web server with an IP address of 5.5.5.5 on the Internet. When the packet leaves the host it has a destination IP address of 5.5.5.5 and a source IP address of 10.1.0.10. When the packet gets to the router and sent out the 'outside' interface to the Internet the router applies source NAT and changes the source IP address from 10.1.0.10 to 1.1.1.2, the IP address on its WAN interface. When the packet gets to the web server and the server replies it sends the packet with a source IP address of 5.5.5.5 and a destination IP address of 1.1.1.2. Once the packet gets to the router it is found to be part of an existing connection, and that the original source address was 10.1.0.10. The router replaces the destination IP address in the packet header with 10.1.0.10 and sends the packet out the 'inside' interface to the host. It is important to note that this destination NAT action doesn't have to be configured - it happens automatically, as part of undoing the original source NAT action that was explicitly configured. Each explicit source NAT rule has an implicit destination NAT action that undoes the translation in the other direction, and each explicit destination NAT rule has an implicit source NAT action for the same reason.
It is also important to know when NAT happens: because NAT changes the IP address in the packet headers different chains see different IP addresses for the same packet. Destination NAT (both explicit and implicit) happens after the 'prerouting' chain. Source NAT happens after the 'postrouting' chain. Because of the sequence of actions the prerouting chain always sees packets with their original IP address, and the 'input' and 'forward' chains see packets with destination IPs as changed by destination NAT.

Source NAT

Source NAT comes in two different flavors: 'masquerade' and 'src-nat'. Both change the source IP address in a packet header, but use different mechanisms to derive the new IP address. 'masquerade' dynamically looks at the primary IP address on the interface that the packet will leave the router through, and uses that as the new source IP address. This is perfect for interfaces that received their IP address via DHCP or PPPoE. 'src-nat' requires a parameter called 'to-addresses' that statically configures the source IP address to use. This is perfect for interfaces with static IP addresses. Source NAT should only ever be applied when absolutely needed at the border where private IP addresses can no longer be routed. In most small networks that means source NAT should only be applied on the WAN interface.
Masquerade
The below configures an interface for masquerade source NAT, and refers to the outbound interface to make sure only traffic leaving through the WAN interface is subject to source NAT:
/ip firewall nat
add chain=srcnat out-interface=outside action=masquerade
Static source NAT
The below configures an interface for static source NAT, and again refers to the outbound interface. The only additional information required is the static address:
/ip firewall nat
add chain=srcnat out-interface=outside action=src-nat to-address=1.1.1.2

Destination NAT

Unlike source NAT all destination NAT is static. Destination NAT is often used for port forwarding to allow Internet resources to access devices on the local network. It is possible to forward all IP traffic, or just specific ports for specific protocols. It is important to be very specific when writing destination NAT rules: for example, it is easily possible to forget to specify a destination IP address and to just apply destination NAT to all HTTP and HTTPS traffic. This would break web browsing for other computers behind the router. The below forwards ports tcp/80 and tcp/443 (HTTP and HTTPS) to the web server with IP address 10.2.0.10 in the DMZ network.
/ip firewall nat
add chain=dstnat dst-address=1.1.1.2 prototocol=tcp dst-port=80,443 \
   action=dst-nat to-addresses=10.2.0.10

Example network

In our example network we need to source NAT out to the Internet and translate all inside and DMZ traffic to our static IP address, and forward web traffic to the web server in the DMZ as shown above.
/ip firewall nat
add chain=srcnat out-interface=outside action=src-nat to-address=1.1.1.2
add chain=dstnat dst-address=1.1.1.2 prototocol=tcp dst-port=80,443 \
   action=dst-nat to-addresses=10.2.0.10

Date and Time

RouterBOARDs do not have batteries that keep time when the routers shut down or are power cycled. Because of this the routers will reset their internal tim to January 1st, 1970 when they reboot. NTP is a protocol that allows devices to sync their time over the network. This is necessary for the router to have the correct time. Having the correct time is usually a good idea simply because it allows log entries (which are timestamped) to make sense when troubleshooting. It's hard to do the math and figure out what the real timestamps are hwn the router is the current date showing March 19, 1971 and the log shows an interface went down on March 17, 1971 12:05.
To configure NTP requires NTP servers to sync again. The best option for this is to go to the NTP Pool Project web site and find a pool close to you.
There are two different NTP options: you can install the NTP package and get a full NTP server and client, or you can use the simple NTP client built into the base package. This manual only shows the simple client.

Example network

Because people tend to blindly copy and paste from tutorials the below NTP server addresses do not work: 2.2.2.2 and 3.3.3.3 are not a valid NTP server. Please find one or more public NTP servers near you instead and replace their IP addresses below.
/system ntp client
set enabled=yes primary-ntp=2.2.2.2 secondary-ntp=3.3.3.3

Jan 28, 2013

Basic MikroTik RouterOS Configuration using winbox

To configure your router
Click IP >> Addresses on the left menu in winbox as in diagram below.



This will open the Address list dialog window as seen below. Click on the red plus button to open the add IP address window.

When the New IP address dialog opens enter the address details select an interface to set the adress on and press apply and OK button.




For information on what IP settings to use please see a basic tutorial in IP Networking. But just to explain one or two points about this dialog...
It is best to delete an address entirely instead of editing it, as I found that it a cleaner way of editing an address as to modify network or broadcast options can sometimes not apply 100% properly.
You have an option of entering the network and broadcast address explicitly in the boxes provided or is you prefer you can use the short slash notation and press the apply button, this will populate the broadcast and network boxes with the correct settings.

Howto use a Mikrotik as router for a PPPoA DSL Internet connection

live in Austria and the biggest Internet provider is A1 Telekom Austria and they use PPPoA and not PPPoE. I’ve searched through out the Internet to find some documentation on how to configure a Mikrotik router for this. I wanted to have the public IP address on the Mikrotik and not on the provider router/modem. I did not find any documentation. But as I got it working I’ll provide such a documentation now. ;-)
1. The Basics
PPPoA is the abbreviation for PPP over ATM or some say PPP over AAL5 and it is used to encapsulate PPP into ATM cells to get into the Internet via ADSL connections. The more commonly used standard in this space is PPPoE (PPP over Ethernet), but which has somewhat more overhead as you need also to encapsulate the Ethernet header too.
There are now two possibilities:
The first is that the provider modem/router handles everything and you get only a private IP address behind the router, and the router masquerade the private IP addresses. This is normally the default as it works for 95% of the customers but your PC or own router does not get a public IP address. You need to use port forwarding if you want to provide services which are reachable from the Internet. And something which I specially need. You don’t get a event when you get disconnected and assigned a new IP address. A1 Telekom Austria has the bad habit to disconnect you every 8 hours … 3 times a day. As I want to have the disconnects always at the same time I need my own router to time it once a day, so it gets reseted to my desired reconnect times.
The second way it to get somehow the public IP address on the PC or router. In this case your need a provider modem/router with a PPPoA-to-PPTP-Relays. Take a look at the picture I took from the German Wikipedia(CC-BY-SA-3.0, Author Sonos):


The computer (or Mikrotik router) thinks it establishes a PPTP tunnel with the modem, but instead the modem encapsulates the packets and send them on via ATM to the provider backbone. So the computer or Miktrotik router does not need to be able to talk PPPoA it is enough if it is able to talk PPTP, the rest is handled by the modem.
2. Requirements
But of course there are some requirements:
  • The provider modem needs to be able to make a PPPoA-to-PPTP-Relays and which is important you need to be able to configure it, as some provider firmwares restrict that.
  • You need to know the username and password which is used for the ppp authentication
  • And for the sake of completeness – you need a Mikrotik router ;-)
3. Provider modem / router
My provider gave me a Thomson Speedtouch TG585 v7 modem/router. The firmware  is old (8.2.1.5) and branded but I was able to upload a new configuration via the web interface.


And as it works stable I did not see a reason to upgrade. I found in the Internet a INI file, which configured the router to PPPoA-to-PPTP-Relays mode. Three important notes:
  • If you search the Internet for a configuration file … look for “single user” or “single user mode” (SU), the masquerade mode is called “multi user mode” (MU)
  • It is also possible to configure the single user mode via telnet, there are some howto’s out there. The specific ones for Austria are of course in German.
  • The version numbering is quite broken. The A1 Telekom Austria branded firmwares are often higher (e.g. 8.6.9.0) than the newer generic firmwares (e.g 8.2.6.5_AA).
After configuring the router as PPPoA-to-PPTP-Relays it has the IP address 10.0.0.138/24 for my setup.
4. Mikrotik PPP configuration

So now to the Mikrotik configuration … we start with resetting the configuration with no defaults.

/system reset-configuration no-defaults=yes

Then we rename the first interface and add a transit network IP address

/interface ethernet set 0 name=ether1vlanTransitModem
/ip address add address=10.0.0.1/24 interface=ether1vlanTransitModem

And now we only need to configure the PPTP

/ppp profile add change-tcp-mss=yes name=pppProfileDslInternet use-compression=no use-encryption=no use-vj-compression=no
/interface pptp-client add add-default-route=yes connect-to=10.0.0.138 disabled=no name=pptpDslInternet password=YourPassword profile=pppProfileDslInternet user=YourUsername

this configuration should lead after connecting the ether1 with the modem to following log entries:

[admin@MikroTik] > /log/print
00:29:03 pptp,ppp,info pptpDslInternet: initializing...
00:29:03 pptp,ppp,info pptpDslInternet: dialing...
00:29:05 pptp,ppp,info pptpDslInternet: authenticated
00:29:05 pptp,ppp,info pptpDslInternet: connected

you should see the IP address too:

[admin@MikroTik] > /ip route print
Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, B - blackhole, U - unreachable, P - prohibit
#      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
0 ADS  0.0.0.0/0                         xxx.xxx.xxx.xxx            1
1 ADC  10.0.0.0/24        10.0.0.1        ether1vlanTrans...        0
2 ADC  xxx.xxx.xxx.xxx/32   yyy.yyy.yyy.yyy   pptpDslInternet           0

But if you try to ping something you’ll get

[admin@MikroTik] > ping 8.8.8.8
HOST                                     SIZE TTL TIME  STATUS
8.8.8.8                                                 timeout
8.8.8.8                                                 timeout
sent=2 received=0 packet-loss=100%

whats the problem? the router uses the wrong source IP address, try following (the xxx.xxx.xxx.xxx is the IP address from /ip route print (entry 2) )

[admin@MikroTik] > /ping src-address=xxx.xxx.xxx.xxx 8.8.8.8
HOST                                     SIZE TTL TIME  STATUS
8.8.8.8                                    56  46 37ms
8.8.8.8                                    56  46 36ms
8.8.8.8                                    56  46 37ms
8.8.8.8                                    56  46 37ms
8.8.8.8                                    56  46 37ms
8.8.8.8                                    56  46 37ms
sent=6 received=6 packet-loss=0% min-rtt=36ms avg-rtt=36ms max-rtt=37ms

Now the Internet connection is working, we just need to make it usable ….
 5. Mikrotik on the way to be usable
The first thing we need is a masquerade rule that we use the correct IP address into the Internet, following does the trick.

/ip firewall nat add action=masquerade chain=srcnat out-interface=pptpDslInternet

But we want also a client to test it … so here is the configuration I use for the clients (without explanation as it is not the topic of this Howto)

/interface ethernet set 2 name=ether3vlanClients
/ip address add address=10.23.23.1/24 interface=ether3vlanClients


/ip dns set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/ip dns static add address=10.23.23.1 name=router.int


/ip pool add name=poolClients ranges=10.23.23.20-10.23.23.250
/ip dhcp-server add address-pool=poolClients authoritative=yes disabled=no interface=ether3vlanClients name=dhcpClients
/ip dhcp-server network add address=10.23.23.0/24 dns-server=10.23.23.1 domain=int gateway=10.23.23.1

Connect a client behind it, set it to DHCP and everything should work. I hope this Howto demystifies PPPoA and Mirkotik.

WinBox console- Mikrotik

General Information

Summary

The MikroTik RouterOS can be configured remotely, using Telnet, SSH, WinBox Console or Webbox. In this manual we will discuss how to use the interactive WinBox console.

Description

The Winbox console is used for accessing the MikroTik Router configuration and management features, using graphical user interface (GUI).
All Winbox interface functions are as close as possible to Console functions: all Winbox functions are exactly in the same hierarchy in Terminal Console and vice versa (except functions that are not implemented in Winbox). That is why there are no Winbox sections in the manual.
The Winbox Console plugin loader, the winbox.exe program, can be retrieved from the MikroTik router, the URL is http://router_address/winbox/winbox.exe Use any web browser on Windows 95/98/ME/NT4.0/2000/XP or Linux to retrieve the winbox.exe executable file from Router. If your router is not specifically configured, you can also type in the web-browser just http://router_address
The Winbox plugins are cached on the local disk for each MikroTik RouterOS version. The plugins are not downloaded, if they are in the cache, and the router has not been upgraded since the last time it has been accessed.
Starting the Winbox Console When connecting to the MikroTik router via http (TCP port 80 by default), the router's Welcome Page is displayed in the web browser:




By clicking on the Winbox link you can start the winbox.exe download. Choose Open to start the Winbox loader program (you can also save this program to your local disk, and run it from there)
The winbox.exe program opens the Winbox login window.


where:

discovers and shows MNDP (MikroTik Neighbor Discovery Protocol) or CDP (Cisco Discovery Protocol) devices.




  • logs on to the router by specified IP address (and the port number if you have changed it from the default value of 80) or MAC Address (if the router is in the same subnet), user name, and password.

  • saves the current sessions to the list (to run them, just double-click on an item).

  • removes selected item from the list.

  • removes all items from the list, clears cache on the local disk, imports addresses from wbx file or exports them to wbx file.



  • Secure Mode
    provides privacy and data integrity between WinBox and RouterOS by means of TLS (Transport Layer Security) protocol.
  • Keep Password
    Saves password as a plain text on a local hard drive. Warning: storing passwords in plain text allows anybody with access to your files to read the password from there.
The Winbox Console of the router:


The Winbox Console uses TCP port 8291. After logging onto the router you can work with the MikroTik router's configuration through the Winbox console and perform the same tasks as using the regular console.
Overview of Common Functions You can use the menu bar to navigate through the router's configuration menus, open configuration windows. By double clicking on some list items in the windows you can open configuration windows for the specific items, and so on.
There are some hints for using the Winbox Console:
  • To open the required window, simply click on the corresponding menu item

  • Add a new entry

  • Remove an existing entry

  • Enable an item

  • Disable an item

  • Make or edit a comment

  • Refresh a window

  • Undo an action

  • Redo an action

  • Logout from the Winbox Console

Troubleshooting

Description

  • Can I run WinBox on Linux?
  • Yes, you can run WinBox and connect to RouterOS, using Wine
  • I cannot open the Winbox Console
    Check the port and address for www service in /ip service print list. Make sure the address you are connecting from matches the network you've specified in address field and that you've specified the correct port in the Winbox loader. The command /ip service set www port=80 address=0.0.0.0/0 will change these values to the default ones so you will be able to connect specifying just the correct address of the router in the address field of Winbox loader
  • The Winbox Console uses TCP port 8291. Make sure you have access to it through the firewall.

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Computer Tricks and Tips