Mikrotik - Part2
Mikrotik - Part2
General-Featuers
PDF generated using the open source mwlib toolkit. See http://code.pediapress.com/ for more information.
PDF generated at: Thu, 19 Dec 2013 18:53:21 CET
Contents
Articles
Manual:Interface
Manual:Interface/Ethernet
Manual:Interface/Bridge
Manual:Interface/VRRP
17
Manual:Bonding Examples
24
Manual:VRRP-examples
26
29
37
Manual:Interface/Wireless
43
Manual:Wireless AP Client
73
78
Manual:Nv2
81
Manual:WMM
86
Manual:Spectral scan
88
92
Manual:Interface/HWMPplus
94
106
Manual:Wireless FAQ
109
113
Manual:Interface/VLAN
117
Manual:IP/IPsec
123
Manual:Interface/EoIP
145
Manual:Interface/Gre
148
Manual:Interface/IPIP
150
Manual:Interface/PPP
152
Manual:Interface/PPPoE
153
Manual:Interface/PPTP
164
Manual:Interface/L2TP
170
Manual:Interface/SSTP
177
Manual:Interface/OVPN
187
190
198
References
201
202
Manual:Interface
Manual:Interface
Applies to RouterOS: v3, v4 +
Sub Categories
List of reference sub-pages
Case studies
List of examples
Summary
Sub-menu: /interface
MikroTik RouterOS supports a variety of Network Interface Cards as well as virtual interfaces (like Bonding,
Bridge, VLAN etc.). Each of them has its own submenu, but common properties of all interfaces can be configured
and read in general interface menu.
Properties
Property
Description
l2mtu (integer; Default: ) Layer2 Maximum transmission unit. Note that this property can not be configured on all interfaces. Read more>>
mtu (integer; Default: )
Name of an interface
Read-only properties
Property
Description
bytes (integer/integer)
Total received and transmitted bytes by interface since startup. Read more>>
drops (integer/integer)
packets not sent/received because interface queue is full (no free descriptors), dma engine overrun/underrun. Read
more>>
dynamic (yes|no)
errors (integer/integer) Packets received with some kind of error or not transimitted because of some error. Read more>>
packets
(integer/integer)
running (yes|no)
Whether interface is running. Note that some interface does not have running check and they are always reported as
"running"
slave (yes|no)
dynamic (yes|no)
type (string)
Manual:Interface
Traffic monitor
The traffic passing through any interface can be monitored using following command:
/interface monitor-traffic [id | name]
For example monitor ether2 and aggregate traffic. Aggregate is used to monitor total ammount of traffic handled
by the router:
[maris@maris_main] > /interface monitor-traffic ether2,aggregate
rx-packets-per-second: 9
14
rx-drops-per-second: 0
0
rx-errors-per-second: 0
0
rx-bits-per-second: 6.6kbps 10.2kbps
tx-packets-per-second: 9
12
tx-drops-per-second: 0
0
tx-errors-per-second: 0
0
tx-bits-per-second: 13.6kbps 15.8kbps
Stats
RouterOS v3.22 introduces a new command:
/interface print stats
This command prints total packets, bytes, drops and errors.
All interfaces that support this feature will be displayed. Some interfaces are not supporting Error and Drop counters
at the moment (RB4XX except RB450G ether 2-5), these devices will not display these counters.
Traffic monitor now also displays errors per second, in addition to the usual stats:
/interface monitor-traffic
/interface ethernet print stats will display all kinds of other statistics if the interface is supporting
them (currently only RB450G ether2-ether5 and also RB750 ether2-ether5).
[ Top | Back to Content ]
Manual:Interface/Ethernet
Manual:Interface/Ethernet
Applies to RouterOS: v3, v4+
Summary
Sub-menu: /interface ethernet
Standards: IEEE 802.3 [1]
MikroTik RouterOS supports various types of Ethernet interfaces.
Properties
Property
Description
When enabled, the interface "advertises" its maximum capabilities to achieve the best connection
possible.
Note: Auto-negotiation must be disabled on both ends, otherwise Ethernets may not work properly.
Note2: Gigabit link cannot work with auto-negotiation disabled.
Disable running check. If this value is set to 'no', the router automatically detects whether the NIC is
connected with a device in the network or not. By default value is 'yes' because older NICs does not
support it. (only applicable to x86)
Whether the MDI/X auto crosscable correction feature is enabled for the port
Name of an interface
Sets the data transmission speed of the interface. By default, this value is the maximal data rate
supported by the interface
Manual:Interface/Ethernet
Property
Description
Whether interface is running. Note that some interface does not have running check and they are always reported as
"running"
rx-1024-1518 (integer)
rx-128-255 (integer)
rx-1519-max (integer)
rx-256-511 (integer)
rx-512-1023 (integer)
rx-64 (integer)
rx-65-127 (integer)
rx-align-error
(integer)
rx-broadcast (integer)
rx-bytes (integer)
rx-fcs-error (integer)
rx-fragment (integer)
rx-multicast (integer)
rx-overflow (integer)
rx-pause (integer)
rx-runt (integer)
Amount of received frames shorter than the minimum 64 bytes but with a valid CRC
rx-too-long (integer)
slave (yes | no)
switch (integer)
tx-1024-1518 (integer)
tx-128-255 (integer)
tx-1519-max (integer)
tx-256-511 (integer)
tx-512-1023 (integer)
tx-64 (integer)
tx-65-127 (integer)
tx-align-error
(integer)
tx-broadcast (integer)
tx-bytes (integer)
tx-fcs-error (integer)
tx-fragment (integer)
tx-multicast (integer)
tx-overflow (integer)
tx-pause (integer)
tx-runt (integer)
Manual:Interface/Ethernet
tx-too-long (integer)
Description
cable-pairs (string)
Monitor
/interface ethernet monitor command prints out current link, rate and duplex status of an interface.
Properties:
Property
auto-negotiation (done | incomplete)
Description
Current auto negotiation status:
done-negotiation completed
incomplete-negotiation failed or not yet completed
default-cable-settings (short | standard) Default cable length setting (only applicable to NS DP83815/6 cards)
phy-regs ()
Manual:Interface/Ethernet
Stats
RouterOS v3.22 introduces a new command:
/interface ethernet print stats
This command will display all kinds of other statistics if the interface is supporting them (currently only RB450G
ether2-ether5, RB750 ether2-ether5, RB750G ether1-ether5 and also RB1100 ether1-ether10). Complete list of
properties can be found in section above
For example, output of ethernet stats on RB450G:
[admin@MikroTik] /interface ethernet> print stats
name: ether1-gateway ether2-local ether3-local ether4-local ether5-local
rx-broadcast:
22
31
3666
11
rx-pause:
rx-multicast:
1423
rx-fcs-error:
rx-align-error:
rx-runt:
rx-fragment:
rx-64:
rx-65-127:
14
21598
10
rx-128-255:
rx-256-511:
18
24
2245
28926
7649
371938
24476
rx-1024-1518:
rx-1519-max:
rx-too-long:
rx-overflow:
15337844
4063737
199738064
12975401
rx-512-1023:
rx-bytes:
Manual:Interface/Ethernet
tx-broadcast:
13
13
1496
13
13
1496
tx-underrun:
tx-64:
tx-pause:
tx-multicast:
26
26
2992
16
tx-128-255:
tx-65-127:
tx-256-511:
tx-512-1023:
tx-1024-1518:
tx-1519-max:
tx-too-long:
tx-collision:
tx-excessive-collision:
tx-multiple-collision:
tx-single-collision:
tx-excessive-deferred:
tx-deferred:
tx-late-collision:
2561
2561
294712
1576
tx-bytes:
Switch
Sub-menu: /interface ethernet switch
This submenu allows to configure certain RouterBoard switch chip feature. Read more >>.
PoE out
PoE out settings are only available on RouterBOARD devices that have this hardware feature present.
See more here: PoE-Out
[ Top | Back to Content ]
References
[1] http:/ / grouper. ieee. org/ groups/ 802/ 3/
Manual:Interface/Bridge
Manual:Interface/Bridge
Applies to RouterOS: v3, v4+
Summary
Sub-menu: /interface bridge
Standards: IEEE802.1D [1]
Ethernet-like networks (Ethernet, Ethernet over IP, IEEE802.11 in ap-bridge or bridge mode, WDS, VLAN) can be
connected together using MAC bridges. The bridge feature allows the interconnection of hosts connected to separate
LANs (using EoIP, geographically distributed networks can be bridged as well if any kind of IP network
interconnection exists between them) as if they were attached to a single LAN. As bridges are transparent, they do
not appear in traceroute list, and no utility can make a distinction between a host working in one LAN and a host
working in another LAN if these LANs are bridged (depending on the way the LANs are interconnected, latency and
data rate between hosts may vary).
Network loops may emerge (intentionally or not) in complex topologies. Without any special treatment, loops would
prevent network from functioning normally, as they would lead to avalanche-like packet multiplication. Each bridge
runs an algorithm which calculates how the loop can be prevented. STP and RSTP allows bridges to communicate
with each other, so they can negotiate a loop free topology. All other alternative connections that would otherwise
form loops, are put to standby, so that should the main connection fail, another connection could take its place. This
algorithm exchange configuration messages (BPDU - Bridge Protocol Data Unit) periodically, so that all bridges
would be updated with the newest information about changes in network topology. (R)STP selects root bridge which
is responosible for network reconfiguration, such as blocking and opening ports of the other bridges. The root bridge
is the bridge with lowest bridge ID.
Description
admin-mac (MAC address; Default: ) Static MAC address of the bridge (takes effect if auto-mac=no)
ageing-time (time; Default:
00:05:00)
Automatically select the smallest MAC address of bridge ports as a bridge MAC address
Time which is spent during the initialization phase of the bridge interface (i.e., after router startup or
enabling the interface) in listening/learning state before the bridge will start functioning normally
Manual:Interface/Bridge
Spanning tree protocol priority for bridge interface. Bridge with the smallest (lowest) bridge ID becomes a
Root-Bridge. Bridge ID consists of two numbers - priority and MAC address of the bridge. To compare
two bridge IDs, the priority is compared first. If two bridges have equal priority, then the MAC addresses
are compared.
Select Spanning tree protocol (STP) or Rapid spanning tree protocol (RSTP) to ensure a loop-free
topology for any bridged LAN. RSTP provides provides for faster spanning tree convergence after a
topology change.
transmit-hold-count (integer:
1..10; Default: 6)
The Transmit Hold Count used by the Port Transmit state machine to limit transmission rate
http://en.wikipedia.org/wiki/Spanning_Tree_Protocol [2]
To add and enable a bridge interface that will forward all the protocols:
[admin@MikroTik] /interface bridge> add
[admin@MikroTik] /interface bridge> print
Flags: X - disabled, R - running
0 R name="bridge1" mtu=1500 l2mtu=65535 arp=enabled
mac-address=00:00:00:00:00:00 protocol-mode=none priority=0x8000
auto-mac=yes admin-mac=00:00:00:00:00:00 max-message-age=20s
forward-delay=15s transmit-hold-count=6 ageing-time=5m
[admin@MikroTik] /interface bridge>
Bridge Settings
Sub-menu: /interface bridge settings
Property
Description
Port Settings
Sub-menu: /interface bridge port
Port submenu is used to enslave interfaces in a particular bridge interface.
Manual:Interface/Bridge
10
Property
Description
Set port as edge port or non-edge port, or enable automatic detection. Edge ports are connected to LAN that
has no other bridges attached. If the port is configured to discover edge port then as soon as the bridge detects a
BPDU coming to an edge port, the port becomes a non-edge port.
external-fdb (auto | no | yes; Whether to use wireless registration table to speed up bridge host learning
Default: auto)
horizon (none | integer
0..429496729; Default: none)
Path cost to the interface, used by STP to determine the "best" path
The priority of the interface in comparison with other going to the same subnet
Bridge Monitoring
Sub-menu: /interface bridge monitor
Used to monitor the current status of a bridge.
Property
Description
port-count (integer)
root-bridge-id (text)
root-path-cost (integer)
root-port (name)
To monitor a bridge:
[admin@MikroTik] /interface bridge> monitor bridge1
state: enabled
current-mac-address: 00:0C:42:52:2E:CE
Manual:Interface/Bridge
root-bridge:
root-bridge-id:
root-path-cost:
root-port:
port-count:
designated-port-count:
11
yes
0x8000.00:00:00:00:00:00
0
none
2
0
Description
Port state
Port state
Port identifier
Disabled port - not strictly part of STP, a network administrator can manually disable
a port
Root port a forwarding port that is the best port from Nonroot-bridge to Rootbridge
Alternative port an alternate path to the root bridge. This path is different than using
the root port
Designated port a forwarding port for every LAN segment
Backup port a backup/redundant path to a segment where another bridge port
already connects.
Port status
Manual:Interface/Bridge
12
Description
The time since the last packet was received from the host
Whether the host entry is of the bridge itself (that way all local interfaces are shown)
AGE
3s
0s
0s
3s
0s
Bridge Firewall
Sub-menu: /interface bridge filter, /interface bridge nat
The bridge firewall implements packet filtering and thereby provides security functions that are used to manage data
flow to, from and through bridge.
Packet flow diagram shows how packets are processed through router. It is possible to force bridge traffic to go
through /ip firewall filter rules (see: Bridge Settings)
There are two bridge firewall tables:
filter - bridge firewall with three predefined chains:
input - filters packets, which destination is the bridge (including those packets that will be routed, as they are
anyway destined to the bridge MAC address)
output - filters packets, which come from the bridge (including those packets that has been routed normally)
forward - filters packets, which are to be bridged (note: this chain is not applied to the packets that should be
routed through the router, just to those that are traversing between the ports of the same bridge)
nat - bridge network address translation provides ways for changing source/destination MAC addresses of the
packets traversing a bridge. Has two built-in chains:
srcnat - used for "hiding" a host or a network behind a different MAC address. This chain is applied to the
packets leaving the router through a bridged interface
dstnat - used for redirecting some pakets to another destinations
You can put packet marks in bridge firewall (filter and NAT), which are the same as the packet marks in IP firewall
put by mangle. So packet marks put by bridge firewall can be used in IP firewall, and vice versa.
General bridge firewall properties are described in this section. Some parameters that differ between nat and filter
rules are described in further sections.
Manual:Interface/Bridge
Property802.3-sap
(integer)802.3-type
(integer)arp-dst-address
(IP
address;
default:
)arp-dst-mac-address
(MAC address; default: )arp-gratuitous
(yes | no; default:
)arp-hardware-type (integer; default: 1)arp-opcode (arp-nak | drarp-error | drarp-reply | drarp-request |
inarp-reply | inarp-request | reply | reply-reverse | request | request-reverse)arp-src-address (IP address;
default: )arp-src-mac-address (MAC address; default: )chain (text)dst-address (IP address;
default: )dst-mac-address (MAC address; default: )dst-port (integer 0..65535)in-bridge
(name)in-interface (name)ingress-priority (integer 0..63)ip-protocol (ddp | ggp | icmp | igmp |
ipsec-ah | ospf | rdp | tcp | vrrp | egp | gre | icmpv6 | ipencap | ipsec-esp | pim | rspf | udp | xns-idp | encap | hmp |
idpr-cmtp | ipip | iso-tp4 | pup | st | vmtp | xtp)jump-target
(name)limit
(integer/time,integer)log-prefix (text)mac-protocol (arp | ip | ipv6 | ipx | length | pppoe | pppoe-discovery |
rarp | vlan)out-bridge (name)out-interface (name)packet-mark (name)packet-type (broadcast
| host | multicast | other-host)src-address (IP address; default: )src-mac-address (MAC address;
default:
)src-port
(integer
0..65535)stp-flags
(topology-change
|
topology-change-ack)stp-forward-delay
(time
0..65535)stp-hello-time
(time
0..65535)stp-max-age
(time
0..65535)stp-msg-age
(time
0..65535)stp-port
(integer
0..65535)stp-root-address (MAC address)stp-root-cost (integer 0..65535)stp-root-priority
(integer
0..65535)stp-sender-address
(MAC
address)stp-sender-priority
(integer
0..65535)stp-type (config | tcn)vlan-encap (arp | ip | ipv6 | ipx | length | pppoe | pppoe-discovery | rarp |
vlan )vlan-id (integer 0..4095)vlan-priority (integer 0..7)DescriptionDSAP (Destination Service Access
Point) and SSAP (Source Service Access Point) are 2 one byte fields, which identify the network protocol entities
which use the link layer service. These bytes are always equal. Two hexadecimal digits may be specified here to
match an SAP byteEthernet protocol type, placed after the IEEE 802.2 frame header. Works only if 802.3-sap is
0xAA (SNAP - Sub-Network Attachment Point header). For example, AppleTalk can be indicated by SAP code of
0xAA followed by a SNAP type code of 0x809BARP destination addressARP destination MAC addressMatches
ARP gratuitous packetsARP hardware type. This normally Ethernet (Type 1) ARP opcode (packet type)
arp-nak - negative ARP reply (rarely used, mostly in ATM networks)
drarp-error - Dynamic RARP error code, saying that an IP address for the given MAC address can not be
allocated
drarp-reply - Dynamic RARP reply, with a temporaty IP address assignment for a host
drarp-request - Dynamic RARP request to assign a temporary IP address for the given MAC address
inarp-reply inarp-request reply - standard ARP reply with a MAC address
reply-reverse - reverse ARP (RARP) reply with an IP address assigned
request - standard ARP request to a known IP address to find out unknown MAC address
request-reverse - reverse ARP (RARP) request to a known MAC address to find out unknown IP address
(intended to be used by hosts to find out their own IP address, similarly to DHCP service)
ARP source addressARP source MAC addressBridge firewall chain, which the filter is functioning in (either a
built-in one, or a user defined)Destination IP address (only if MAC protocol is set to IPv4)Destination MAC
addressDestination port number or range (only for TCP or UDP protocols)Bridge interface through which the packet
is coming inPhysical interface (i.e., bridge port) through which the packet is coming inMatches ingress priority of
the packet. Priority may be derived from VLAN, WMM or MPLS EXP bit. read more IP protocol (only if MAC
protocol is set to IPv4)
ipsec-ah - IPsec AH protocol
ipsec-esp - IPsec ESP protocol
ddp - datagram delivery protocol
egp - exterior gateway protocol
13
Manual:Interface/Bridge
If action=jump specified, then specifies the user-defined firewall chain to process the packet Restricts packet
match rate to a given limit.
count - maximum average packet rate, measured in packets per second (pps), unless followed by Time option
time - specifies the time interval over which the packet rate is measured
burst - number of packets to match in a burst
Defines the prefix to be printed before the logging informationEthernet payload type (MAC-level protocol)Outgoing
bridge interfaceInterface via packet is leaving the bridgeMatch packets with certain packet mark MAC frame type:
Source IP address (only if MAC protocol is set to IPv4)Source MAC addressSource port number or range (only for
TCP or UDP protocols) The BPDU (Bridge Protocol Data Unit) flags. Bridge exchange configuration messages
named BPDU peridiocally for preventing from loop
topology-change - topology change flag is set when a bridge detects port state change, to force all other bridges
to drop their host tables and recalculate network topology
topology-change-ack - topology change acknowledgement flag is sen in replies to the notification packets
Forward delay timerSTP hello packets timeMaximal STP message ageSTP message ageSTP port identifierRoot
bridge MAC addressRoot bridge costRoot bridge prioritySTP message sender MAC addressSTP sender priority The
BPDU type:
config - configuration BPDU
tcn - topology change notification
14
Manual:Interface/Bridge
15
the MAC protocol type encapsulated in the VLAN frameVLAN identifier fieldThe user priority field
STP matchers are only valid if destination MAC address is 01:80:C2:00:00:00/FF:FF:FF:FF:FF:FF (Bridge Group
address), also stp should be enabled.
ARP matchers are only valid if mac-protocol is arp or rarp
VLAN matchers are only valid for vlan ethernet protocol
IP-related matchers are only valid if mac-protocol is set as ipv4
802.3 matchers are only consulted if the actual frame is compliant with IEEE 802.2 and IEEE 802.3 standards
(note: it is not the industry-standard Ethernet frame format used in most networks worldwide!). These matchers
are ignored for other packets.
Description
accept - accept the packet. No action, i.e., the packet is passed through without undertaking
any action, and no more rules are processed in the relevant list/chain
drop - silently drop the packet (without sending the ICMP reject message)
jump - jump to the chain specified by the value of the jump-target argument
log - log the packet
mark - mark the packet to use the mark later
passthrough - ignore this rule and go on to the next one. Acts the same way as a disabled
rule, except for ability to count packets
return - return to the previous chain, from where the jump took place
set-priority
Bridge NAT
Sub-menu: /interface bridge nat
This section describes bridge NAT options, which were omitted in the general firewall description.
Property
Description
Manual:Interface/Bridge
16
accept - accept the packet. No action, i.e., the packet is passed through
without undertaking any action, and no more rules are processed in the
relevant list/chain
arp-reply - send a reply to an ARP request (any other packets will be
ignored by this rule) with the specified MAC address (only valid in
dstnat chain)
drop - silently drop the packet (without sending the ICMP reject
message)
dst-nat - change destination MAC address of a packet (only valid in
dstnat chain)
jump - jump to the chain specified by the value of the jump-target
argument
log - log the packet
mark - mark the packet to use the mark later
passthrough - ignore this rule and go on to the next one. Acts the same
way as a disabled rule, except for ability to count packets
redirect - redirect the packet to the bridge itself (only valid in dstnat
chain)
return - return to the previous chain, from where the jump took place
set-priority
src-nat - change source MAC address of a packet (only valid in srcnat
chain)
Source MAC address to put in Ethernet frame and ARP payload, when
action=arp-reply is selected
References
[1] http:/ / standards. ieee. org/ getieee802/ download/ 802. 1D-2004. pdf
[2] http:/ / en. wikipedia. org/ wiki/ Spanning_Tree_Protocol
Manual:Interface/VRRP
Manual:Interface/VRRP
Applies to RouterOS: v3, v4, v5
Summary
Sub-menu level: /interface vrrp
Standards: RFC 5798, RFC 3768
This chapter describes the Virtual Router Redundancy Protocol (VRRP) support in RouterOS.
Mostly on larger LANs dynamic routing protocols ( OSPF or RIP) are used, however there are number of factors that
may make undesirable to use dynamic routing protocols. One alternative is to use static routing, but if statically
configured first hop fails, then host will not be able to communicate with other hosts.
In IPv6 networks, hosts learn about routers by receiving Router Advertisements used by Neighbor Discovery (ND)
protocol. ND already has built in mechanism to determine unreachable routers. However it can take up to 38seconds
to detect unreachable router. It is possible to change parameters and make detection faster, but it will increase
overhead of ND traffic especially if there are a lot of hosts. VRRP allows to detect unreachable router within
3seconds without additional traffic overhead.
Virtual Router Redundancy Protocol (VRRP) provides a solution by combining number of routers into logical group
called Virtual Router (VR). VRRP implementation in RouterOS is compliant to VRRPv2 RFC 3768 and VRRPv3
RFC 5798.
17
Manual:Interface/VRRP
18
Protocol Overview
The purpose of the VRRP is to
communicate to all VRRP routers
associated with the Virtual Router ID
and support router redundancy through
a prioritized election process among
them.
All messaging is done by IPv4 or IPv6
multicast packets. Destination address
of IPv4 packet is 224.0.0.12 and for
IPv6 it is FF02:0:0:0:0:0:0:12. Source
address of the packet is always the
primary IP address of an interface from
which the packet is being sent. In IPv6
networks source address is link-local
address of an interface.
These packets are always sent with
TTL=255 and are not forwarded by the
router. If for any reason router receives
a packet with lower TTL, packet is
discarded.
Manual:Interface/VRRP
19
Owner
An Owner router for a VR is default
Master router and operates as the
Owner for all subnets included in the
VR. As mentioned before priority on
an owner router must be the highest
value (255). In example network R1 is
an Owner. It's priority is set to 255 and
virtual IP is the same as real IP (owns
the virtual IP address).
All Virtual Router members can be
configured so that virtual IP is not the
same as physical IP. Such Virtual
address can be called floating or pure virtual IP address.
Advantage of this setup is flexibility given to the administrator. Since the virtual IP address is not the real address of
any one of the participant routers, the administrator can change these physical routers or their addresses without any
need to reconfigure the virtual router itself.
Note: RouterOS can not be configured as Owner. Pure virtual IP configuration is the only valid configuration
unless non-RouterOS device is set as owner.
Master
Master router in a VR operates as the physical gateway for the network for which it is configured.
Selection of the Master is controlled by priority value. Master state describes behavior of Master router. In example
network R1 is the Master router. When R1 is no longer available R2 becomes master.
Manual:Interface/VRRP
Backup
VR must contain at least one Backup router. Backup router must be configured with the same virtual IP as Master for
that VR. Default priority for Backup routers is 100. When current master router is no longer available, backup router
with highest priority will become current master. Every time when router with higher priority becomes available it is
switched to master. Sometimes this behavior is not necessary. To override it preemption mode should be disabled.
Virtual Address
Virtual IP associated with VR must be identical and set on all VR nodes. On Owner router Virtual IP must be the
same as real IP. For example on Owner router real IP and virtual IP is 192.168.1.1, on Backup router virtual IP is
192.168.1.1, but real IP is 192.168.1.2. All virtual and real addresses should be from the same network.
If the Master of VR is associated with multiple IP addresses, then Backup routers belonging to the same VR must
also be associated with the same set of virtual IP addresses. If virtual address on the Master is not also on Backup a
misconfiguration exists and VRRP advertisement packets will be discarded.
Note: It is not recommended to set up Mikrotik router as an Owner router. VRRP address and real IP address
should not be the same.
In IPv6 networks first address is always link-local address associated to VR. If multiple IPv6
addresses are configured, then they are added in advertisement packet after the link-local address.
IPv4 ARP
The Master for a given VR responds to ARP requests with the VR's assigned MAC address. Virtual MAC address is
also used as the source MAC address for advertisement packets sent by the Master. To ARP requests for non-virtual
IP addresses router responds with the system MAC address. Backup routers are not responding to ARP requests for
Virtual IPs.
IPv6 ND
As you already know there are no ARP in IPv6 networks, routers are discovered by Neighbor Discovery protocol.
When router becomes the Master, unsolicited ND Neighbor Advertisement with the Router Flag is sent for each IPv6
address associated with the virtual router.
20
Manual:Interface/VRRP
Init state
The purpose of this state is to wait for
a Startup event. When this event is
received, then following actions are
taken:
if priority is 255,
* for IPv4 send advertisement
VRRP state transition flow
packet and broadcast ARP requests
* for IPv6 send an unsolicited ND Neighbor Advertisement for each IPv6 address associated with the virtual
router and set target address to link-local address associated with VR.
* transit to MASTER state;
else transit to BACKUP state.
Backup state
When in backup state,
in IPv4 networks, node is not responding to ARP requests and is not forwarding traffic for the IP associated with
the VR.
in IPv6 networks, node is not responding to ND Neighbor Solicitation messages and is not sending ND Router
Advertisement messages for VR associated IPv6 addresses.
Routers main task is to receive advertisement packets and check if master node is available.
Backup router will transit itself to master state in two cases:
If priority in advertisement packet is 0;
When Preemption_Mode is set to no, or Priority in the ADVERTISEMENT is greater than or equal to the local
Priority
After transition to Master state node is:
in IPv4 broadcasts gratuitous ARP request;
in IPv6 sends an unsolicited ND Neighbor Advertisement for every associated IPv6 address.
In other cases advertisement packets will be discarded. When shutdown event is received, transit to Init state.
Note: Preemption mode is ignored if Owner router becomes available.
Master state
When MASTER state is set, node functions as a forwarding router for IPv4/IPv6 addresses
associated with the VR.
In IPv4 networks Master node responds to ARP requests for the IPv4 address associated with the VR. In IPv6
networks Master node:
21
Manual:Interface/VRRP
responds to ND Neighbor Solicitation message for the associated IPv6 address;
sends ND Router Advertisements for the associated IPv6 addresses.
If advertisement packet is received by master node:
If priority is 0, send advertisement immediately;
If priority in advertisement packet is greater than nodes priority then transit to backup state
If priority in advertisement packet is equal to nodes priority and primary IP Address of the sender is greater than
the local primary IP Address, then transit to backup state
Ignore advertisement in other cases
When shutdown event is received, send advertisement packet with priority=0 and transit to Init state.
Configuring VRRP
IPv4
Setting up Virtual Router is quite easy, only two actions are required - create vrrp interface and set Virtual Routers
IP address.
For example, add vrrp to ether1 and set VRs address to 192.168.1.1
/interface vrrp add name=vrrp1 interface=ether1
/ip address add address=192.168.1.1/32 interface=vrrp1
Notice that only 'interface' parameter was specified when adding vrrp. It is the only parameter required to be set
manually, other parameters if not specified will be set to their defaults: vrid=1, priority=100 and
authentication=none.
Note: address on VRRP interface must have /32 netmask.
Before VRRP can operate correctly correct IP address is required on ether1. In this example it is
192.168.1.2/24
VRRP Examples section contains several configuration examples.
IPv6
To make VRRP work in IPv6 networks, several additional options must be enabled - v3 support is required and
protocol type should be set to IPv6:
/interface vrrp add name=vrrp1 interface=ether1 version=3 v3-protocol=ipv6
Now when VRRP interface is set, we can add global address and enable ND advertisement:
/ipv6 address add address=FEC0:0:0:FFFF::1/64 advertise=yes interface=vrrp1
No additional address configuration is required as it is in IPv4 case. IPv6 uses link-local addresses to communicate
between nodes.
22
Manual:Interface/VRRP
23
Property reference
Sub-menu: /interface vrrp
Property
Description
none - should be used only in low security networks (e.g., two VRRP nodes on LAN).
ah - IP Authentication Header. This algorithm provides strong protection against configuration errors,
replay attacks and packet corruption/modification. Recommended when there is limited control over the
administration of nodes on a LAN.
simple - uses clear text password. Protects against accidental misconfiguration of routers on local
network.
VRRP update interval in seconds. Defines how often master sends advertisement packets.
Whether master node always has the priority. When set to 'no' backup node will not be elected to be a master
until the current master fails, even if the backup node has higher priority than the current master. This
setting is ignored if Owner router becomes available
priority (integer: 1..254; Default: Priority of VRRP node used in Master election algorithm. Higher number means higher priority. '255' is
100)
reserved to Router that owns VR IP and '0' is reserved for Master router to indicate that it is releasing
responsibility.
v3-protocol (ipv4 | ipv6;
Default: ipv4)
Virtual Router identifier. Each Virtual router must have unique id number
See more
VRRP-examples
[ Top | Back to Content ]
Manual:Bonding Examples
Manual:Bonding Examples
Bonding EoIP tunnels over two wireless links
This is an example of aggregating multiple network interfaces into a single pipe. In particular, it is shown how to
aggregate multiple virtual (EoIP) interfaces to get maximum throughput (MT) with emphasis on availability.
Network Diagram
Two routers R1 and R2 are interconnected via multihop wireless links. Wireless interfaces on both sides have
assigned IP addresses.
Getting started
Bonding could be used only on OSI layer 2 (Ethernet level) connections. Thus we need to create EoIP interfaces on
each of the wireless links. This is done as follows:
on router R1:
[admin@MikroTik] > /interface eoip add remote-address=10.0.1.1/24 tunnel-id=1
[admin@MikroTik] > /interface eoip add remote-address=10.0.2.1/24 tunnel-id=2
and on router R2
[admin@MikroTik] > /interface eoip add remote-address=10.1.1.1/24 tunnel-id=1
[admin@MikroTik] > /interface eoip add remote-address=10.2.2.1/24 tunnel-id=2
The second step is to add bonding interface and specify EoIP interfaces as slaves:
R1:
[admin@MikroTik] > / interface bonding add slaves=eoip-tunnel1,eoip-tunnel2 mode=balance-rr
R2
[admin@MikroTik] > / interface bonding add slaves=eoip-tunnel1,eoip-tunnel2 mode=balance-rr
24
Manual:Bonding Examples
Link Monitoring
It is easy to notice that with the configuration above as soon as any of individual link fails, the bonding interface
throughput collapses. That's because no link monitoring is performed, consequently, the bonding driver is unaware
of problems with the underlying links. Enabling link monitoring is a must in most bonding configurations. To enable
ARP link monitoring, do the following:
R1:
[admin@MikroTik] > / interface bonding set bonding1 link-monitoring=arp arp-ip-targets=192.168.0.2
R2
[admin@MikroTik] > / interface bonding set bonding1 link-monitoring=arp arp-ip-targets=192.168.0.1
25
Manual:Bonding Examples
Manual:VRRP-examples
Applies to RouterOS: v3, v4
Basic Setup
This is the basic VRRP configuration example.
According to this configuration, as long as the master, R1, is functional, all traffic destined to the external network
gets directed to R1. But as soon as R1 fails, R2 takes over as the master and starts handling packets forwarded to the
interface associated with IP(R1). In this setup Router R2 is completely idle during Backup period.
26
Manual:VRRP-examples
Configuration
R1 configuration:
/ip address add address=192.168.1.1/24 interface=ether1
/interface vrrp add interface=ether1 vrid=49 priority=254
/ip address add address=192.168.1.254/32 interface=vrrp1
R2 configuration:
/ip address add address=192.168.1.2/24 interface=ether1
/interface vrrp add interface=ether1 vrid=49
/ip address add address=192.168.1.254/32 interface=vrrp1
Testing
First of all check if both routers have correct flags at vrrp interfaces. On router R1 it should look like this
/interface vrrp print
0
As you can see vrrp interface mac addresses are identical on both routers. Now to check if vrrp is working correctly,
try to ping virtual address from client and check arp entries:
[admin@client] > /ping 192.168.1.254
192.168.1.254 64 byte ping: ttl=64 time=10 ms
192.168.1.254 64 byte ping: ttl=64 time=8 ms
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 8/9.0/10 ms
[admin@client] /ip arp> print
Flags: X - disabled, I - invalid, H - DHCP, D - dynamic
#
ADDRESS
MAC-ADDRESS
INTERFACE
...
1 D 192.168.1.254
00:00:5E:00:01:31 bridge1
Now unplug ether1 cable on router R1. R2 will become VRRP master, ARP table on client will not change but
traffic will start to flow over R2 router.
Load sharing
In basic configuration example R2 is completely idle during Backup state. This behavior may be considered as waste
of valuable resources. In such circumstances R2 router can be set as gateway for some clients.
The obvious advantage of this configuration is the establishment of a load-sharing scheme. But by doing so R2
router is not protected by current VRRP setup.
To make this setup work we need two virtual routers.
27
Manual:VRRP-examples
28
Configuration for V1 virtual router will be identical to configuration in basic example - R1 is the Master and R2 is
Backup router. In V2 Master is R2 and Backup is R1.
With this configuration, we establish a load-sharing between R1 and R2; moreover, we create protection setup by
having two routers acting as backups for each other.
Configuration
R1 configuration:
/ip address add
/interface vrrp
/interface vrrp
/ip address add
/ip address add
address=192.168.1.1/24 interface=ether1
add interface=ether1 vrid=49 priority=254
add interface=ether1 vrid=77
address=192.168.1.253/32 interface=vrrp1
address=192.168.1.254/32 interface=vrrp2
R2 configuration:
/ip address add
/interface vrrp
/interface vrrp
/ip address add
/ip address add
address=192.168.1.2/24 interface=ether1
add interface=ether1 vrid=49
add interface=ether1 vrid=77 priority=254
address=192.168.1.253/32 interface=vrrp1
address=192.168.1.254/32 interface=vrrp2
Manual:VRRP-examples
29
See Also
VRRP
Scripting
[ Top | Back to Content ]
Introduction
There are several types of switch chips on Routerboards and they have a different set of features. Most of them (from
now on "Other") have only basic "Port Switching" feature, but there are few with more features:
Capabilities of switch chips:
Feature
yes
yes
yes
yes
yes
yes
yes
yes
yes
no
Host table
2048 entries
2048 entries
1024 entries
2048 entries
no
no
Vlan table
4096 entries
4096 entries
4096 entries
16 entries
no
no
Rule table
92 rules
32 rules
no
no
no
no
30
Features
Port Switching
Switching feature allows wire speed traffic passing among a group of ports, like the ports were a regular ethernet
switch. You configure this feature by setting a "master-port" property to one ore more ports in /interface
ethernet menu. A 'master' port will be the port through which the RouterOS will communicate to all ports in the
group. Interfaces for which the 'master' port is specified become inactive - no traffic is received on them and no
traffic can be sent out.
For example consider a router with five ethernet interfaces:
[admin@MikroTik] > interface ethernet print
Flags: X - disabled, R - running, S - slave
#
NAME
MTU
MAC-ADDRESS
ARP
0 R ether1
1500 00:0C:42:3E:5D:BB enabled
1
ether2
1500 00:0C:42:3E:5D:BC enabled
2
ether3
1500 00:0C:42:3E:5D:BD enabled
3
ether4
1500 00:0C:42:3E:5D:BE enabled
4 R ether5
1500 00:0C:42:3E:5D:BF enabled
MASTER-PORT
SWITCH
none
none
none
none
switch1
switch1
switch1
switch1
And you configure a switch containing three ports ether3, ether4 and ether5:
[admin@MikroTik] /interface ethernet> set ether4,ether5 master-port=ether3
[admin@MikroTik] /interface ethernet> print
Flags: X - disabled, R - running, S - slave
#
NAME
MTU
MAC-ADDRESS
ARP
MASTER-PORT
SWITCH
0 R ether1
1500 00:0C:42:3E:5D:BB enabled
1
ether2
1500 00:0C:42:3E:5D:BC enabled
none
switch1
2 R ether3
1500 00:0C:42:3E:5D:BD enabled
none
switch1
1500
1500
31
00:0C:42:3E:5D:BE enabled
00:0C:42:3E:5D:BF enabled
ether3
ether3
switch1
switch1
ether3 is now the master port of the group. Note: you can see that previously a link was detected only on ether5, but
now as the ether3 is a 'master' the running flag is propagated to master port.
In essence this configuration is the same as if you had a RouterBoard with 3 ethernet interfaces with ether3
connected to ethernet switch that has 4 ports:
A more general diagram of RouterBoard with switch chip that has 5 port switch chip:
Here you can see that, a packet that gets received by one of the ports always passes through the switch logic at first.
Switch logic decides to which ports the packet should be going to. Passing packet 'up' or giving it to RouterOS is
also called sending it to switch chips 'cpu' port. That means that at the point switch forwards the packet to cpu port
the packet starts to get processed by RouterOS as some interfaces incoming packet. While the packet does not have
to go to cpu port it is handled entirely by switch logic and does not require any cpu cycles and happen at wire speed
for any frame size.
Ether1 port on RB450G has a feature that allows it to be removed/added to the default switch group. By default
ether1 port will be included in the switch group. This configuration can be changed with /interface
ethernet switch set switch1 switch-all-ports=no
switch-all-ports=yes/no "yes" means ether1 is part of switch and supports switch grouping, and all other advanced Atheros8316 features
including extended statistics (/interface ethernet print stats).
"no" means ether1 is not part of switch, effectivly making it as stand alone ethernet port, this way increasing its
troughtput to other ports in bridged, and routed mode, but removing the switching possibility on this port.
32
Port Mirroring
Port mirroring lets switch 'sniff' all traffic that is going in and out of one port (mirror-source) and send a copy of
those packets out of some other port (mirror-target). This feature can be used to easily set up a 'tap' device that
receives all traffic that goes in/out of some specific port. Note that mirror-source and mirror-target ports have to
belong to same switch. (See which port belong to which switch in /interface ethernet switch port
menu). Also mirror-target can have a special 'cpu' value, which means that 'sniffed' packets should be sent out of
switch chips cpu port. Port mirroring happens independently of switching groups that have or have not been set up.
Host Table
Basically the table represents switch chips internal mac address to port mapping. It can contain two kinds of entries:
dynamic and static. Dynamic entries get added automatically, this is also called a learning process: when switch chip
receives a packet from certain port, it adds the packets source mac address X and port it received the packet from to
host table, so when a packet comes in with destination mac address X it knows to which port it should forward the
packet. If the destination mac address is not present in host table then it forwards the packet to all ports in the group.
Dynamic entries take about 5 minutes to time out. Learning is enabled only on ports that are configured as part of
switch group. So you won't see dynamic entries if you have not specified some 'master-ports'. Also you can add
static entries that take over dynamic if dynamic entry with same mac-address already exists. Also by adding a static
entry you get access to some more functionality that is controlled via following params:
copy-to-cpu, redirect-to-cpu, mirror actions are performed for packets which destination mac matches mac address
specified in entry drop action is performed for packets which source mac address matches mac address specified in
entry
Another possibility for static entries is that mac address can be mapped to more that one port, including 'cpu' port.
Vlan Table
Vlan tables specifies certain forwarding rules for packets that have specific 802.1q tag. Those rules are of higher
priority than switch groups configured using 'master-port' property. Basically the table contains entries that map
specific vlan tag ids to a group of one or more ports. Packets with vlan tags leave switch chip through one or more
ports that are set in corresponding table entry. The exact logic that controls how packets with vlan tags are treated is
controlled by vlan-mode parameter that is changeable per switch port in /interface ethernet switch
port menu. Vlan-mode can take following values:
disabled - ignore vlan table, treat packet with vlan tags just as if they did not contain a vlan tag;
fallback - the default mode - handle packets with vlan tag that is not present in vlan table just like packets without
vlan tag. Packets with vlan tags that are present in vlan table, but incoming port does not match any port in vlan
table entry does not get dropped.
check - drop packets with vlan tag that is not present in vlan table. Packets with vlan tags that are present in vlan
table, but incoming port does not match any port in vlan table entry does not get dropped.
secure - drop packets with vlan tag that is not present in vlan table. Packets with vlan tags that are present in vlan
table, but incoming port does not match any port in vlan table entry get dropped.
Vlan tag id based forwarding also take into account the mac addresses learned or manually added in host table.
Packets without vlan tag are treated just like if they had a vlan tag with vlan id = 0. This means that if
"vlan-mode=check or secure" to be able to forward packets without vlan tags you have to add a special entry to vlan
33
Rule Table
Rule table is very powerful tool allowing wire speed packet filtering, forwarding and vlan tagging based on
L2,L3,L4 protocol header field condition.
Each rule contains a conditions part and an action part. Action part is controlled by following parameters:
copy-to-cpu=yes/no - clones matching packets and sends them to cpu port;
redirect-to-cpu=yes/no - redirects matching packets to cpu port;
mirror=yes/no - clones matching packets and send them to mirror-target port;
new-dst-ports - if set forces the destination port to be as specified, multiple ports allowed, including cpu port.
Non obvious feature of this parameter is to pass empty list of ports to drop matching packets;
new-vlan-id (only applies to Atheros8316) - if specified changes the vlan tag id, or add new vlan tag if one was
not present;
new-vlan-priority - if specified changes the vlan tag priority bits;
rate (only applies to Atheros8327) - Sets limitation (bits per second) for all matched traffic. Can only be applied
to first 32 rule slots.
Conditions part is controlled by rest of parameters:
ports - match port that packet came in from (multiple ports allowed);
mac layer conditions
ip conditions
ipv6 conditions
L4 conditions
src-port - match by tcp/udp source port range;
34
/interface
set ether3
set ether4
set ether5
ethernet
master-port=ether2
master-port=ether2
master-port=ether2
Assign "vlan-mode" and "vlan-header" mode for each port and "default-vlan-id" on ingress for each access port.
Set "vlan-mode=secure" to ensure strict use of VLAN table. Set "vlan-header=always-strip" for access ports - it
removes VLAN header from frame when it leaves the switch chip. Set "vlan-header=add-if-missing" for trunk
port - it adds VLAN header to untagged frames. "Default-vlan-id" specifies what VLAN ID is added for ingress
traffic of the access port.
/interface
set ether2
set ether3
set ether4
set ether5
35
Management IP Configuration
This example will show one of the possible management IP address configurations. Management IP will be
accessible only through trunk port and it will have a separate VLAN with ID 99.
Configure the port which connects switch-chip with CPU, set "vlan-header=leave-as-is" because management
traffic already should be tagged.
/interface ethernet switch port
set switch1_cpu vlan-mode=secure vlan-header=leave-as-is
Add VLAN table entry to allow management traffic through switch-cpu port and the trunk port.
/interface ethernet switch vlan
add ports=ether5,switch1_cpu switch=switch1 vlan-id=99
Add VLAN 99 and assign IP address to it. Since the master-port receives all the traffic coming from switch-cpu
port, VLAN has to be configured on master-port, in this case "ether2" port.
/interface vlan
add name=vlan99 vlan-id=99 interface=ether2
/ip address
add address=192.168.88.1/24 interface=vlan99 network=192.168.88.0
References
[1] http:/ / wiki. mikrotik. com/ wiki/ Manual:Switch_Chip_Features#switch-all-ports
[2] http:/ / wiki. mikrotik. com/ wiki/ Manual:Packet_flow_through_Atheros8316
36
37
MTU on RouterOS
Mikrotik RouterOS recognizes several types
of MTU:
IP/Layer-3/L3 MTU
MPLS/Layer-2.5/L2.5 MTU
MAC/Layer-2/L2 MTU
Full frame MTU
38
MAC/Layer-2/L2 MTU
L2MTU indicates the maximum size of the frame without MAC header that can be sent by this interface.
Starting from the RouterOS v3.25 L2MTU values can be seen in "/interface" menu. L2MTU support is added for all
Routerboard related Ethernet interfaces, VLANs, Bridge, VPLS and wireless interfaces. Some of them support
configuration of L2MTU value. All other Ethernet interfaces might indicate L2MTU only if the chip set is the same
as Routerboard Ethernets.
This will allow users to check if desired setup is possible. Users will be able to utilize additional bytes for VLAN
and MPLS tags, or simple increase of interface MTU to get rid of the some unnecessary fragmentation.
This table shows max-l2mtu supported by Mikrotik RouterBoards (Starting from the RouterOS v5.3 also available in
"/interface print" menu as value of read-only "max-l2mtu" option):
Integrated Solutions
RouterBoard
MTU description
RB Groove series
ether1:2028
RB Metal series
ether1:2028
RB SXT series
ether1:2028
ether1:4076
RB750
ether1:4076; ether2-ether5:2028
RB750UP
ether1:4076; ether2-ether5:2028
RB751U-2HnD
ether1:4076; ether2-ether5:2028
RouterBOARD
RB951-2n
ether1:4076; ether2-ether5:2028
RB951Ui-2HnD
ether1:4076; ether2-ether5:2028
RB750GL
ether1-ether5:4074
RB751G-2HnD
ether1-ether5:4074
RB951G-2HnD
ether1-ether5:4074
RB1200
RB1100AH
RB1100Hx2
RB1100AHx2
CCR series
ether1-ether12:10226
CRS125-24G-1S
ether1-ether24:4064, sfp1:4064
39
RouterBoard
MTU description
RB411 series
ether1:1526
RB433 series
ether1:1526; ether2-ether3:1522
RB450
ether1:1526; ether2-ether5:1522
RB493 series
ether1:1526; ether2-ether9:1522
RB411GL
ether1:1524
RB433GL
ether1-ether3:1524
RB435G
ether1-ether3:1520
RB450G
ether1-ether5:1520
RB493G
ether1-ether9:1520
RB711 series
ether1:2028
ether1-ether2:9500; ether3:9116
RB911G
ether1:4076
RB912UAG
ether1:4076
RB2011 series
RB44Ge
ether1-ether4:9116
Old Products
RouterBoard
MTU description
RB600 series
ether1-ether3:9500
RB1000
ether1-ether4:9500
RB1100
ether1-ether10:9498; ether11-ether13:9116
RB750G
ether1-ether5:1524
RB333
ether1-ether3:1632
RB1xx
ether1-ether5:1518; ether6-ether9:1514
ether1-ether4:7200
RB44GV
ether1-ether4:9000
All wireless interfaces in RouterOS (including Nstreme2) support 2290 byte L2MTU.
MPLS/Layer-2.5/L2.5 MTU
Configured in "/mpls interface" menu, specifies maximal size of packet, including MPLS labels, that is allowed to
send out by the particular interface (default is 1508).
Make sure that MPLS MTU is smaller or equal to L2MTU
MPLS MTU affects packets depending on what action MPLS router is performing. It is strongly recommended that
MPLS MTU is configured to the same value on all routers forming MPLS cloud because of effects MPLS MTU has
on MPLS switched packets. This requirement means that all interfaces participating in MPLS cloud must be
configured to the smallest MPLS MTU values among participating interfaces, therefore care must be taken to
properly select hardware to be used.
MPLS Switching
If packet with labels included is bigger than MPLS MTU, MPLS tries to guess protocol that is carried inside MPLS
frame.
If this is IP packet, MPLS produces ICMP Need Fragment error. This behavior mimics IP protocol behavior. Note
that this ICMP error is not routed back to originator of packet but is switched towards end of LSP, so that egress
router can route it back.
If this is not IP packet, MPLS simply drops it, because it does not know how to interpret the contents of packet. This
feature is very important in situations where MPLS applications such as VPLS are used (where frames that are
MPLS tagged are not IP packets, but e.g. encapsulated Ethernet frames as in case of VPLS) - if somewhere along the
LSP MPLS MTU will be less than packet size prepared by ingress router, frames will simply get dropped.
IP ingress
When router first introduces label (or labels) on IP packet, and resulting packet size including MPLS labels exceeds
MPLS MTU, router behaves as if interface MTU was exceeded - either fragments packet in fragments that does not
exceed MPLS MTU when labels are attached (if IP Dont Fragment is not set), or generates ICMP Need
Fragmentation error that is sent back to originator.
VPLS ingress
When router encapsulates Ethernet frame for forwarding over VPLS pseudowire, it checks if packet size with VPLS
Control Word (4 bytes) and any necessary labels (usually 2 labels - 8 bytes), exceeds MPLS MTU of outgoing
interface. If it does, VPLS fragments packet so that it honours MPLS MTU of outgoing interface. Packet is
defragmented at egress point of VPLS pseudowire.
IP/Layer-3/L3 MTU
Configured as interface MTU setting (/interface <type> <name> set mtu=X). Specifies how big IP packets router is
allowed to send out the particular interface.
If router receives IP packet of size 1500, but MTU for outgoing interface is set to 1400, router will either fragment
the packet (if "Don't Fragment" bit is not set in IP header) or drop the packet and send ICMP "Need Fragmentation"
error back to originator (this is essential for Path MTU Discovery to work).
Sometimes it can be bad idea to change IP MTU from its default 1500 bytes on router interfaces if complete path
end-to-end is not in administrators control. Although IP fragmentation and end-to-end Path MTU Discovery is
intended to handle this situation, if ICMP Need Fragmentation errors are filtered somewhere along the path, Path
MTU Discovery will not work.
There are several features in MikroTik RouterOS that can benefit from possibility to exceed standard MTU
40
Simple Examples
In these examples we will take a look at frames entering and leaving router via Ethernet interfaces.
Simple Routing
The image shows the packet MTU size for simple routing, packets size is not modified.
41
VPLS Tunnel
Two MPLS labels are present, when remote endpoint is not directly attached. One MPLS label is used to get to
remote endpoint, second label is used to identify VPLS tunnel.
42
Manual:Interface/Wireless
43
Manual:Interface/Wireless
Overview
Standards:
Package: wireless
RouterOS wireless comply with IEEE 802.11 standards, it provides complete support for 802.11a, 802.11b, 802.11g
and 802.11n as long as additional features like WPA, WEP, AES encryption, Wireless Distribution System (WDS),
Dynamic Frequency selection (DFS), Virtual Access Point, Nstreme and NV2 proprietary protocols and many more.
Wireless features compatibility table for different wireless protocols.
Wireless can operate in several modes: client (station), access point, wireless bridge etc. Client/station also can
operate in different modes, complete list of supported modes can be found here.
Description
adaptive-noise-immunity (ap-and-client-mode | client-mode | This property is only effective for cards based on Atheros chipset.
none; Default: none)
allow-sharedkey (yes | no; Default: no)
List of basic rates, used for 2.4ghz-b, 2.4ghz-b/g and 2.4ghz-onlyg bands.
Client will connect to AP only if it supports all basic rates announced by
the AP. AP will establish WDS link only if it supports all basic rates of the
other AP.
This property has effect only in AP modes, and when value of rate-set is
configured.
Manual:Interface/Wireless
44
Time in microseconds which will be used to send data without stopping.
Note that no other wireless cards in that network will be able to transmit
data during burst-time microseconds. This setting is available only for
AR5000, AR5001X, and AR5001X+ chipset based cards.
channel-width (10mhz | 20/40mhz-ht-above | 20/40mhz-ht-below ht above and ht below allows to use additional 20MHz extension channel
| 20mhz | 40mhz-turbo | 5mhz; Default: 20mhz)
and if it should be located below or above control (main) channel.
Extension channel allows 11n device to use 40MHz of spectrum in total
thus increasing max throughput.
comment (string; Default: )
Setting this property to yes will allow use of the hardware compression.
Wireless interface must have support for hardware compression.
Connections with devices that do not use compression will still work.
Limits available bands, frequencies and maximum transmit power for each
frequency. Also specifies default value of scan-list. Value no_country_set
is an FCC compliant set of channels.
This is the value of ap-tx-limit for clients that do not match any entry in
the access-list. 0 means no limit.
For AP mode, this is the value of authentication for clients that do not
match any entry in the access-list. For station mode, this is the value of
connect for APs that do not match any entry in the connect-list
default-client-tx-limit (integer [0..4294967295]; Default: This is the value of client-tx-limit for clients that do not match any entry in
0)
the access-list. 0 means no limit
default-forwarding (yes | no; Default: yes)
This is the value of forwarding for clients that do not match any entry in
the access-list
When set to yes interface will always have running flag. If value is set to
no', the router determines whether the card is up and running - for AP one
or more clients have to be registered to it, for station, it should be
connected to an AP.
This interval is measured from third sending failure on the lowest data rate.
At this point 3 * (hw-retries + 1) frame transmits on the lowest data rate
had failed.
During disconnect-timeout packet transmission will be retried with
on-fail-retry-time interval. If no frame can be transmitted successfully
during diconnect-timeout, connection is closed, and this event is logged as
"extensive data loss". Successful frame transmission resets this timer.
Manual:Interface/Wireless
45
Discard frames that have been queued for sending longer than
frame-lifetime. By default, when value of this property is 0, frames are
discarded only after connection is closed.
List of available channels for each band can be seen in /wireless info print.
This mode allows you to test wireless channels outside the default scan-list
and/or regulatory domain. This mode should only be used in controlled
environments, or if you have a special permission to use it in your region.
Before v4.3 this was called Custom Frequency Upgrade, or Superchannel.
Since RouterOS v4.3 this mode is available without special key upgrades to
all installations.
frequency-offset (integer [-2147483648..2147483647];
Default: 0)
yes - AP does not include SSID the beacon frames, and does not reply
to probe requests that have broadcast SSID.
no - AP includes SSID in the beacon frames, and replies to probe
requests that have broadcast SSID.
This property has effect only in AP mode. Setting it to yes can remove this
network from the list of wireless networks that are shown by some client
software. Changing this setting does not improve security of the wireless
network, because SSID is included in other frames sent by the AP.
ht-ampdu-priorities (list of integer [0..7]; Default: 0)
Manual:Interface/Wireless
46
[1]
Modulation and Coding Schemes
that every connecting client must
support (refer to 802.11n for MCS specification).
ht-supported-mcs (list of (mcs-0 | mcs-1 | mcs-2 | mcs-3 | mcs-4 Modulation and Coding Schemes that this device advertises as supported.
| mcs-5 | mcs-6 | mcs-7 | mcs-8 | mcs-9 | mcs-10 | mcs-11 | mcs-12 |
mcs-13 | mcs-14 | mcs-15 | mcs-16 | mcs-17 | mcs-18 | mcs-19 |
mcs-20 | mcs-21 | mcs-22 | mcs-23); Default: mcs-0; mcs-1; mcs-2;
mcs-3; mcs-4; mcs-5; mcs-6; mcs-7; mcs-8; mcs-9; mcs-10;
mcs-11; mcs-12; mcs-13; mcs-14; mcs-15; mcs-16; mcs-17;
mcs-18; mcs-19; mcs-20; mcs-21; mcs-22; mcs-23)
ht-txchains (list of integer [0..2]; Default: 0)
hw-fragmentation-threshold (integer[256..3000] | disabled; Specifies maximum fragment size in bytes when transmitted over wireless
Default: 0)
medium. 802.11 standard packet (MSDU in 802.11 terminology)
fragmentation allows packets to be fragmented before transmiting over
wireless medium to increase probability of successful transmission (only
fragments that did not transmit correctly are retransmitted). Note that
transmission of fragmented packet is less efficient than transmitting
unfragmented packet because of protocol overhead and increased resource
usage at both - transmitting and receiving party.
hw-protection-mode (cts-to-self | none | rts-cts; Default: none) Frame protection support property read more >>
hw-protection-threshold (integer [0..65535]; Default: 0)
Maximum number of associated clients. WDS links also count toward this
limit.
Manual:Interface/Wireless
47
Selection between different station and access point (AP) modes. Station
modes:
AP modes:
Special modes:
When set to full multicast packets will be sent with unicast destination
MAC address, resolving multicast problem on wireless link. This option
should be enabled only on access point, clients should be configured in
station-bridge mode. Available starting from v5.15.
disabled - disables the helper and sends multicast packets with multicast
destination MAC addresses
full - all multicast packet mac address are changed to unicast mac
addresses prior sending them out
default - default choice that currently is set to disabled. Value can be
changed in future releases.
noise-floor-threshold (default | integer [-128..127]; Default: This property is only effective for cards based on AR5211 chipset.
default)
Manual:Interface/Wireless
48
Setting affects the size of contention time slot that AP allocates for clients
to initiate connection and also size of time slots used for estimating
distance to client. When setting is too small, clients that are farther away
may have trouble connecting and/or disconnect with "ranging timeout"
error. Although during normal operation the effect of this setting should be
negligible, in order to maintain maximum performance, it is advised to not
increase this setting if not necessary, so AP is not reserving time that is
actually never used, but instead allocates it for actual data transfer.
Sets the packet priority mechanism, firstly data from high priority queue is
sent, then lower queue priority data until 0 queue priority is reached. When
link is full with high priority queue data, lower priority data is not sent. Use
it very carefully, setting works on AP
After third sending failure on the lowest data rate, wait for specified time
interval before retrying.
On AP:
Manual:Interface/Wireless
49
Descriptive name of the device, that is shown in registration table entries
on the remote devices.
This is a proprietary extension.
Starting from v5.9 default value is advanced since legacy mode was
inefficient.
scan-list
(Comma separated list of frequencies and frequency ranges | default;
Default: default)
default - default basic and supported rate sets are used. Values from
basic-rates and supported-rates parameters have no effect.
configured - use values from basic-rates, supported-rates, basic-mcs,
mcs. Read more >>.
The default value is all channels from selected band that are supported by
card and allowed by the country and frequency-mode settings (this list
can be seen in info). For default scan list in 5ghz band channels are taken
with 20MHz step, in 5ghz-turbo band - with 40MHz step, for all other
bands - with 5MHz step. If scan-list is specified manually, then all
matching channels are taken. (Example:
scan-list=default,5200-5245,2412-2427 - This will use the default value of
scan list for current band, and add to it supported frequencies from
5200-5245 or 2412-2427 range.)
supported-rates-a/g (list of rates [12Mbps | 18Mbps | 24Mbps List of supported rates, used for all bands except 2ghz-b.
| 36Mbps | 48Mbps | 54Mbps | 6Mbps | 9Mbps]; Default: 6Mbps;
9Mbps; 12Mbps; 18Mbps; 24Mbps; 36Mbps; 48Mbps; 54Mbps)
supported-rates-b (list of rates [11Mbps | 1Mbps | 2Mbps |
5.5Mbps]; Default: 1Mbps; 2Mbps; 5.5Mbps; 11Mbps)
List of supported rates, used for 2ghz-b, 2ghz-b/g and 2ghz-b/g/n bands.
Two devices will communicate only using rates that are supported by both
devices. This property has effect only when value of rate-set is configured.
Manual:Interface/Wireless
50
tx-power-mode (default, card-rates, all-rated-fixed, manual-table; sets up tx-power mode for wireless card
Default: default)
default - use values stored in the card
card-rates - use transmit power as defined by tx-power setting
all-rated-fixed - use same transmit power for all data rates. Can damage
the card if transmit power is set above rated value of the card for used
rate
manual-table - define transmit power for each rate separately. Can
damage the card if transmit power is set above rated value of the card
for used rate.
update-stats-interval (; Default: )
How often to request update of signals strength and ccq values from clients.
Access to registration-table also triggers update of these values.
This is proprietary extension.
When WDS link is established and status of the wds interface becomes
running, it will be added as a bridge port to the bridge interface specified
by this property. When WDS link is lost, wds interface is removed from the
bridge. If wds interface is already included in a bridge setup when WDS
link becomes active, it will not be added to bridge specified by , and will
(needs editing)
By default, WDS link between two APs can be created only when they
work on the same frequency and have the same SSID value. If this property
is set to yes, then SSID of the remote AP will not be checked. This property
has no effect on connections from clients in station-wds mode. It also does
not work if wds-mode is static-mesh or dynamic-mesh.
wds-mode (disabled | dynamic | dynamic-mesh | static | static-mesh; Controls how WDS links with other devices (APs and clients in station-wds
Default: disabled)
mode) are established.
Manual:Interface/Wireless
51
wireless-protocol (802.11 | any | nstreme | nv2 | nv2-nstreme | Specifies protocol used on wireless interface;
nv2-nstreme-802.11 | unspecified; Default: unspecified)
unspecified - protocol mode used on previous RouterOS versions (v3.x,
v4.x). Nstreme is enabled by old enable-nstreme setting, Nv2
configuration is not possible.
any : on AP - regular 802.11 Access Point or Nstreme Access Point; on
station - selects Access Point without specific sequence, it could be
changed by connect-list rules.
nstreme - enables Nstreme protocol (the same as old enable-nstreme
setting).
nv2 - enables Nv2 protocol.
nv2 nstreme : on AP - uses first wireless-protocol setting, always Nv2;
on station - searches for Nv2 Access Point, then for Nstreme Access
Point.
nv2 nstreme 802.11 - on AP - uses first wireless-protocol setting,
always Nv2; on station - searches for Nv2 Access Point, then for
Nstreme Access Point, then for regular 802.11 Access Point.
wmm-support (disabled | enabled | required; Default: disabled)
2.4ghz-b
1-11
2.4ghz-onlyg
1-11,6-54
2.4ghz-onlyn
0-7
0-23 1-11,6-54
2.4ghz-b/g
1-11
2.4ghz-b/g/n
1-11
none
0-23 1-11,6-54
2.4ghz-g-turbo 6
6-54
5ghz-a
6-54
5ghz-a/n
none
0-23 6-54
5ghz-onlyn
0-7
0-23 6-54
1-11,6-54
used settings
2.4ghz-b
basic-b, supported-b
2.4ghz-b/g, 2.4ghz-onlyg
basic-a/g,supported-a/g
5ghz-a/n, 5ghz-onlyn
basic-a/g,supported-a/g,basic-mcs,supported-mcs
Manual:Interface/Wireless
2. if standard channel width (20Mhz) is not used, then 2ghz modes (except 2.4ghz-b) are not using b rates (1-11)
Nv2
MikroTik has developed a new wireless protocol based on TDMA technology (Time Division Multiple Access) (Nstreme version 2). See the Nv2 documentation: NV2
TDMA is a channel access method for shared medium networks. It allows several users to share the same frequency
channel by dividing the signal into different time slots. The users transmit in rapid succession, one after the other,
each using his own time slot. This allows multiple stations to share the same transmission medium (e.g. radio
frequency channel) while using only a part of its channel capacity.
The most important benefits of Nv2 are:
Increased speed
More client connections in PTM environments
Lower latency
No distance limitations
No penalty for long distances
Starting from RouterOS v5.0beta5 you can configure Nv2 in the Wireless menu. Please take a look at the NV2
protocol implementation status. Nv2 protocol limit is 511 clients.
52
Manual:Interface/Wireless
Nv2 Troubleshooting
Increase throughput on long distance with tdma-period-size. In Every "period", the Access Point leaves part of the
time unused for data transmission (which is equal to round trip time - the time in which the frame can be sent and
received from the client), it is used to ensure that client could receive the last frame from Access Point, before
sending it's own packets to it. The longer the distance, the longer the period is unused.
For example, the distance between Access Point and client is 30km. Frame is sent in 100us one direction,
respectively round-trip-time is ~200us. tdma-period-size default value is 2ms, it means 10% of the time is unused.
When tdma-period-size is increased to 4ms, only 5% of time is unused. For 60km wireless link, round-trip-time is
400ms, unused time is 20% for default tdma-period-size 2ms, and 10% for 4ms. Bigger tdma-period-size value
increases latency on the link.
Access List
Sub-menu: /interface wireless access-list
Access list is used by access point to restrict allowed connections from other devices, and to control connection
parameters.
Operation:
For example, if client's signal during connection is -41 and we have ACL rule
53
Manual:Interface/Wireless
54
Properties
Property
Description
Station will be disconnected after specified time ends. Both start and
end time is expressed as time since midnight, 00:00.
Rule will match only during specified days of the week.
Align
Sub-menu: /interface wireless align
Manual:Interface/Wireless
55
Property
Description
If set to "no", monitoring will work only if both wireless stations are in align
mode.
Whether to show all SSIDs in the monitor or only one configured in wireless
settings.
Description
Start align monitoring
Connect List
Sub-menu: /interface wireless connect-list
connect-list is used to assign priority and security settings to connections with remote access points, and to restrict
allowed connections. connect-list is an ordered list of rules. Each rule in connect-list is attached to specific wireless
interface, specified in the interface property of that rule (this is unlike access-list, where rules can apply to all
interfaces). Rule can match MAC address of remote access point, it's signal strength and many other parameters.
Operation:
connect-list rules are always checked sequentially, starting from the first.
disabled rules are always ignored.
Only the first matching rule is applied.
If connect-list does not have any rule that matches remote access point, then the default values from the wireless
interface configuration are used.
If access point is matched by rule that has connect=no value, connection with this access point will not be
attempted.
If access point is matched by rule that has connect=yes value, connection with this access point will be attempted.
In station mode, if several remote access points are matched by connect list rules with connect=yes value,
connection will be attempted with access point that is matched by rule higher in the connect-list.
If no remote access points are matched by connect-list rules with connect=yes value, then value of
default-authentication interface property determines whether station will attempt to connect to any access
point. If default-authentication=yes, station will choose access point with best signal and compatible security.
In access point mode, connect-list is checked before establishing WDS link with remote device. If access point is
not matched by any rule in the connect list, then the value of default-authentication determines whether WDS
Manual:Interface/Wireless
56
Properties
Property
Description
Rule matches if area value of AP (a proprietary extension) begins with specified value.area value
is a proprietary extension.
Available options:
Rule matches only AP with the specified MAC address. Value 00:00:00:00:00:00 matches always.
Name of security profile that is used when connecting to matching access points, If value of this
property is none, then security profile specified in the interface configuration will be used.
In station mode, rule will match only access points that can support specified security profile.
Value none will match access point that support security profile that is specified in the interface
configuration. In access point mode value of this property will not be used to match remote
devices.
Rule matches if signal strength of the access point is within the range.
Rule matches access points that have this SSID. Empty value matches any SSID.
If station establishes connection to access point that is matched by this rule, it will disconnect from
that access point when signal strength goes out of the specified range.
This property has effect only when station mode interface ssid is empty, or when access point
mode interface has wds-ignore-ssid=yes
wireless-protocol (802.11 | any |
nstreme | tdma; Default: any)
interface (string; Default: )
Each rule in connect list applies only to one wireless interface that is specified by this setting.
Usage
Restrict station connections only to specific access points
Set value of default-authentication interface property to no.
/interface wireless set station-wlan default-authentication=no
Create rules that matches allowed access points. These rules must have connect=yes and interface equal to the
name of station wireless interface.
/interface
wireless
connect-list
add
connect=yes mac-address=00:11:22:33:00:01
interface=station-wlan
Manual:Interface/Wireless
57
interface=station-wlan
Info
Sub-menu: /interface wireless info
Property
2ghz-10mhz-power-channels ()
2ghz-11n-channels ()
2ghz-5mhz-power-channels ()
2ghz-b-channels ()
2ghz-g-channels ()
2ghz-g-turbo-channels ()
5ghz-10mhz-power-channels ()
5ghz-11n-channels ()
5ghz-5mhz-power-channels ()
5ghz-channels ()
5ghz-turbo-channels ()
capabilities ()
chip-info ()
default-periodic-calibration ()
firmware ()
ht-chains ()
interface-type ()
name ()
pci-info ()
supported-bands ()
Description
Manual:Interface/Wireless
58
Description
Nstreme
Sub-menu: /interface wireless nstreme
This menu allows to switch a wireless card to the nstreme mode. In this case the card will work only with nstreme
clients.
Property
comment (string; Default: )
Description
Short description of an entry
disable-csma (yes | no; Default: Disable CSMA/CA when polling is used (better performance)
no)
enable-nstreme (yes | no;
Default: no)
framer-limit (integer
[100..4000]; Default: 3200)
framer-policy (best-fit |
dynamic-size | exact-size | none;
Default: none)
The method how to combine frames. A number of frames may be combined into a bigger one to reduce the
amount of protocol overhead (and thus increase speed). The card is not waiting for frames, but in case a
number of packets are queued for transmitting, they can be combined. There are several methods of
framing:
name (string)
Note: The settings here (except for enabling nstreme) are relevant only on Access Point, they are ignored for
client devices! The client automatically adapts to the AP settings.
WDS for Nstreme protocol requires using station-wds mode on one of the peers. Configurations with WDS
between AP modes (bridge and ap-bridge) will not work.
Manual:Interface/Wireless
59
Nstreme Dual
Sub-menu: /interface wireless nstreme-dual
Two radios in nstreme-dual-slave mode can be grouped together to make nstreme2 Point-to-Point connection. To put
wireless interfaces into a nstreme2 group, you should set their mode to nstreme-dual-slave. Many parameters from
/interface wireless menu are ignored, using the nstreme2, except:
frequency-mode
country
antenna-gain
tx-power
tx-power-mode
antenna-mode
Property
Description
framer-policy (best-fit | exact-size | none; Default: none) The method how to combine frames. A number of frames may be combined into
one bigger one to reduce the amout of protocol overhead (and thus increase
speed). The card are not waiting for frames, but in case a number packets are
queued for transmitting, they can be combined. There are several methods of
framing:
Name of an entry
Manual:Interface/Wireless
60
Which MAC address to connect to (this would be the remote receiver card's MAC
address)
rx-band (2ghz-b | 2ghz-g | 2ghz-n | 5ghz-a | 5ghz-n; Default: Operating band of the receiving radio
)
rx-channel-width (10mhz; Default: 20mhz)
rx-frequency (integer [0..4294967295]; Default: )
tx-band (2ghz-b | 2ghz-g | 2ghz-n | 5ghz-a | 5ghz-n; Default: Operating band of the transmitting radio
)
tx-channel-width (10mhz; Default: 20mhz)
tx-frequency (integer [0..4294967295]; Default: )
Note: The difference between tx-freq and rx-freq should be about 200MHz (more is recommended) because
of the interference that may occur!
Note: You can use different bands for rx and tx links. For example, transmit in 2ghz-g and receive data, using
2ghz-b band.
Registration Table
Sub-menu: /interface wireless registration-table
In the registration table you can see various information about currently connected clients. It is used only for Access
Points.
All properties are read-only.
Property
Description
802.1x-port-enabled (yes whether the data exchange is allowed with the peer (i.e., whether 802.1x authentication is completed, if needed)
| no)
ack-timeout (integer)
ap (yes | no)
ap-tx-limit (integer)
authentication-type ()
client-tx-limit (integer)
Manual:Interface/Wireless
61
comment (string)
Description of an entry. comment is taken from appropriate Access List entry if specified.
distance (integer)
encryption (aes-ccm | tkip)
evm-ch0 ()
evm-ch1 ()
evm-ch2 ()
frame-bytes (integer,integer) number of sent and received data bytes excluding header information
frames (integer,integer)
Number of frames that need to be sent over wireless link. This value can be compared to hw-frames to check
wireless retransmits. Read more >>
framing-current-size
(integer)
framing-limit (integer)
framing-mode ()
group-encryption ()
hw-frame-bytes
(integer,integer)
hw-frames (integer,integer)
Number of frames sent over wireless link by the driver. Tihs value can be compared to frames to check
wireless retransmits. Read more >>
interface (string)
last-activity (time)
IP address found in the last IP packet received from the registered client
mac-address (MAC)
management-protection
(yes | no)
nstreme (yes | no)
p-throughput (integer)
estimated approximate throughput that is expected to the given peer, taking into account the effective transmit
rate and hardware retries. Calculated once in 5 seconds
packed-bytes (integer,
integer)
packed-frames (integer,
integer)
packets (integer.integer)
radio-name (string)
routeros-version (string)
rx-ccq ()
rx-rate (integer)
signal-strength (integer)
signal-strength-ch0 ()
signal-strength-ch1 ()
signal-strength-ch2 ()
signal-to-noise ()
Manual:Interface/Wireless
strength-at-rates ()
62
signal strength level at different rates together with time how long were these rates used
tdma-retx ()
tdma-rx-size ()
tdma-timing-offset ()
tdma-timing-offset is proportional to distance and is approximately two times the propagation delay. AP
measures this so that it can tell clients what offset to use for their transmissions - clients then subtract this offset
from their target transmission time such that propagation delay is accounted for and transmission arrives at AP
when expected. You may occasionally see small negative value (like few usecs) there for close range clients
because of additional unaccounted delay that may be produced in transmitter or receiver hardware that varies
from chipset to chipset.
tdma-tx-size (integer)
Value in bytes that specifies the size of data unit whose loss can be detected (data unit over which CRC is
calculated) sent by device. In general - the bigger the better, because overhead is less. On the other hand, small
value in this setting can not always be considered a signal that connection is poor - if device does not have
enough pending data that would enable it to use bigger data units (e.g. if you are just pinging over link), this
value will not go up.
tdma-windfull ()
tx-ccq ()
tx-evm-ch0 ()
tx-evm-ch1 ()
tx-evm-ch2 ()
tx-frames-timed-out ()
tx-rate ()
tx-signal-strength ()
tx-signal-strength-ch0
()
tx-signal-strength-ch1
()
tx-signal-strength-ch2
()
uptime (time)
Security Profiles
Sub-menu: /interface wireless security-profiles
Security profiles are configured under the /interface wireless security-profiles path in the console, or in the
"Security Profiles" tab of the "Wireless" window in the WinBox. Security profiles are referenced by the wireless
interface security-profile parameter and security-profile parameter of the connect lists.
Basic properties
mode (one of none, static-keys-optional, static-keys-required or dynamic-keys; default value: none) :
none - Encryption is not used. Encrypted frames are not accepted.
static-keys-required - WEP mode. Do not accept and do not send unencrypted frames.
Station in static-keys-required mode will not connect to an access point in static-keys-optional mode.
Manual:Interface/Wireless
static-keys-optional - WEP mode. Support encryption and decryption, but allow also to receive and send
unencrypted frames. Device will send unencrypted frames if encryption algorithm is specified as none.
Station in static-keys-optional mode will not connect to an access point in static-keys-required mode.
See also: static-sta-private-algo, static-transmit-key
dynamic-keys - WPA mode.
name : see generic properties
WPA properties
These properties have effect only when mode=dynamic-keys.
authentication-types (multiple choice of wpa-psk, wpa2-psk, wpa-eap and wpa2-eap; default value is empty) :
Set of supported authentication types. Access point will advertise supported authentication types, and client will
connect to access point only if supports any of the advertised authentication types.
unicast-ciphers (multiple choice of tkip, aes-ccm; default value is empty) : Access point advertises that it
supports specified ciphers. Client attempts connection only to access points that supports at least one of the
specified ciphers.
One of the ciphers will be used to encrypt unicast frames that are sent between access point and station.
group-ciphers (multiple choice of tkip, aes-ccm; default value is empty) : Access point advertises one of these
ciphers, and uses it to encrypt all broadcast and multicast frames. Client attempts connection only to access points
that use one of the specified group ciphers.
tkip - Temporal Key Integrity Protocol - encryption protocol, compatible with lagacy WEP equipment, but
enhanced to correct some of WEP flaws
aes-ccm - more secure WPA encryption protocol, based on the reliable AES (Advanced Encryption Standard).
Networks free of WEP legacy should use only this
group-key-update (time interval in the 30s..1h range; default value: 5m) : Controls how often access point
updates group key. This key is used to encrypt all broadcast and multicast frames.
This property has no effect in station mode.
wpa-pre-shared-key, wpa2-pre-shared-key (text) : WPA and WPA2 pre-shared key mode requires all devices
in a BSS to have common secret key. Value of this key can be an arbitrary text.
RouterOS also allows to override pre-shared key value for specific clients, using either private-pre-shared-key
property in the access-list, or the Mikrotik-Wireless-Psk attribute in the RADIUS MAC authentication response.
This is an extension.
These properties have effect only when authentication-types contains either wpa-psk or wpa2-psk.
wpa-pre-shared-key is used for wpa-psk authentication type. wpa2-pre-shared-key is used for wpa2-psk.
WPA EAP properties
These properties have effect only when authentication-types contains wpa-eap or wpa2-eap, and
mode=dynamic-keys.
eap-methods (array of eap-tls, passthrough) :
eap-tls - Use built-in EAP TLS authentication. Both client and server certificates are supported. See
description of tls-mode and tls-certificate properties.
passthrough - Access point will relay authentication process to the RADIUS server. This value is ignored in
station mode.
Order of values is significant for access point configuration, it is used by access point when offering specified
methods to clients.
63
Manual:Interface/Wireless
Example: Access point uses security-profile where eap-methods=eap-tls,passthrough:
Access point offers EAP-TLS method to the client.
Client refuses.
Access point starts relaying EAP communication to the radius server.
supplicant-identity (text; default value is same as system/identity of router at the moment of profile creation) :
EAP identity that is sent by client at the beginning of EAP authentication. This value is used as a value for
User-Name attribute in RADIUS messages sent by RADIUS EAP accounting and RADIUS EAP pass-through
authentication.
tls-mode (one of verify-certificate, dont-verify-certificate, no-certificates; default value: no-certificates) :
verify-certificate - Require remote device to have valid certificate. Check that it is signed by known certificate
authority. No additional identity verification is done.
Note: Certificate may include information about time period during which it is valid. If router has incorrect
time and date, it may reject valid certificate because router's clock is outside that period.
See also: certificate configuration.
dont-verify-certificate - Do not check certificate of the remote device. Access point will not require client to
provide certificate.
no-certificates - Do not use certificates. TLS session is established using 2048 bit anonymous Diffie-Hellman
key exchange.
When using first two modes, remote device has to support one of the "RC4-MD5", "RC4-SHA" or
"DES-CBC3-SHA" TLS cipher suites. In the last mode remote device must support "ADH-DES-CBC3-SHA"
cipher suite.
This property has effect only when eap-methods contains eap-tls.
tls-certificate (none or name of certificate; default value: none) : Access point always needs certificate when
configured with tls-mode=verify-certificate, or tls-mode=dont-verify-certificate. Client needs certificate only if
access point is configured with tls-mode=verify-certificate. In this case client needs valid certificate that is signed
by CA known to the access point.
This property has effect only if tls-modeno-certificates.
This property has effect only when eap-methods contains eap-tls.
RADIUS properties
radius-mac-authentication (yes or no; default value: no) : This property affects the way how access point
processes clients that are not found in the access-list.
no - allow or reject client authentication based on the value of default-authentication property of the wireless
interface.
yes - Query RADIUS server using MAC address of client as user name. With this setting the value of
default-authentication has no effect.
radius-mac-accounting (yes or no; default value: no) : (needs editing)
radius-eap-accounting (yes or no; default value: no) : (needs editing)
interim-update (time interval; default value: 0) : When RADIUS accounting is used, access point periodically
sends accounting information updates to the RADIUS server. This property specifies default update interval that
can be overridden by the RADIUS server using Acct-Interim-Interval attribute.
radius-mac-format (one of XX:XX:XX:XX:XX:XX, XXXX:XXXX:XXXX, XXXXXX:XXXXXX,
XX-XX-XX-XX-XX-XX, XXXXXX-XXXXXX, XXXXXXXXXXXX, XX XX XX XX XX XX; default value:
XX:XX:XX:XX:XX:XX) : Controls how MAC address of the client is encoded by access point in the User-Name
attribute of the MAC authentication and MAC accounting RADIUS requests.
64
Manual:Interface/Wireless
radius-mac-mode (one of as-username, as-username-and-password; default value: as-username) : By default
access point uses empty password, when sending Access-Request during MAC authentication. When this
property is set to as-username-and-password, access point will use the same value for User-Password attribute as
for the User-Name attribute.
radius-mac-caching (either disabled or time interval; default value: disabled) : If this value is set to time interval,
the access point will cache RADIUS MAC authentication responses for specified time, and will not contact
RADIUS server if matching cache entry already exists. Value disabled will disable cache, access point will
always contact RADIUS server.
WEP properties
These properties have effect only when mode is static-keys-required or static-keys-optional. See section
"Wireless#Statically_configured_WEP_keys".
static-key-0, static-key-1, static-key-2, static-key-3 (hexadecimal representation of the key. Length of key must
be appropriate for selected algorithm - see section "Statically configured WEP keys; default value is empty) :
(needs editing)
static-algo-0, static-algo-1, static-algo-2, static-algo-3 (one of none, 40bit-wep, 104bit-wep, tkip or aes-ccm;
default value: none) : Encryption algorithm to use with the corresponding key.
static-transmit-key (one of key-0, key-1, key-2 or key-3; default value: key-0) : Access point will use the
specified key to encrypt frames for clients that do not use private key. Access point will also use this key to
encrypt broadcast and multicast frames.
Client will use the specified key to encrypt frames if static-sta-private-algo=none.
If corresponding static-algo- property has value none, frame will be sent unencrypted (when
mode=static-keys-optional) or will not be sent at all (when mode=static-keys-required).
static-sta-private-key (hexadecimal representation of the key. Length of key must be appropriate for selected
algorithm - see section "Statically configured WEP keys") : This property is used only in station mode. Access
point uses corresponding key either from private-key property of access-list, or from Mikrotik-Wireless-Enc-Key
attribute in RADIUS Access-Accept MAC authentication response.
static-sta-private-algo (one of none, 40bit-wep, 104bit-wep, tkip or aes-ccm) : Encryption algorithm to use with
station private key. Value none disables use of the private key.
This property is used only in station mode. Access point has to get corresponding value either from
private-algo property of access-list, or from Mikrotik-Wireless-Enc-Algo attribute in RADIUS Access-Accept
MAC authentication response.
Station private key replaces key 0 for unicast frames. Station will not use private key to decrypt broadcast
frames.
65
Manual:Interface/Wireless
66
remote devices that support management protection (for AP - accept only clients that support management
protection, for client - connect only to APs that support management protection).
Management protection shared secret is configured with security-profile management-protection-key setting.
When interface is in AP mode, default management protection key (configured in security-profile) can be overridded
by key specified in access-list or RADIUS attribute.
[admin@mikrotik] /interface wireless security-profiles> print
0 name="default" mode=none authentication-types="" unicast-ciphers=""
group-ciphers="" wpa-pre-shared-key="" wpa2-pre-shared-key=""
supplicant-identity="n-str-p46" eap-methods=passthrough
tls-mode=no-certificates tls-certificate=none static-algo-0=none
static-key-0="" static-algo-1=none static-key-1="" static-algo-2=none
static-key-2="" static-algo-3=none static-key-3=""
static-transmit-key=key-0 static-sta-private-algo=none
static-sta-private-key="" radius-mac-authentication=no
radius-mac-accounting=no radius-eap-accounting=no interim-update=0s
radius-mac-format=XX:XX:XX:XX:XX:XX radius-mac-mode=as-username
radius-mac-caching=disabled group-key-update=5m
management-protection=disabled management-protection-key=""
[admin@mikrotik] /interface wireless security-profiles> set default management-protection=
allowed
disabled
required
Manual:Interface/Wireless
Operation details
RADIUS MAC authentication
Note: RAIDUS MAC authentication is used by access point for clients that are not found in the access-list, similarly
to the default-authentication property of the wireless interface. It controls whether client is allowed to proceed with
authentication, or is rejected immediately.
When radius-mac-authentication=yes, access point queries RADIUS server by sending Access-Request with the
following attributes:
User-Name - Client MAC address. This is encoded as specified by the radius-mac-format setting. Default
encoding is "XX:XX:XX:XX:XX:XX".
Nas-Port-Id - name of wireless interface.
User-Password - When radius-mac-mode=as-username-and-password this is set to the same value as
User-Name. Otherwise this attribute is empty.
Calling-Station-Id - Client MAC address, encoded as "XX-XX-XX-XX-XX-XX".
Called-Station-Id - MAC address and SSID of the access point, encoded as "XX-XX-XX-XX-XX-XX:SSID"
(minus separated pairs of MAC address digits, followed by colon, followed by SSID value).
Acct-Session-Id - Added when radius-mac-accounting=yes.
When access point receives Access-Accept or Access-Reject response from the RADIUS server, it stores the
response and either allows or rejects client. Access point uses following RADIUS attributes from the Access-Accept
response:
Ascend-Data-Rate
Ascend-Xmit-Rate
Mikrotik-Wireless-Forward - Same as access-list forwarding.
Mikrotik-Wireless-Enc-Algo - Same as access-list private-algo.
Mikrotik-Wireless-Enc-Key - Same as access-list private-key.
Mikrotik-Wireless-Psk - Same as access-list private-pre-shared-key.
Session-Timeout - Time, after which client will be disconnected.
Acct-Interim-Interval - Overrides value of interim-update.
Class - If present, value of this attribute is saved and included in Accounting-Request messages.
Caching
Caching of RADIUS MAC authentication was added to support RADIUS authentication for clients that require from
the access point very quick response to the association request. Such clients time out before response from RADIUS
server is received. Access point caches authentication response for some time and can immediately reply to the
repeated association request from the same client.
RADIUS EAP pass-through authentication
When using WPA EAP authentication type, clients that have passed MAC authentication are required to perform
EAP authentication before being authorized to pass data on wireless network. With pass-through EAP method the
access point will relay authentication to RADIUS server, and use following attributes in the Access-Request
RADIUS message:
User-Name - EAP supplicant identity. This value is configured in the supplicant-identity property of the client
security profile.
Nas-Port-Id - name of wireless interface.
Calling-Station-Id - Client MAC address, encoded as "XX-XX-XX-XX-XX-XX".
67
Manual:Interface/Wireless
Called-Station-Id - MAC address and SSID of the access point, encoded as "XX-XX-XX-XX-XX-XX:SSID"
(pairs of MAC address digits separated by minus sign, followed by colon, followed by SSID value).
Acct-Session-Id - Added when radius-eap-accounting=yes.
Acct-Multi-Session-Id - MAC address of access point and client, and unique 8 byte value, that is shared for all
accounting sessions that share single EAP authentication. Encoded as
AA-AA-AA-AA-AA-AA-CC-CC-CC-CC-CC-CC-XX-XX-XX-XX-XX-XX-XX-XX.
Added when radius-eap-accounting=yes.
Access point uses following RADIUS attributes from the Access-Accept server response:
Class - If present, value of this attribute is saved and included in Accounting-Request messages.
Session-Timeout - Time, after which client will be disconnected. Additionally, access point will remember
authentication result, and if during this time client reconnects, it will be authorized immediately, without
repeating EAP authentication.
Acct-Interim-Interval - Overrides value of interim-update.
Statically configured WEP keys
Different algorithms require different length of keys:
40bit-wep - 10 hexadecimal digits (40 bits). If key is longer, only first 40 bits are used.
104bit-wep - 26 hexadecimal digits (104 bits). If key is longer, only first 104 bits are used.
tkip - At least 64 hexadecimal digits (256 bits).
aes-ccm - At least 32 hexadecimal digits (128 bits).
Key must contain even number of hexadecimal digits.
WDS security configuration
WDS links can use all available security features. However, they require careful configuration of security
parameters.
It is possible to use one security profile for all clients, and different security profiles for WDS links. Security profile
for WDS link is specified in connect-list. Access point always checks connect list before establishing WDS link with
another access point, and used security settings from matching connect list entry. WDS link will work when each
access point will have connect list entry that matches the other device, has connect=yes and specifies compatible
security-profile.
WDS and WPA/WPA2
If access point uses security profile with mode=dynamic-keys, then encryption will be used for all WDS links. Since
WPA authentication and key exchange is not symmetrical, one of the access points will act as a client for the purpose
of establishing secure connection. This is similar to how static-mesh and dynamic-mesh WDS modes work. Some
problems, like single sided WDS link between two incorrectly configured access points that use non-mesh mode, is
not possible if WPA encryption is enabled. However, non-mesh modes with WPA still have other issues (like
constant reconnection attempts in case of configuration mismatch) that are solved by use of the -mesh WDS modes.
In general, WPA properties on both access points that establish WPA protected WDS link have to match. These
properties are authentication-types, unicast-ciphers, group-ciphers. For non-mesh WDS mode these properties
need to have the same values on both devices. In mesh WDS mode each access point has to support the other one as
a client.
Theoretically it is possible to use RADIUS MAC authentication and other RADIUS services with WDS links.
However, only one access point will interact with the RADIUS server, the other access point will behave as a client.
68
Manual:Interface/Wireless
69
Implementation of eap-tls EAP method in RouterOS is particularly well suited for WDS link encryption.
tls-mode=no-certificates requires no additional configuration, and provides very strong encryption.
WDS and WEP
mode, static-sta-private-key and static-sta-private-algo parameters in the security profile assigned to the WDS
link need to have the same values on both access points that establish WDS link with WPA encryption.
Security profile and access point matching in the connect list
Client uses value of connect-list security-profile property to match only those access points that support necessary
security.
mode=static-keys-required and mode=static-keys-optional matches only access points with the same mode in
interface security-profile.
If mode=dynamic-keys, then connect list entry matches if all of the authentication-types, unicast-ciphers and
group-ciphers contain at least one value that is advertised by access point.
Sniffer
Sub-menu: /interface wireless sniffer
Wireless sniffer allows to capture frames including Radio header, 802.11 header and other wireless related
information.
Property
Description
Allocated file size in bytes which will be used to store captured data. Applicable if
file-name is specified.
If set to yes, then sniffer will capture only information stored in frame headers.
Manual:Interface/Wireless
Packets
Sub-menu: /interface wireless sniffer packet
Sub-menu shows captured packets.
Snooper
This tool monitors surrounding frequency usage, and displays which devices occupy each frequency. It's available
both in console, and also in Winbox.
Sub-menu: /interface wireless snooper
70
Manual:Interface/Wireless
Settings
Spectral scan
See separate document Manual:Spectral_scan
WDS
Sub-menu: /interface wireless wds
Properties:
71
Manual:Interface/Wireless
72
Property
Description
Read-only properties:
Property
dynamic (yes | no)
mac-address (MAC)
running (yes | no)
References
[1] http:/ / en. wikipedia. org/ wiki/ IEEE_802. 11n-2009#Data_rates
Description
Manual:Wireless AP Client
Manual:Wireless AP Client
Applies to RouterOS: v3, v4
Summary
Configuration example shows how to establish simple wireless network by using MikroTik RouterOS. MikroTik
RouterOS is fully compliant with IEEE802.11a/b/g/n standards, MikroTik RouterOS device [1] can be used as
wireless access-point and wireless station (other modes [2] are supported too).
Configuration setup
Our basic configuration setup is
73
Manual:Wireless AP Client
These settings are enough to establish wireless connection, additionally you need to add IP address for the
wireless interface for IP routing, optionally add security and other settings.
74
Manual:Wireless AP Client
Station Configuration
Wireless client configuration example is for MikroTik RouterOS, other vendor OS configuration should be
looked in the appropriate documentation/forum/mailing list etc.
Connect to the client router via the same way and proceed to the Wireless interface configuration.
Necessary configuration options are mode=station band=band_ap_operates_on ssid=ap_network_ssid
These settings are enough to establish wireless connection, additionally you need to set IP address for the wireless
interface to establish IP routing communication with access point, optionally use security and other settings.
75
Manual:Wireless AP Client
Additional Configuration
IP Configuration
Add IP address to Access Point router, like 192.168.0.1/24
Add IP address to Client router, address should be from the same subnet like 192.168.0.2/24
76
Manual:Wireless AP Client
References
[1]
[2]
[3]
[4]
[5]
77
)-[STA]---[Y]
where X-to-AP and STA-to-Y are ethernet links, but AP-to-STA are connected wirelessly. According to 802.11, AP
can transparently bridge traffic between X and STA, but it is not possible to bridge traffic between AP and Y, or X
and Y.
802.11 standard specifies that frames between station and AP device must be transmitted in so called 3 address
frame format, meaning that header of frame contains 3 MAC addresses. Frame transmitted from AP to station has
the following addresses:
destination address - address of station device, also radio receiver address
radio transmitter address - address of AP
source address - address of originator of particular frame
Frame transmitted from station to AP has the following addresses:
radio receiver address - address of AP
source address - address of station device, also radio transmitter address
destination address
Considering that every frame must include radio transmitter and receiver address, it is clear that 3 address frame
format is not suitable for transparent L2 bridging over station, because station can not send frame with source
address different from its address - e.g. frame from Y, and at the same time AP can not format frame in a way that
would include address of Y.
802.11 includes additional frame format, so called 4 address frame format, intended for "wireless distribution
system" (WDS) - a system to interconnect APs wirelessly. In this format additional address is added, producing
header that contains the following addresses:
radio receiver address
78
79
Applicability Matrix
The following matrix specifies station modes available for each wireless-protocol. Note that there are 2 columns for
802.11 protocol: 802.11 specifies availability of mode in "pure" 802.11 network (when connecting to any vendor
AP) and ROS 802.11 specifies availability of mode when connecting to RouterOS AP that implements necessary
proprietary extensions for mode to work.
Table applies to RouterOS v5rc11 and above:
802.11 ROS 802.11 nstreme nv2
station
station-pseudobridge-clone V
station-bridge
station-wds
station-pseudobridge
Mode station
This is standard mode that does not support L2 bridging on station - attempts to put wireless interface in bridge will
not produce expected results. On the other hand this mode can be considered the most efficient and therefore should
be used if L2 bridging on station is not necessary - as in case of routed or MPLS switched network. This mode is
supported for all wireless protocols.
Mode station-wds
This mode works only with RouterOS APs. As a result of negotiating connection, separate WDS interface is created
on AP for given station. This interface can be thought of point-to-point connection between AP and given station whatever is sent out WDS interface is delivered to station (and only to particular station) and whatever station sends
to AP is received from WDS interface (and not subject to forwarding between AP clients), preserving L2 addresses.
This mode is supported for all wireless protocols except when 802.11 protocol is used in connection to
non-RouterOS device. Mode uses 4 address frame format when used with 802.11 protocol, for other protocols (such
as nstreme or nv2), protocol internal means are used.
This mode is safe to use for L2 bridging and gives most administrative control on AP by means of separate WDS
interface, for example use of bridge firewall, RSTP for loop detection and avoidance, etc.
Mode station-pseudobridge
This mode from wireless connection point of view is the same as standard station mode. It has limited support for L2
bridging by means of some services implemented in station:
MAC address translation for IPv4 packets - station maintains IPv4-to-MAC mapping table and replaces source
MAC address with its own address when sending frame to AP (in order to be able to use 3 address frame format),
and replaces destination MAC address with address from mapping table for frames received from AP.
IPv4-to-MAC mappings are built also for VLAN encapsulated frames.
single MAC address translation for the rest of protocols - station learns source MAC address from first forwarded
non-IPv4 frame and uses it as default for reverse translation - this MAC address is used to replace destination
MAC address for frames received from AP if IPv4-to-MAC mapping can not be performed (e.g. - non-IPv4 frame
or missing mapping).
This mode is limited to complete L2 bridging of data to single device connected to station (by means of single MAC
address translation) and some support for IPv4 frame bridging - bridging of non-IP protocols to more than one
device will not work. Also MAC address translation limits access to station device from AP side to IPv4 based
access - the rest of protocols will be translated by single MAC address translation and will not be received by station
itself.
This mode is available for all protocols except nv2 and should be avoided when possible. The usage of this node
can only be justified if AP does not support better mode for L2 bridging (e.g. when non-RouterOS AP is used) or if
only one end-user device must be connected to network by means of station device.
Mode station-pseudobridge-clone
This mode is the same as station-pseudobridge mode, except that it connects to AP using "cloned" MAC address that is either address configured in station-bridge-clone-mac parameter (if configured) or source address of first
forwarded frame. This essentially appears on AP as if end-user device connected to station connected to AP.
Mode station-bridge
This mode works only with RouterOS APs and provides support for transparent protocol-independent L2 bridging on
station device. RouterOS AP accepts clients in station-bridge mode when enabled using bridge-mode parameter. In
this mode AP maintains forwarding table with information on what MAC addresses are reachable over which station
device.
This mode is MikroTik proprietary and can't be used to connect other brand devices.
This mode is safe to use for L2 bridging and should be used whenever there are sufficient reasons to not use
station-wds mode.
80
Manual:Nv2
Manual:Nv2
Overview of Nv2 protocol
Nv2 protocol is proprietary wireless protocol developed by MikroTik for use with Atheros 802.11 wireless chips.
Nv2 is based on TDMA (Time Division Multiple Access) media access technology instead of CSMA (Carrier Sense
Multiple Access) media access technology used in regular 802.11 devices.
TDMA media access technology solves hidden node problem and improves media usage, thus improving throughput
and latency, especially in PtMP networks.
Nv2 is supported for Atheros 802.11n chips and legacy 802.11a/b/g chips starting from AR5212, but not supported
on older AR5211 and AR5210 chips. This means that both - 11n and legacy devices can participate in the same
network and it is not required to upgrade hardware to implement Nv2 in network.
Media access in Nv2 network is controlled by Nv2 Access Point. Nv2 AP divides time in fixed size "periods" which
are dynamically divided in downlink (data sent from AP to clients) and uplink (data sent from clients to AP)
portions, based on queue state on AP and clients. Uplink time is further divided between connected clients based on
their requirements for bandwidth. At the begginning of each period AP broadcasts schedule that tells clients when
they should transmit and the amount of time they can use.
In order to allow new clients to connect, Nv2 AP periodically assigns uplink time for "unspecified" client - this time
interval is then used by fresh client to initiate registration to AP. Then AP estimates propagation delay between AP
and client and starts periodically scheduling uplink time for this client in order to complete registration and receive
data from client.
Nv2 implements dynamic rate selection on per-client basis and ARQ for data transmissions. This enables reliable
communications across Nv2 links.
For QoS Nv2 implements variable number of priority queues with builtin default QoS scheduler that can be
accompanied with fine grained QoS policy based on firewall rules or priority information propagated across network
using VLAN priority or MPLS EXP bits.
Nv2 protocol limit is 511 clients.
81
Manual:Nv2
Nv2 vs Nstreme
The key differences between Nv2 and Nstreme:
Reduced polling overhead - instead of polling each client, Nv2 AP broadcasts uplink schedule that assigns time to
multiple clients, this can be considered "group polling" - no time is wasted for polling each client individually,
leaving more time for actual data transmission. This improves throughput, especially in PtMP configurations.
Reduced propagation delay overhead - Nv2 must not poll each client individually, this allows to create uplink
schedule based on estimated distance (propagation delay) to clients such that media usage is most effective. This
improves throughput, especially in PtMP configurations.
More control over latency - reduced overhead, adjustable period size and QoS features allows for more control
over latency in the network.
82
Manual:Nv2
83
Configuring Nv2
As of version 5.0rc1 new wireless interface setting wireless-protocol has been introduced. This setting controls
which wireless protocol selects and uses. Note that meaning of this setting depends on interface role (either it is AP
or client) that depends on interface mode setting. Find possible values of wireless-protocol and their meaning in
table below.
value
AP
client
unspecified
any
same as unspecified
scan for all matching networks, no matter what protocol, connect using protocol of
chosen network
802.11
nstreme
Nv2
scan for Nv2 networks, if suitable network found - connect, otherwise scan for Nstreme
networks, if suitable network found - connect, otherwise scan for 802.11 network and if
suitable network found - connect.
Nv2-nstreme
scan for Nv2 networks, if suitable network found - connect, otherwise scan for Nstreme
networks and if suitable network found - connect
Note that wireless-protocol values Nv2-nstreme-802.11 and Nv2-nstreme DO NOT specify some hybrid or special
kind of protocol - these values are implemented to simplify client configuration when protocol of network that client
must connect to can change. Using these values can help in migrating network to Nv2 protocol.
Most of Nv2 settings are significant only to Nv2 AP - Nv2 client automatically adapts necessary settings from AP.
The following settings are relevant to Nv2 AP:
Nv2-queue-count - specifies how many priority queues are used in Nv2 network. For more details see
Manual:Nv2#QoS_in_Nv2_network
Nv2-qos - controls frame to priority queue mapping policy. For more details see
Manual:Nv2#QoS_in_Nv2_network
Nv2-cell-radius - specifies distance to farthest client in Nv2 network in km. This setting affects the size of
contention time slot that AP allocates for clients to initiate connection and also size of time slots used for
estimating distance to client. If this setting is too small, clients that are farther away may have trouble connecting
and/or disconnect with "ranging timeout" error. Although during normal operation the effect of this setting should
be negligible, in order to maintain maximum performance, it is advised to not increase this setting if not
necessary, so AP is not reserving time that is actually never used, but instead allocates it for actual data transfer.
tdma-period-size - specifies size in ms of time periods that Nv2 AP uses for media access scheduling. Smaller
period can potentially decrease latency (because AP can assign time for client sooner), but will increase protocol
overhead and therefore decrease throughput. On the other hand - increasing period will increase throughput but
also increase latency. It may be required to increase this value for especially long links to get acceptable
throughput. This necessity can be caused by the fact that there is "propagation gap" between downlink (from AP
to clients) and uplink (from clients to AP) data during which no data transfer is happening. This gap is necessary
because client must receive last frame from AP - this happens after propagation delay after AP's transmission, and
only then client can transmit - as a result frame from client arrives at AP after propagation delay after client's
transmission (so the gap is propagation delay times two). The longer the distance, the bigger is necessary
propagation gap in every period. If propagation gap takes significant portion of period, actual throughput may
become unacceptable and period size should get increased at the expense of increased latency. Basically value of
Manual:Nv2
this setting must be carefully chosen to maximize throughput but also to keep latency at acceptable levels.
The follwing settings are significant on both - Nv2 AP and Nv2 client:
Nv2-security - specifies Nv2 security mode, for more details see Manual:Nv2#Security_in_Nv2_network
Nv2-preshared-key - specifies preshared key to be used, for more details see
Manual:Nv2#Security_in_Nv2_network
Migrating to Nv2
Using wireless-protocol setting aids in migration or evaluating Nv2 protocol in existing networks really simple and
reduce downtime as much as possible. These are the recommended steps:
upgrade AP to version that supports Nv2, but do not enable Nv2 on AP yet.
upgrade clients to version that supports Nv2
configure all clients with wireless-protocol=Nv2-nstreme-802.11. Clients will still connect to AP using protocol
that was used previously, because AP is not changed over to Nv2 yet
configure Nv2 related settings on AP
if it is necessary to use data encryption and secure authentication, configure Nv2 security related settings on AP
and clients (refer to Manual:Nv2#Security_in_Nv2_network).
set wireless-protocol=Nv2 on AP. This will make AP to change to Nv2 protocol. Clients should now connect
using Nv2 protocol.
in case of some trouble you can easily switch back to previous protocol by simply changing it back to whatever
was used before on AP.
fine tune Nv2 related settings to get acceptable latency and throughput
implement QoS policy for maximum performance.
The basic troubleshooting guide:
clients have trouble connecting or disconnect with "ranging timeout" error - check that Nv2-cell-radius setting is
set appropriately
unexpectedly low throughput on long distance links although signal and rate is fine - try to increase
tdma-period-size setting
84
Manual:Nv2
Nv2-qos=default
In this mode outgoing frame at first is inspected by built-in QoS policy algorithm that selects queue based on packet
type and size. If built-in rules do not match, queue is selected based on frame priority field, as in
Nv2-qos=frame-priority mode.
Nv2-qos=frame-priority
In this mode QoS queue is selected based on frame priority field. Note that frame priority field is not some field in
headers and therefore it is valid only while packet is processed by given device. Frame priority field must be set
either explicitly by firewall rules or implicitly from ingress priority by frame forwarding process, for example, from
MPLS EXP bits. For more information on frame priority field see:
Manual:MPLS/EXP_bit_behaviour
Manual:WMM
Queue is selected based on frame priority according to 802.1D recommended user priority to traffic class mapping.
Mapping depends on number of available queues (Nv2-queue-count parameter). For example, if number of queues
is 4, mapping is as follows (pay attention how this mapping resembles mapping used by WMM):
priority 0,1 -> queue 0
priority 2,3 -> queue 1
priority 4,5 -> queue 2
priority 6,7 -> queue 3
If number of queues is 2 (default), mapping is as follows:
priority 0,1,2,3 -> queue 0
priority 4,5,6,7 -> queue 1
If number of queues is 8 (maximum possible), mapping is as follows:
For other mappings, discussion on rationale for these mappings and recommended practices please see 802.1D-2004.
hardware accelerated data encryption using AES-CCM with 128 bit keys;
4-way handshake for key management (similar to that of 802.11i);
preshared key authentication method (similar to that of 802.11i);
periodically updated group keys (used for broadcast and multicast data).
Being proprietary protocol Nv2 does not use security mechanisms of 802.11, therefore security configuration is
different. Interface using Nv2 protocol ignores security-profile setting. Instead, security is configured by the
following interface settings:
Nv2-security - this setting enables/disables use of security in Nv2 network. Note that when security is enabled on
AP, it will not accept clients with disabled security. In the same way clients with enabled security will not connect
85
Manual:Nv2
86
to unsecure APs.
Nv2-preshared-key - preshared key to use for authentication. Data encryption keys are derived from preshared
key during 4-way handshake. Preshared key must be the same in order for 2 devices to establish connection. If
preshared key will differ, connection will time out because remote party will not be able to correctly interpret key
exchange messages.
NV2 skin
WebFig skin that has all wireless options removed but ones that has any impact on NV2 configuration. nv2 wireless
skin [1]
References
[1] http:/ / www. mikrotik. com/ download/ nv2. json
Manual:WMM
How WMM works
WMM works by dividing traffic into 4 access categories: background, best effort, video, voice. QoS policy (different
handling of access categories) is applied on transmitted packets, therefore it is transmitting device is treating
different packets differently - that is - e.g. AP does not have control over how clients are transmitting packets, and
clients do not have control over how AP transmits packets.
Mikrotik AP and client classifies packets based on priority assigned to them, according to table (as per WMM spec):
1,2 - background 0,3 - best effort 4,5 - video 6,7 - voice
To be able to use multiple WMM access categories, not just best effort where all packets with default priority 0 go,
priority must be set for those packets. By default all packets (incoming and locally generated) inside router have
priority 0.
"Better" access category for packet does not necessarily mean that it will be sent over the air before all other packets
with "worse" access category. WMM works by executing DCF method for medium access with different settings for
each access category (EDCF), which basically means that "better" access category has higher probability of getting
access to medium - WMM enabled station can be considered to be 4 stations, one per access category, and the ones
with "better" access category use settings that make them more likely to get chance to transmit (by using shorter
backoff timeouts) when all are contending for medium. Details can be studied in 802.11e and WMM specification
Note that ingress priority value is not automatically copied to priority value, correct rule needs to
be set up to do this!
Manual:WMM
So there are basically 2 ways to control/set priority (remember, that both require setting up correct rule(s)!): - assign
priority with rules with particular matchers (protocol, addresses, etc), - set it from ingress priority.
This essentialy means that if it is not possible or wanted to classify packets by rules, configuration of network must
be such that router can extract ingress priority from incoming frames. Remember there are currently 2 sources for
this - VLAN tag in packets and received WMM packets.
Do not mix priority of queues with priority assigned to packets. Priorities of queues work separately and specify
"importance" of queue and has meaning only within particular queue setup. Think of packet priority as of some kind
of mark, that gets attached to packet by rules. Also take into account that this mark currently is only used for
outgoing packets when going over WMM enabled link, and in case VLAN tagged packet is sent out (no matter if that
packet is tagged locally or bridged).
Example
For example, in setup
PPPoE server -> WMM AP -> client,
if AP is just forwarding PPPoE traffic (therefore inspecting encapsulated IP packets to match e.g. by protocol is not
possible, as packets can be encrypted and compressed), priority must come to AP from PPPoE server in VLAN tag,
so you have to use VLAN (between PPPoE server and AP) for this, just to communicate priority information.
Note that you do not have to forward VLAN encapsulated traffic to client - VLAN can be terminated at AP, VLAN
tag is needed only when entering AP.
In case AP is PPPoE server itself, there is no need to use VLAN - priority can be set by rules before it is
encapsulated in PPPoE.
87
Manual:WMM
Manual:Spectral scan
Applies to RouterOS: v4.3+
The spectral scan can scan all frequencies supported by your wireless card, and plot them directly in
console. Exact frequency span depends on card. Allowed ranges on r52n: [4790; 6085], [2182; 2549].
Wireless card can generate 4us long spectral snapshots for any 20mhz wide channel. This is considered
a single spectral sample.
To improve data quality spectrum is scanned with 10mhz frequency increments, which means doubled sample
coverage at each specific frequency (considering 20mhz wide samples).
Currently this feature is supported only for Atheros Merlin chips. (ie. AR9220, AR9280, AR9223).
Currently tested models: RouterBOARD R52N and R2N only.
Console
Spectral History
88
Manual:Spectral scan
characters with the same foreground and background color, so it is possible to copy and paste terminal output of this
command.
value -- select value that is plotted on the output. 'interference' is special as it shows detected interference sources
(affected by 'classify-samples' parameter) instead of power readings, and cannot be made audible.
interval -- interval at which spectrogram lines are printed.
duration -- terminate command after specified time. default is indefinite.
buckets -- how many values to show in each line of spectrogram. This value is limited by the number of columns
in terminal. It is useful to reduce this value if using 'audible'.
average-samples -- Number of 4us spectral snapshots to take at each frequency, and calculate average and
maximum energy over them. (default 10)
classify-samples -- Number of spectral snapshots taken at each frequency and processed by interference
classification algorithm. Generally more samples gives more chance to spot certain type of interference (default
50)
range - 2.4ghz - scan whole 2.4ghz band
5ghz - scan whole 5ghz band
current-channel - scan current channel only (20 or 40 mhz wide)
range - scan specific range
audible=yes -- play each line as it is printed. There is a short silence between lines. Each line is played from left
to right, with higher frequencies corresponding to higher values in the spectrogram.
Spectral Scan
89
Manual:Spectral scan
Continuously monitor spectral data. This command uses the same data source as 'spectral-history', and thus shares
many parameters.
Each line displays one spectrogram bucket -- frequency, numeric value of power average, and a character graphic
bar. Bar shows average power value with ':' characters and average peak hold with '.' characters. Maximum is
displayed as a lone floating ':' character.
show-interference -- add column that shows detected interference sources.
Types of possibly classified interference:
bluetooth-headset
bluetooth-stereo
cordless-phone
microwave-oven
cwa
video-bridge
wifi
The Dude
The Dude is a free network monitoring and management program by MikroTik. You can download it here [1].
The Dude has a built-in capability to run graphical Spectral Scan from any of your RouterOS devices with a
supported wireless card. Simply select this device in your Dude map, right click and choose Tools -> Spectral Scan.
This will bring up the Spectral Scan GUI with various options and different view modes:
90
Manual:Spectral scan
References
[1] http:/ / www. mikrotik. com/ thedude. php
91
Overview
Note: This article describes features not yet available to general public. It's expected to be released in
RouterOS v6
frequency
To use particular Advanced Channel for wireless interface (applies to modes that make use of interface frequency
setting) specify channel name in interface frequency setting. For example, to configure interface to operate with
center frequency 5500MHz and channel width 14MHz, use the following commands:
[admin@MikroTik] /interface wireless> channels add name=MYCHAN frequency=5500 width=14 band=5ghz-onlyn
list=MYLIST
[admin@MikroTik] /interface wireless> set wlan1 frequency=MYCHAN
92
scan-list
Interface scan-list is used in multiple modes that either gather information for list of channels (like interactive scan
command) or selects channel to work on (like any of station modes or AP modes performing DFS). Interface
scan-list can be configured with comma-separated list of the following items:
default - default .11 channel list for given country and interface band and channel width;
numeric frequency ranges in MHz;
Advanced Channel, referred to by name;
Advanced Channel list, referred to by list name.
For example, to configure interface to scan 5180MHz, 5200MHz and 5220MHz at first using channel width 20MHz
and then using channel width 10MHz, the following commands can be issued:
[admin@MikroTik] /interface wireless> channels add frequency=5180 width=20 band=5ghz-a list=20MHz-list
[admin@MikroTik] /interface wireless> channels add frequency=5200 width=20 band=5ghz-a list=20MHz-list
[admin@MikroTik] /interface wireless> channels add frequency=5220 width=20 band=5ghz-a list=20MHz-list
[admin@MikroTik] /interface wireless> channels add frequency=5180 width=10 band=5ghz-a list=10MHz-list
[admin@MikroTik] /interface wireless> channels add frequency=5200 width=10 band=5ghz-a list=10MHz-list
[admin@MikroTik] /interface wireless> channels add frequency=5220 width=10 band=5ghz-a list=10MHz-list
[admin@MikroTik] /interface wireless> set wlan1 scan-list=20MHz-list,10MHz-list
Hardware support
Non standard center frequency and width channels can only be used with interfaces that support it.
Currently only Atheros AR92xx based chips support non-standard center frequencies and widths with the following
ranges:
center frequency range: 2200MHz-2500MHz with step 0.5MHz (500KHz), width range: 2.5MHz-30MHz width
step 0.5MHz (500KHz);
center frequency range: 4800MHz-6100MHz with step 0.5MHz (500KHz), width range: 2.5MHz-30MHz width
step 0.5MHz (500KHz);
93
Manual:Interface/HWMPplus
Manual:Interface/HWMPplus
Applies to RouterOS: 3, v4
Prerequisites for this article: you understand what WDS is and why to use it
Software versions: 3.28+ (earlier versions are incompatible)
Overview
HWMP+ is a MikroTik specific layer-2 routing protocol for wireless mesh networks. It is based on Hybrid Wireless
Mesh Protocol (HWMP) from IEEE 802.11s draft standard. It can be used instead of (Rapid) Spanning Tree
protocols in mesh setups to ensure loop-free optimal routing.
The HWMP+ protocol however is not compatible with HWMP from IEEE 802.11s draft standard.
Note that the distribution system you use for your network need not to be Wireless Distribution System (WDS).
HWMP+ mesh routing supports not only WDS interfaces, but also Ethernet interfaces inside the mesh. So you can
use simple Ethernet based distribution system, or you can combine both WDS and Ethernet links!
Configuration
/interface mesh
Configure mesh interface.
admin-mac (MAC address, default: 00:00:00:00:00:00) -- administratively assigned MAC address, used when
auto-mac setting is disabled
arp (disabled | enabled | proxy-arp | reply-only; default: enabled) - address resolution protocol setting
auto-mac (boolean, default: no) -- if disabled, then value from admin-mac will be used as the MAC address of the
mesh interface; else address of some port will be used if ports are present
hwmp-default-hoplimit (integer: 1..255) -- maximum hop count for generated routing protocol packets; after a
HWMP+ packet is forwarded "hoplimit" times, it is dropped
hwmp-prep-lifetime (time, default: 5m) -- lifetime for routes created from received PREP or PREQ messages
hwmp-preq-destination-only (boolean, default: yes) -- whether only destination can respond to HWMP+ PREQ
message
hwmp-preq-reply-and-forward (boolean, default: yes) -- whether intermediate nodes should forward HWMP+
PREQ message after responding to it. Useful only when hwmp-preq-destination-only is disabled
hwmp-preq-retries (integer, default: 2) -- how much times to retry route discovery to a specific MAC address
before the address is considered unreachable
hwmp-preq-waiting-time (time, default: 4s) -- how long to wait for a response to the first PREQ message. Note that
for subsequent PREQs the waiting time is increased exponentially
hwmp-rann-interval (time, default: 10s) -- how often to send out HWMP+ RANN messages
hwmp-rann-lifetime (time, default: 1s) -- lifetime for routes created from received RANN messages
hwmp-rann-propagation-delay (number, default: 0.5) -- how long to wait before propagating a RANN message.
Value in seconds
mesh-portal (boolean, default: no) -- whether this interface is a portal in the mesh network
mtu (number, default: 1500) -- maximum transmit units
94
Manual:Interface/HWMPplus
name (string) -- interface name
reoptimize-paths (boolean, default: no) -- whether to send out periodic PREQ messages asking for known MAC
addresses. Turing on this setting is useful if network topology is changing often. Note that if no reply is received to a
reoptimization PREQ, the existing path is kept anyway (until it timeouts itself)
95
Manual:Interface/HWMPplus
Example
This example uses static WDS links that are dynamically added as mesh ports when they become active. Two
different frequencies are used: one for AP interconnections, and one for client connections to APs, so the AP must
have at least two wireless interfaces. Of course, the same frequency for all connections also could be used, but that
might not work as good because of potential interference issues.
Repeat this configuration on all APs:
/interface mesh add disabled=no
96
Manual:Interface/HWMPplus
97
/interface wireless wds add disabled=no master-interface=wlan1 name=<descriptive name of remote end> \
wds-address=<MAC address of remote end>
Here WDS interface is added manually, because static WDS mode is used. If you are using
wds-mode=dynamic-mesh, all WDS interfaces will be created automatically. The frequency and band parameters
are specified here only to produce valid example configuration; mesh protocol operations is by no means limited to,
or optimized for, these particular values.
Note: You may want to increase disconnect-timeout wireless interface option to make the protocol more
stable.
In real world setups you also should take care of securing the wireless connections, using
/interface wireless security-profile. For simplicity that configuration it's not shown here.
Results on router A (there is one client is connected to wlan2):
[admin@A] > /interface mesh pr
Flags: X - disabled, R - running
0
The FDB (Forwarding Database) at the moment contains information only about local MAC addresses, non-mesh
nodes reachable through local interface, and direct mesh neighbors:
[admin@A] /interface mesh> fdb print
Flags: A - active, R - root
MESH
TYPE
MAC-ADDRESS
ON-INTERFACE
LIFETIME
AGE
mesh1
local
00:0C:42:00:00:AA
mesh1
1m2s
mesh1
3m16s
mesh1
direct
00:0C:42:0C:7A:2B wlan2
2m56s
mesh1
local
00:0C:42:0C:B5:A4
2m56s
3m17s
Manual:Interface/HWMPplus
A
98
Mesh traceroute
There is also mesh traceroute command, that can help you to determine which paths are used for routing.
For example, for this network:
[admin@1] /interface mesh> fdb print
Flags: A - active, R - root
MESH
TYPE
MAC-ADDRESS
A mesh1
local
00:0C:42:00:00:01
A mesh1
mesh
00:0C:42:00:00:02
A mesh1
mesh
00:0C:42:00:00:12
A mesh1
mesh
00:0C:42:00:00:13
A mesh1
neighbor 00:0C:42:00:00:16
A mesh1
mesh
00:0C:42:00:00:24
ON-INTERFACE
LIFETIME
wds4
wds4
wds4
wds4
wds4
17s
4m58s
19s
18s
AGE
7m1s
4s
1s
2s
7m1s
3s
Manual:Interface/HWMPplus
99
Protocol description
Reactive mode
Manual:Interface/HWMPplus
100
In reactive mode HWMP+ is very much like AODV (Ad-hoc On-demand Distance Vector). All path are discovered
on demand, by flooding Path Request (PREQ) message in the network. The destination node or some router that has
a path to the destionation will reply with a Path Response (PREP). Note that if the destination address belongs to a
client, the AP this client is connected to will serve as proxy for him (i.e. reply to PREQs on his behalf).
This mode is best suited for mobile networks, and/or when most of the communication happens between intra-mesh
nodes.
Proactive mode
Manual:Interface/HWMPplus
101
In proactive mode there are some routers configured as portals. In general being a portal means that router has
interfaces to some other network,, i.e. it is entry/exit point to the mesh network.
The portals will announce their presence by flooding Root Announcement (RANN) message in the network. Internal
nodes will reply with a Path Registration (PREG) message. The result of this process will be routing trees with roots
in the portal.
Routes to portals will serve as a kind of default routes. If an internal router does not know path to a particular
destination, it will forward all data to its closest portal. The portal will then discover path on behalf of the router, if
needed. The data afterwards will flow through the portal. This may lead to suboptimal routing, unless the data is
addressed to the portal itself or some external network the portals has interfaces to.
Proactive mode is best suited when most of traffic goes between internal mesh nodes and a few portal nodes.
Manual:Interface/HWMPplus
102
HWMP+ uses Path Error (PERR) message to notify that a link has disappeared. The message is propagated to all
upstream nodes up to the data source. The source on PERR reception restarts path discovery process.
FAQ
Q. How is this better than RSTP?
A. It gives you optimal routing. RSTP is only for loop prevention.
Q. How the route selection is done?
A. The route with best metric is always selected after the discovery process. There is also a configuration option to
periodically reoptimize already known routes.
Route metric is calculated as sum of individual link metrics.
Link metric is calculated in the same way as for (R)STP protocols:
For Ethernet links the metric is configured statically (like for OSPF, for example).
For WDS links the metric is updated dynamically depending on actual link bandwidth, which in turn is influenced
by wireless signal strength, and the selected data transfer rate.
Manual:Interface/HWMPplus
Currently the protocol does not take in account the amount of bandwidth being used on a link, but that might be also
used in future.
Q. How is this better than OSPF/RIP/layer-3 routing in general?
A. WDS networks usually are bridged, not routed. The ability to self-configure is important for mesh networks; and
routing generally requires much more configuration than bridging. Of you course, you always can run any L3 routing
protocol over a bridged network, but for mesh networks that usually makes little sense.
Note: Since optimized layer-2 multicast forwarding is not included mesh protocol, it is better to avoid
forwarding any multicast traffic (including OSPF) over meshed networks. If you need OSPF, then you have
to configure OSPF NBMA neighbors that uses unicast instead.
Note that if you have a WDS link between two access points, then both ends must have the same
configuration (either as ports in a mesh on both ends, or as ports in a bridge interface on both
ends).
You can also put a bridge interface as a mesh port (to be able to use bridge firewall, for example).
Q. Can I have multiple entry/exit points to the network?
A. If the entry/exit points are configured as portals (i.e. proactive mode is used), each router inside the mesh network
will select its closest portal and forward all data to it. The portal will then discover path on behalf of the router, if
needed.
Q. How to control or filter mesh traffic?
A. At the moment the only way is to use bridge firewall. Create a bridge interface, put the WDS interfaces and/or
Ethernets in that bridge, and put that bridge in a mesh interface. Then configure bridge firewall rules.
To match MAC protocol used for mesh traffic encapsulation, use MAC protocol number 0x9AAA, and to mathc
mesh routing tafffic, use MAC protocol number 0x9AAB. Example:
interface bridge settings set use-ip-firewall=yes
interface bridge filter add chain=input action=log mac-protocol=0x9aaa
interface bridge filter add chain=input action=log mac-protocol=0x9aab
Note that it is perfectly possible to create mixed mesh/bridge setups that will not work (e.g. Problematic example 1
with bridge instead of switch). The recommended fail-safe way that will always work is to create a separate bridge
interface per each physical interfaces; then add all these bridge interfaces as mesh ports.
103
Manual:Interface/HWMPplus
Advanced topics
We all know that it's easy to make problematic layer-2 bridging or routing setups and hard to debug them. (Compared to layer-3 routing setups.)
So there are a few bad configuration examples which could create problems for you. Avoid them!
Router A is outside the mesh, all the rest of routers: inside. For routers B, C, D all interfaces are added as mesh ports.
Router A will not be able to communicate reliably with router C. The problem manifests itself when D is the designated router for Ethernet; if B
takes this role, everything is OK. The main cause of the problem is MAC address learning on Ethernet switch.
Consider what happens when router A wants to send something to C. We suppose router A either knowns or floods data to all interfaces. Either
way, data arrives at switch. The switch, not knowing anything about destination's MAC address, forwards to data both to B and D.
What happens now:
1.
B receives the packet on a mesh interface. Since the MAC address is not local for B, and B knows that he is not the designated router for the
Ethernet network, he simply ignores the packet.
2.
D receives the packet on a mesh interface. Since the MAC address is not local for B, and D is the designated router for the Ethernet network,
he initiates path discovery process to C.
After path discovery is completed, D has information that C is reachable over B. Now D encapsulates the packet and forwards back to Ethernet
network. The encapsulated packet forwarded by switch, received and forwarded by B, and received by C. So far everything is good.
Now C is likely to respond to the packet. Since B already knows where A is, he will decapsulate and forward the reply packet. But now switch
will learn that the MAC address of C is reachable through B! That means, next time when something arrives from A addressed to C, the switch
will forward data only to B. (And B, of course, will silently ignore the packet).
In contrast, if B took up the role of designated router, everything would be OK, because traffic would not have to go through the Ethernet switch
twice.
Troubleshooting: either avoid such setup or disable MAC address learning on the switch. Note that on many switches it's not possible.
Also note that there will be no problem, if either:
104
Manual:Interface/HWMPplus
or Ethernet switch is replaced with and router that supports HWMP+ and has Ethernet interfaces added as mesh ports.
Routers A and B are inside the mesh, routers C: outside. For routers A and B all interfaces are added as mesh ports.
It is not possible to bridge wlan1 and wlan2 on router B now. The reason for this is pretty obvious if you understand how WDS works. For WDS
communications four address frames are used. This is because for wireless multihop forwarding you need to know both the addresses of
intermediate hops, as well as the original sender and final receiver. In contrast, non-WDS 802.11 communication includes only three MAC
addresses in a frame. That's why it's not possible to do multihop forwarding in station mode.
Troubleshooting: depends on what you want to achieve:
1.
If you want to router C as a repeater either for wireless or Ethernet traffic, configure WDS link between router B and router C, and run mesh
routing protocol on all nodes.
2.
In other cases configure wlan2 on router B in AP mode, and wlan on router C in station mode.
See also:
A presentation about mesh networks and MikroTik (in Portuguese) [1]
References
[1] http:/ / mum. mikrotik. com/ presentations/ BR08/ Brasil_Mesh_Maia. pdf
105
Requirements
a router running RouterOS loaded with supported miniPCI wireless cards
a connection to the router via the Winbox utility
Instructions
Start by opening the Wireless Interface window in Winbox. You will see some wireless cards listed here, they might
be disabled - to turn them on, click on the blue Enable button. Make sure that the interface is configured and the
antennas are connected before you enable an interface.
To configure an interface, double-click it's name, and the config window will appear. To set the device as an AP,
choose "ap bridge" mode. You can also set other things, like the desired band, frequency, SSID (the AP identifier)
and the security profile.
106
You probably want your AP to be secure, so you need to configure WPA2 security. Close the wireless setting
window with OK if you are done, and move to the Security Profiles tab of the Wireless interface window. There,
make a new profile with the Add button and set desired WPA2 settings. You can choose this new security profile
back in the Interface configuration.
107
Just connecting is probaly not enough, as your AP needs an IP address. This can be configured in the IP menu. Make
sure that your stations also have IP addresses from the same subnet, or set up a DHCP server in this Router (not
covered in this tutorial).
If your ISP doesn't know about your new local network and hasn't set up proper routes to it, you need to configure
SRC-NAT so that your stations have access to the internet via their private IP addresses. They will be masqueraded
by the router's NAT functionality (not covered in this tutorial)
108
Manual:Wireless FAQ
Settings
Why I can't connect to MikroTik 802.11n AP with Apple Mac devices?
This problem is only seen on Mac devices based on Broadcom wireless chipsets. In order to connect with such
wireless device to MikroTik 802.11n AP make sure that you don't use 'short' preamble-mode. Use 'long' or 'both'
preamble-mode and Mac wireless devices will be able to connect.
By changing some wireless settings the wireless link works unstable
Sometimes when you change some wireless setting for tuning the links you got so far that the link isn't establishing
any more or works unstable and you don't remember what settings you had in the beginning. In this case you can use
the reset-configuration command in the wireless menu - it will reset the all the wireless settings for the specific
wireless interface and you will be able to configure the interface from the start. Note that executing this command
also disables the interface, so please be careful not to execute this command if you are configuring router remotely
using that wireless link that you want to reset the configuration.
What are wireless retransmits and where to check them?
Wireless retransmission is when the card sends out a frame and you don't receive back the acknowledgment (ACK),
you send out the frame once more till you get back the acknowledgment. Wireless retransmits can increase the
latency and also lower the throughput of the wireless link. To check if the wireless connection has wireless
retransmissions you need to compare two fields in the wireless registration table: frames and hw-frames. If the
hw-frames value is bigger than frames value then it means that the wireless link is making retransmissions. If the
difference is not so big, it can be ignored, but if the hw-frames count it two, three or four times or even bigger than
the frames count then you need to troubleshoot this wireless connection.
109
Manual:Wireless FAQ
Can I compare frames with hw-frames also on Nstreme links?
The frames counts only those which contain actual data. In case of Nstreme, only the ACK can be transmitted in a
single frame, if there is no other data to send. These ACK frames will not be added to the frames count, but they will
appear at hw-frames. If there is traffic on both directions at maximum speed (eg. there will be no only-ack frames),
then you can't compare frames to hw-frames as in case of regular wireless links.
What TX-power values can I use?
The tx-power default setting is the maximum tx-power that the card can use and is taken from the cards eeprom. If
you want to use larger tx-power values, you are able to set them, but do it at your own risk, as it will probably
damage your card eventually! Usually, one should use this parameter only to reduce the tx-power.
In general tx-power controlling properties should be left at the default settings. Changing the default setting may
help with some cards in some situations, but without testing, the most common result is degradation of range and
throughput. Some of the problems that may occur are:
overheating of the power amplifier chip and the card which will cause lower efficiency and more data errors;
overdriving the amplifier which will cause more data errors;
excessive power usage for the card and this may overload the 3.3V power supply of the board that the card is
located on resulting in voltage drop and reboot or excessive temperatures for the board.
What TX-power-mode is the best?
TX-power-mode tells the wireless card which tx-power values should be used. By default this setting is set to default.
default means that the card will use the tx-power values from the cards eeprom and will ignore the setting what is
specified by the user in the tx-power field.
card-rates means that for different data rates the tx-power is calculated according the cards transmit power
algorithm from the cards eeprom and as an argument it takes tx-power value specified by the user.
all-rates-fixed means that that the card will use one tx-power value for all data rates which is specified by the
user in tx-power field.
Note that it is not recommended to use 'all-rates-fixed' mode as the wireless card tx-power for the higher data rates is
lower and by forcing to use the fixed tx-power rates also for the higher data rates might results the same problems
like in the previous question about tx-power setting. For most of the cases if you want to change the tx-power
settings it is recommended to use the tx-power-mode=card-rates and it is recommended to lower and not to raise
tx-power.
What is CCQ and how are the values determined?
Client Connection Quality (CCQ) is a value in percent that shows how effective the bandwidth is used regarding the
theoretically maximum available bandwidth. CCQ is weighted average of values Tmin/Treal, that get calculated for
every transmitted frame, where Tmin is time it would take to transmit given frame at highest rate with no retries and
Treal is time it took to transmit frame in real life (taking into account necessary retries it took to transmit frame and
transmit rate).
What is hw-retries setting?
Number of times sending frame is retried without considering it a transmission failure. Data rate is decreased upon
failure and frame is sent again. Three sequential failures on lowest supported rate suspend transmission to this
destination for the duration of on-fail-retry-time. After that, frame is sent again. The frame is being retransmitted
until transmission success, or until client is disconnected after disconnect-timeout. Frame can be discarded during
this time if frame-lifetime is exceeded. In case of Nstreme "on-fail-retry-time", "disconnect-timeout" and
"frame-lifetime" settings are not used. So after three sequential failures on lowest supported rate the wireless link is
110
Manual:Wireless FAQ
disconnected with "extensive data loss" message.
What is disconnect-timeout setting?
This interval is measured from third sending failure on the lowest data rate. At this point 3 * (hw-retries + 1) frame
transmits on the lowest data rate had failed. During disconnect-timeout packet transmission will be retried with
on-fail-retry-time interval. If no frame can be transmitted successfully during disconnect-timeout, connection is
closed, and this event is logged as "extensive data loss". Successful frame transmission resets this timer.
What is adaptive-noise-immunity setting?
Adaptive Noise Immunity (ANI) adjusts various receiver parameters dynamically to minimize interference and noise
effect on the signal quality [1] This setting is added in the wireless driver for Atheros AR5212 and newer chipset
cards
How does wireless device measure signal strength, when access-list or connect-list are used ?
Reported signal level is exponentially weighted moving average with smoothing factor 50%.
What error correction methods are supported in the RouterOS wireless?
ARQ method is supported in nstreme protocols. Regular 802.11 standard does not include ARQ - retrasmission of
corrupt frames is based on acknowledgement protocol. RouterOS supports forward error correction coding
(convolutional coding) with coding rates: 1/2, 2/3, or 3/4.
Setups
Will an amplifier improve the speed on my link?
It depends on your signal quality and noise. Remember that you can probably get a better link with low output power
setting, and a good antenna. Amplifier increases the noise and will only cause problems with the link.
The amplifier gets a boost on both the transmitted and received signal. Thus, in "silent" areas, where you are alone
or with very few "noise" or "competition", you might get excellent results. On the other side, in crowded areas, with
lots of wireless activity, you will also increase signal received from every other competitor or noise source, which
may dramatically lower the overall quality of the link. Also, take in account the EIRP to see if your link remains in
legal limits.
You could also get better signal on "11b only" radios, which see most of 802.11g as "noise", thus filtering better the
usable signal.
How to fine-tune the wireless link with hw-retries?
You should understand that for 802.11 devices there is really limited amount of information (or "feedback" from the
environment) that devices can use to tune their behavior:
signal strength, which could be used to figure out best transmit rate knowing receiver sensitivity. Sill this is not
reliable taking into account that sensitivity for different receivers varies (e.g. changes over time), path conditions
are not symmetric (and device can only measure signal strength it receives), etc.
by receiving/not receiving acknowledgment for frame sent.
Taking into account that using signal strength is not reliable, 802.11 device is essentially left with only one
"feedback" to tune its operation - success/failure of transmission. When transmission fails (ACK not received in
time), there is no way how sender can figure out why it failed - either because of noise, multipath, direct interference
(and wether that disturbed actual data frame or the ACK itself) - frame just did not make it and in general it does not
matter "why". All that matters is packet error rate.
111
Manual:Wireless FAQ
Therefore RouterOS implements algorithm to try to use medium most efficiently in any environment by using only
this limited information, giving users the ability to control how algorithm works and describing the algorithm. And
there are only a few usage guidelines, not a set of values you should use in particular situation.
In general - the larger hw-retries, the better "feedback" device gets about medium ability to deliver frame at
particular rate (e.g. if sending frame with rate 54mbps fails 16 times, it is telling you more than if it fails with 2
retries) and the better it can figure out optimal transmit rate, at the expense of latency it can introduce in network because during all those failing retries, other devices in this channel can not send. So bigger hw-retries can be
suggested for ptp backbone links - where it is known that link must be always on. Less hw-retries make rate
selection adapt faster at the expense of some accuracy (going below 2 is not reasonable in most cases), this can be
suggested for ptmp links, where it is normal for links to connect/disconnect and keeping latency down is important.
on-fail-retry-time and disconnect-timeout controls how hard device will try to consider remote party "connected".
Larger disconnect-timeout will make device not "disconnect" other party, even if there are lots of loss at the smallest
possible transmission rate. This again is most useful for "weak" links that are known that they "must" be established
(e.g. backbone links). In ptmp networks large disconnect-timeout will again increase latency in network during the
time e.g. AP will attempt to send data to some client that has just been disabled (AP will try to do this for whole
disconnect-timeout).
frame-lifetime allows to tune for how long AP is attempting to use frame for transmitting before considering that it is
not worth delivering it (for example, if sending frame fails at lowest possible rate, on-fail-retry-time timer is enabled,
if during this timer frame-lifetime expires, particular frame is dropped and next transmission attempt will happen
with next frame. Disabled frame-lifetime means that wireless will ensure in order delivery of "all" data frames, no
matter how long it takes, "or" will drop the connection if everything fails). This allows to optimize for different types
of traffic e.g. for real-time traffic - if primary use of wireless network is e.g. voip, then it can be reasonable to limit
frame-lifetime, because voip tolerates small loss better than high latency.
Is it possible to use the wireless repeater only with one radio interface?
This setup it possible by using WDS on the wireless interface which is running in ap-bridge mode.
References
[1] http:/ / www. patentstorm. us/ patents/ 7349503. html
112
113
Debug Logs will give you more specific informantion on each step of the Client wireless connection and
disconnection. The first line shows that the wireless client tried to connect to the AP. On the second line the AP
checked to see if that client is allowed to connect to the AP and the resulting action. And only on the third line do
you see that the client is connected. This is merely one example of the debug log messages. The description of all
debug entries is written below.
To enable the wireless debug logs you should execute such commands:
[admin@MikroTik] > /system logging
[admin@MikroTik] system logging> add topics=wireless,debug action=memory
Or
in
Winbox:
This will help you understand and fix wireless problems with ease and with less interaction with the support team.
STATION MODE
<MAC>@<DEV>: lost connection, <REASON>
Station has lost connection to AP because of <REASON>
<MAC>@<DEV>: failed to connect, <REASON>
Station attempted to connect to AP, but failed due to <REASON>
<MAC>@<DEV>: established connection on <FREQ>, SSID <SSID>
Station attempted and succesfully connected to AP with SSID <SSID> on frequency <FREQ>.
<MAC>@<DEV>: MIC failure!!!
TKIP message integrity check failure, somebody must be trying to break into or DOS network, If more than 1 MIC
failure is encountered during 60s period, "TKIP countermeasures" state is entered.
<MAC>@<DEV>: enter TKIP countermeasures
Entered TKIP countermeasures state, this means that Station will disconnect from AP and keep silence for 60s.
AP MODE
<DEV>: radar detected on <FREQ>
Radar detected on frequency <FREQ>, AP will look for other channel
<DEV>: data from unknown device <MAC>, sent deauth [(XXX events suppressed, YYY deauths
suppressed)]
Data frame from unknown device (read - not registered to this AP) with mac address <MAC> received, AP sent
deauthentication frame to it (as per 802.11). XXX is number of events that are not logged so that the log does not
become too large (logs are limited to 1 entry per 5s after first 5 entries), YYY is the number of deauthentication
frames that should have been sent, but were not sent, so that resources are not wasted sending too many
deauthentication frames (only 10 deauth frames per second are allowed).
The likely cause of such a message is that the Station previously connected to the AP, which does not yet know it has
been dropped from AP registration table, sending data to AP. Deauthentication message tells the Station that it is no
longer connected.
<DEV>: denying assoc to <MAC>, failed to setup compression
Failed to initialize compression on AP, most likely because there are too many clients attempting to connect and use
compression.
<DEV>: <MAC> is new WDS master
WDS slave has established connection to WDS master, this means that WDS slave starts accepting clients and acting
as AP.
<DEV>: <MAC> was WDS master
This message appears after connection with <MAC> is lost, means that WDS slave will disconnect all clients and
start scanning to find new WDS master.
<MAC>@<DEV>: connected [, is AP][, wants WDS]
Station with address <MAC> connected. if "is AP" present - remote device is AP, if "is WDS" presents, remote
device wants to establish WDS link.
<MAC>@<DEV>: disconnected, <REASON>
Connection with Station with address <MAC> terminated due to <REASON>
<DEV>: TKIP countermeasures over, resuming
114
<REASON>
"joining failed" - can only happen on Prism cards in station mode, failed to connect to AP due to some reason
"join timeout" - happens on Station, failed to synchronize to AP (receive first beacon frame). Most likely weak
signal, remote turned off, strong interference, some other RF related issue that makes communication impossible.
"no beacons" - no beacons received from remote end of WDS link. Most likely weak signal, remote turned off,
strong interference, some other RF related issue that makes communication impossible.
"extensive data loss" - local interface decided to drop connection to remote device because of inability to send data
to remote after multiple failures at lowest possible rate. Possible causes - too weak signal, remote device turned off,
strong interference, some other RF related issue that makes communication impossible.
"decided to deauth, <802.11 reason>" - local interface decided do deauthenticate remote device using 802.11
reason <802.11 reason>.
"inactivity" - remote device was inactive for too long
"device disabled" - local interface got disabled
"got deauth, <802.11 reason>" - received deauthentication frame from remote device, 802.11 reason code is
reported in <802.11 reason>
"got disassoc, <802.11 reason>" - received disassociation frame from remote device, 802.11 reason code is
reported in <802.11 reason>
"auth frame from AP" - authentication frame from remote device that is known to be AP, most likely mode
changes on remote device from AP to Station.
"bad ssid" - bad ssid for WDS link
"beacon from non AP" - received beacon frame from remote device that is known to be non-AP node, most likely
mode changes on remote device from Station to AP.
"no WDS support" - does not report WDS support
"failed to confirm SSID" - failed to confirm SSID of other end of WDS link.
"hardware failure" - some hardware failure or unexpected behaviour. Not likely to be seen.
"lost connection" - can only happen on Prism cards in station mode, connection to AP lost due to some reason.
"auth failed <802.11 status>" - happens on Station, AP denies authentication, 802.11 status code is reported in
<802.11 status>.
"assoc failed <802.11 status>" - happens on Station, AP denies association, 802.11 status code is reported in
<802.11 status>.
"auth timeout" - happens on Station, Station does not receive response to authentication frames, either bad link or
AP is ignoring this Station for some reason.
"assoc timeout" - happens on Station, Station does not receive response to association frames, either bad link or AP
is ignoring this Station for some reason.
"reassociating" - happens on AP: connection assumed to be lost, because Station that is considered already
associated attempts to associate again. All connection related information must be deleted, because during
association process connection parameters are negotiated (therefore "disconnected"). The reason why Station
reassociates must be looked for on Station (most likely cause is that Station for some reason dropped connection
115
See Also
Management Frames and Connection/Disconnection messages [1] by GTHill.com
References
[1] http:/ / www. gthill. com/ managementframes. pdf
116
Manual:Interface/VLAN
Manual:Interface/VLAN
Applies to RouterOS: v3, v4+
Summary
Sub-menu: /interface vlan
Standards: IEEE 802.1Q [1]
Virtual Local Area Network (VLAN) is layer 2 method that allows you to have multiple Virtual LANs on a single
physical interface (ethernet, wireless, etc.), giving the ability to segregate LANs efficiently.
You can use MikroTik RouterOS (as well as Cisco IOS, Linux and other router systems) to mark these packets as
well as to accept and route marked ones.
As VLAN works on OSI Layer 2, it can be used just as any other network interface without any restrictions. VLAN
successfully passes through regular Ethernet bridges.
You can also transport VLANs over wireless links and put multiple VLAN interfaces on a single wireless interface.
Note that as VLAN is not a full tunnel protocol (i.e., it does not have additional fields to transport MAC addresses of
sender and recipient), the same limitation applies to bridging over VLAN as to bridging plain wireless interfaces. In
other words, while wireless clients may participate in VLANs put on wireless interfaces, it is not possible to have
VLAN put on a wireless interface in station mode bridged with any other interface.
802.1Q
The most commonly used protocol for Virtual LANs (VLANs) is IEEE 802.1Q. It is standardized encapsulation
protocol that defines how to insert a four-byte VLAN identifier into Ethernet header. (see Figure 12.1.)
Each VLAN is treated as separate subnet. It means that, by default, host in specific VLAN cannot communicate with
host that is member of another VLAN, although they are connected in the same switch. So if you want inter-VLAN
communication you need a router. RouterOS supports up to 4095 VLAN interfaces, each with a unique VLAN ID,
per interface. VLAN priorites may also be used and manipulated.
When the VLAN extends over more than one switch, the inter-switch link have to become trunk, where packets are
tagged to indicate which VLAN they belong to. A trunk carries the traffic of multiple VLANs, it is like a
point-to-point link that carries tagged packets between switches or between a switch and router.
117
Manual:Interface/VLAN
118
Q-in-Q
Original 802.1Q allows only one vlan header, Q-in-Q in the other hand allows two or more vlan headers. In
RouterOS Q-in-Q can be configured by adding one vlan interface over another. Example:
/interface vlan
add name=vlan1 vlan-id=11 interface=ether1
add name=vlan2 vlan-id=12 interface=vlan1
If any packet is sent over "vlan2" interface, two vlan tags will be added to ethernet header - "11" and "12".
Properties
Property
Description
Layer2 MTU. For VLANS this value is not configurable. Read more>>
Interface name
Virtual LAN identifier or tag that is used to distinguish VLANs. Must be equal for all
computers that belong to the same VLAN.
Manual:Interface/VLAN
119
Note: MTU should be set to 1500 bytes as on Ethernet interfaces. But this may not work with some Ethernet
cards that do not support receiving/transmitting of full size Ethernet packets with VLAN header added (1500
bytes data + 4 bytes VLAN header + 14 bytes Ethernet header). In this situation MTU 1496 can be used, but
note that this will cause packet fragmentation if larger packets have to be sent over interface. At the same
time remember that MTU 1496 may cause problems if path MTU discovery is not working properly between
source and destination.
Setup examples
Simple Example
Lets assume that we have several MikroTik routers connected to a hub. Remember that hub is OSI physical layer
device (if there is a hub between routers, then from L3 point of view it is the same as Ethernet cable connection
between them). For simplification assume that all routers are connected to the hub using ether1 interface and has
assigned IP addresses as illustrated in figure below. Then on each of them the VLAN interface should be created.
NAME
MTU
VLAN2
1500
ARP
enabled
VLAN-ID INTERFACE
2
ether1
R4:
[admin@MikroTik] /interface vlan> add name=VLAN2 vlan-id=2 interface=ether1 disabled=no
[admin@MikroTik] /interface vlan> print
Flags: X - disabled, R - running, S - slave
#
0 R
NAME
MTU
VLAN2
1500
ARP
enabled
VLAN-ID INTERFACE
2
ether1
Manual:Interface/VLAN
The next step is to assign IP addresses to the VLAN interfaces.
R2:
[admin@MikroTik] ip address> add address=10.10.10.3/24 interface=VLAN2
[admin@MikroTik] ip address> print
Flags: X - disabled, I - invalid, D - dynamic
#
ADDRESS
NETWORK
BROADCAST
INTERFACE
0
10.0.1.4/24
10.0.1.0
10.0.1.255
ether1
1
10.20.0.1/24
10.20.0.0
10.20.0.255
pc1
2
10.10.10.3/24
10.10.10.0
10.10.10.255
vlan2
[admin@MikroTik] ip address>
R4:
[admin@MikroTik] ip address> add address=10.10.10.5/24 interface=VLAN2
[admin@MikroTik] ip address> print
Flags: X - disabled, I - invalid, D - dynamic
#
ADDRESS
NETWORK
BROADCAST
INTERFACE
0
10.0.1.5/24
10.0.1.0
10.0.1.255
ether1
1
10.30.0.1/24
10.30.0.0
10.30.0.255
pc2
2
10.10.10.5/24
10.10.10.0
10.10.10.255
vlan2
[admin@MikroTik] ip address>
At this point it should be possible to ping router R4 from router R2 and vice versa:
'''Ping from R2 to R4:'''
[admin@MikroTik] ip address> /ping 10.10.10.5
10.10.10.5 64 byte ping: ttl=255 time=4 ms
10.10.10.5 64 byte ping: ttl=255 time=1 ms
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 1/2.5/4 ms
'''From R4 to R2:'''
[admin@MikroTik] ip address> /ping 10.10.10.3
10.10.10.3 64 byte ping: ttl=255 time=6 ms
10.10.10.3 64 byte ping: ttl=255 time=1 ms
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 1/3.5/6 ms
To make sure if VLAN setup is working properly, try to ping R1 from R2. If pings are timing out then VLANs are
successfully isolated.
120
Manual:Interface/VLAN
'''From R2 to R1:'''
[admin@MikroTik] ip address> /ping 10.10.10.2
10.10.10.2 ping timeout
10.10.10.2 ping timeout
3 packets transmitted, 0 packets received, 100% packet loss
Each VLAN has its own separate subnet (broadcast domain) as we see in figure above:
VLAN 2 10.10.20.0/24;
VLAN 3 10.10.30.0/24;
VLAN 4 10.10.40.0./24.
VLAN configuration on most of switches is straightforward, basically we need to define which ports are members of
VLAN and define "trunk" port that can carry tagged frames between switch and router.
Configuration example on MikroTik router:
Create VLAN interfaces:
/interface vlan
add name=VLAN2 vlan-id=2 interface=ether1 disabled=no
add name=VLAN3 vlan-id=3 interface=ether1 disabled=no
add name=VLAN4 vlan-id=4 interface=ether1 disabled=no
121
Manual:Interface/VLAN
Add IP addresses to VLANs:
/ip
add
add
add
address
address=10.10.20.1/24 interface=VLAN2
address=10.10.30.1/24 interface=VLAN3
address=10.10.40.1/24 interface=VLAN4
RouterA:
/ip address add address=10.22.0.1/24 interface=ether1
/interface vlan add interface=ether2 vlan-id=1 name=vlan1
/ip address add address=10.22.0.1/32 interface=vlan1 network=10.23.0.1
/ip route add gateway=10.23.0.1 dst-address=10.23.0.0/24
RouterB:
/ip address add address=10.23.0.1/24 interface=ether1
/interface vlan add interface=ether2 vlan-id=1 name=vlan1
/ip address add address=10.23.0.1/32 interface=vlan1 network=10.22.0.1
/ip route add gateway=10.22.0.1 dst-address=10.22.0.0/24
[ Top | Back to Content ]
References
[1] http:/ / standards. ieee. org/ getieee802/ download/ 802. 1Q-1998. pdf
122
Manual:IP/IPsec
Manual:IP/IPsec
Applies to RouterOS: v6.0 +
Summary
Sub-menu: /ip ipsec
Package required: security
Standards: RFC 4301
Internet Protocol Security (IPsec) is a set of protocols defined by the Internet Engineering Task Force (IETF) to
secure packet exchange over unprotected IP/IPv6 networks such as Internet.
IpSec protocol suite can be divided in following groups:
Authentication Header (AH) RFC 4302
Encapsulating Security Payload (ESP) RFC 4303
Internet Key Exchange (IKE) protocols. Dynamically generates and distributes cryptographic keys for AH and
ESP.
Transport mode
In transport mode AH header is inserted after IP header. IP data and header is used to calculate authentication value.
IP fields that might change during transit, like TTL and hop count, are set to zero values before authentication.
Tunnel mode
In tunnel mode original IP packet is encapsulated within a new IP packet. All of the original IP packet is
authenticated.
123
Manual:IP/IPsec
ESP Header - Comes before the encrypted data and its placement depends on whether ESP is used in transport
mode or tunnel mode.
ESP Trailer - This section is placed after the encrypted data. It contains padding that is used to align the
encrypted data.
ESP Authentication Data - This field contains an Integrity Check Value (ICV), computed in a manner similar to
how the AH protocol works, for when ESP's optional authentication feature is used.
Transport mode
In transport mode ESP header is inserted after original IP header. ESP trailer and authentication value is added to the
end of the packet. In this mode only IP payload is encrypted and authenticated, IP header is not secured.
Tunnel mode
In tunnel mode original IP packet is encapsulated within a new IP packet thus securing IP payload and IP header.
Encryption algorithms
RouterOS ESP supports various encryption and authentication algorithms.
Authentication:
SHA1
MD5
Encryption:
Hardware encryption
Hardware encryption allows to do faster encryption process by using built-in encryption engine inside CPU. AES is
the only algorithm that will be accelerated in hardware.
List of RouterBoards with enabled hardware support:
RB1000
RB1100AHx2
For comparison RB1000 with enabled HW support can forward up to 550Mbps encrypted traffic. When HW support
is disabled it can forward only 150Mbps encrypted traffic in AES-128 mode.
Some configuration advices on how to get maximum ipsec throughput on multicore RB1100AHx2:
Avoid using ether12 and ethet13. Since these prots are pci-x they will be slowest ones.
Fastest forwarding is from switch chip ports (ether1-ether10) to ether11 (directly connected to CPU) and vice
versa.
Set hardware queue on all interfaces
/queue interface set [find] queue=only-hardware-queue
Disable RPS:
/system resource irq rps disable [find]
124
Manual:IP/IPsec
Assign one CPU core to ether11 and other CPU core to everything else. Forwarding over ether11 requires more
CPU that is why we are giving one core only for that interface (in IRQ setting ether11 is listed as ether12 tx,rx
and error).
/system resource irq
set [find] cpu=1
set [find users="eth12 tx"] cpu=0
set [find users="eth12 rx"] cpu=0
set [find users="eth12 error"] cpu=0
disable connection tracking
With all above recommendations it is possible to forward 820Mbps (1470byte packets two streams).
With enabled connection tracking 700Mbps (1470 byte packets two streams).
authentication method
DH group
encryption algorithm
exchange mode
hash alorithm
NAT-T
DPD and lifetime (optional)
Phase 2 - The peers establish one or more SAs that will be used by IPsec to encrypt data. All SAs established by
IKE daemon will have lifetime values (either limiting time, after which SA will become invalid, or amount of
data that can be encrypted by this SA, or both). This phase should match following settings:
Ipsec protocol
mode (tunnel or transport)
authentication method
PFS (DH) group
lifetime
125
Manual:IP/IPsec
126
Note: There are two lifetime values - soft and hard. When SA reaches it's soft lifetime treshold, the IKE
daemon receives a notice and starts another phase 2 exchange to replace this SA with fresh one. If SA reaches
hard lifetime, it is discarded.
Warning: Phase 1 is not re-keyed if DPD is disabled when lifetime expires, only phase 2 is re-keyed. To
force phase 1 re-key, enable DPD.
IKE can optionally provide a Perfect Forward Secrecy (PFS), which is a property of key
exchanges, that, in turn, means for IKE that compromising the long term phase 1 key will not
allow to easily gain access to all IPsec data that is protected by SAs established through this phase
1. It means an additional keying material is generated for each phase 2.
Generation of keying material is computationally very expensive. Exempli gratia, the use of modp8192 group can
take several seconds even on very fast computer. It usually takes place once per phase 1 exchange, which happens
only once between any host pair and then is kept for long time. PFS adds this expensive operation also to each phase
2 exchange.
Diffie-Hellman Groups
Diffie-Hellman (DH) key exchange protocol allows two parties without any initial shared secret to create one
securely. The following Modular Exponential (MODP) and Elliptic Curve (EC2N) Diffie-Hellman (also known as
"Oakley") Groups are supported:
Diffie-Hellman Group Name
Reference
Group 1
RFC 2409
Group 2
RFC 2409
Group 3
Group 4
Group 5
RFC 3526
IKE Traffic
To avoid problems with IKE packets hit some SPD rule and require to encrypt it with not yet established SA (that
this packet perhaps is trying to establish), locally originated packets with UDP source port 500 are not processed
with SPD. The same way packets with UDP destination port 500 that are to be delivered locally are not processed in
incoming policy check.
Setup Procedure
To get IPsec to work with automatic keying using IKE-ISAKMP you will have to configure policy, peer and
proposal (optional) entries.
Warning: Ipsec is very sensitive to time changes. If both ends of the IpSec tunnel are not synchronizing time
equally(for example, different NTP servers not updating time with the same timestamp), tunnels will break
and will have to be established again.
Manual:IP/IPsec
127
Mode Config
Sub-menu: /ip ipsec mode-cfg
Note: If RouterOS client is initiator, it will always send CISCO UNITY extension, and RouterOS supports
only split-include from this extension.
Property
Description
Name of the address pool from which responder will try to assign address if mode-cfg is enabled.
address-prefix-length (integer
[1..32]; Default: )
List of subnets in CIDR format, which will be sent to the peer using CISCO UNITY extension,
remote peer will create dynamic policy for these subnets.
Peer configuration
Sub-menu: /ip ipsec peer
Peer configuration settings are used to establish connections between IKE daemons ( phase 1 configuration). This
connection then will be used to negotiate keys and algorithms for SAs.
Starting from v6rc12 responder side now uses initiator exchange type for peer config selection. It means that you can
configure multiple ipsec peers with the same address but different exchange modes or encryption methods.
Note: exchange modes main and l2tp-main are treated the same, so these modes cannot be used select config
between multiple peers.
Property
Description
If remote peer's address matches this prefix, then the peer configuration is used in authentication
and establishment of Phase 1. If several peer's addresses match several configuration entries, the
most specific one (i.e. the one with largest netmask) will be used.
auth-method (pre-shared-key |
rsa-signature; Default: pre-shared-key)
Authentication method:
Name of a certificate listed in certificate table (signing packets; the certificate must have private
key). Applicable if RSA signature authentication method (auth-method=rsa-signature) is used.
Manual:IP/IPsec
128
dpd-interval (time | disable-dpd; Default: Dead peer detection interval. If set to disable-dpd, dead peer detection will not be used.
2m)
dpd-maximum-failures (integer: 1..100; Maximum count of failures until peer is considered to be dead. Applicable if DPD is enabled.
Default: 5)
enc-algorithm (3des | aes-128 | aes-192 | Encryption algorithm.
aes-256 | blowfish | camellia-128 |
camellia-192 | camellia-256 | des; Default:
aes-128)
exchange-mode (aggressive | base | main |
main-l2tp; Default: main)
Different ISAKMP phase 1 exchange modes according to RFC 2408. Do not use other modes then
main unless you know what you are doing. main-l2tp mode relaxes rfc2409 section 5.4, to allow
pre-shared-key authentication in main mode.
Allow this peer to establish SA for non-existing policies. Such policies are created dynamically
for the lifetime of SA. Automatic policies allows, for example, to create IPsec secured L2TP
tunnels, or any other setup where remote peer's IP address is not known at the configuration time.
Phase 1 lifetime: specifies how much bytes can be transferred before SA is discarded. If set to 0,
SA will not be discarded due to byte count excess.
Name of the mode config parameters from mode-cfg menu. When parameter is set mode-cfg is
enabled.
initiator peer on phase1 will send mode-cfg request and will set assigned IP address and DNS.
responder will assign ip address if address-pool is specified, will send also DNS server
addresses and split-include subnets (if defined).
By default IP address is used as ID. This parameter replaces ID with specified value. Can be used,
for example, in cases if DNS name as ID is required.
Use Linux NAT-T mechanism to solve IPsec incompatibility with NAT routers inbetween IPsec
peers. This can only be used with ESP protocol (AH is not supported by design, as it signs the
complete packet, including IP header, which is changed by NAT, rendering AH signature invalid).
The method encapsulates IPsec ESP traffic into UDP streams in order to overcome some minor
issues that made ESP incompatible with NAT.
When passive mode is enabled will wait for remote peer to initiate IKE connection. Enabled
passive mode also indicates that peer is xauth responder, and disabled passive mode - xauth
initiator.
If generate-policy is enabled, responder checks against templates from the same group. If none of
the templates match, Phase2 SA will not be established.
Manual:IP/IPsec
129
Name of a certificate (listed in certificate table) for authenticating the remote side (validating
packets; no private key required). Applicable if RSA signature authentication method is used. If
remote-certificate is not specified then received certificate from remote peer is used and checked
against CA in certificate store. Proper CA must be imported in certificate store.
Secret string (in case pre-shared key authentication is used). If it starts with '0x', it is parsed as a
hexadecimal value
Specifies whether to send "initial contact" IKE packet or wait for remote side, this packet should
trigger removal of old peer SAs for current source address. Usually in road warrior setups clients
are initiators and this parameter should be set to no.
claim - take shortest of proposed and configured lifetimes and notify initiator about it
exact - require lifetimes to be the same
obey - accept whatever is sent by an initiator
strict - if proposed lifetime is longer than the default then reject proposal otherwise accept
proposed lifetime
Note: IPSec phases information is erased, when /ip ipsec peer configuration is modified on the fly, however
packets are being encrypted/decrypted because of installed-sa (for example remote-peers information is
erased, when peer configuration is modified.
Keys
Sub-menu: /ip ipsec key
This submenu list all imported public/private keys, that can be used for peer authentication. Submenu also has
several commands to work with keys.
For example print below shows two imported 1024-bit keys, one public and one private.
[admin@PoETik] /ip ipsec key> print
Flags: P - private-key, R - rsa
#
NAME
KEY-SIZE
0 PR priv
1024-bit
1024-bit
R pub
Commands
Manual:IP/IPsec
130
Property
Description
export-pub-key (file-name;
key)
Generate private key. Takes two parameters, name of newly generated key and key size 1024,2048 and
4096.
Policy
Sub-menu: /ip ipsec policy
Policy table is used to determine whether security settings should be applied to a packet.
Property
Description
dst-port (integer:0..65535 | any; Default: any) Destination port to be matched in packets. If set to any all ports will be matched
group (string; Default: default)
Specifies what to do if some of the SAs for this policy cannot be found:
use - skip this transform, do not drop packet and do not acquire SA from IKE daemon
require - drop packet and acquire SA
unique - drop packet and acquire a unique SA that is only used with this particular
policy
priority (integer:-2147483646..2147483647;
Default: 0)
Policy ordering classificator (signed integer). Larger number means higher priority.
Name of the proposal template that will be sent by IKE daemon to establish SAs for this
policy.
Source IP prefix
Manual:IP/IPsec
131
Creates a template and assigns it to specified policy group Following parameters are used by
template:
Note: All packets are IPIP encapsulated in tunnel mode, and their new IP header's src-address and dst-address
are set to sa-src-address and sa-dst-address values of this policy. If you do not use tunnel mode (id est you use
transport mode), then only packets whose source and destination addresses are the same as sa-src-address and
sa-dst-address can be processed by this policy. Transport mode can only work with packets that originate at
and are destined for IPsec peers (hosts that established security associations). To encrypt traffic between
networks (or a network and a host) you have to use tunnel mode.
Policy Stats
Command /ip ipsec policy print stats will show current status of the policy. Additional read-only
parameters will be printed.
Property
Description
in-accepted (integer)
How many incoming packets were passed by the policy without an attempt to decrypt.
in-dropped (integer)
How many incoming packets were dropped by the policy without an attempt to decrypt
in-transformed (integer)
How many incoming packets were decrypted (ESP) and/or verified (AH) by the policy
out-accepted (integer)
How many outgoing packets were passed by the policy without an attempt to encrypt.
out-dropped (integer)
How many outgoing packets were dropped by the policy without an attempt to encrypt.
out-transformed (integer)
How many outgoing packets were encrypted (ESP) and/or verified (AH) by the policy.
Dumping Policies
It is possible to dump policies installed into the kernel for debugging purposes with command:
/ip ipsec policy
dump-kernel-policies
After executing this command check the logs to see the result, there should be three policies in the kernel: forward,
in and out.
[admin@test-host] >/log print
07:28:34 ipsec,debug,packet policy ipsec fwd: 10.5.101.9[0] - 10.5.101.13[0]
07:28:34 ipsec,debug,packet policy ipsec in: 10.5.101.9[0] - 10.5.101.13[0]
07:28:34 ipsec,debug,packet policy ipsec out: 10.5.101.13[0] - 10.5.101.9[0]
Manual:IP/IPsec
132
Policy Groups
Sub-menu: /ip ipsec policy group
Property
Description
Proposal settings
Sub-menu: /ip ipsec proposal
Proposal information that will be sent by IKE daemon to establish SAs for this policy ( Phase 2). Configured
proposals are set in policy configuration.
Property
auth-algorithms (md5|sha1|null|sha256|sha512; Default: sha1)
Description
Allowed
algorithms
for
authorization.
sha1 is
stronger, but
slower
algorithm.
Short
description
of an item.
Whether
item is
disabled.
enc-algorithms
Allowed
(null|des|3des|aes-128-cbc|aes-128-cbc|aes-128gcm|aes-192-cbc|aes-192-ctr|aes-192-gcm|aes-256-cbc|aes-256-ctr|aes-256-gcm|blowfish|camellia-128|camellia-192|camellia-256|twofish; algorithms
Default: aes-128-cbc)
and key
lengths to
use for SAs.
How long to
use SA
before
throwing it
out.
Name of the
proposal
template, that
will be
identified in
other parts of
ipsec
configuration.
pfs-group (ec2n155 | ec2n185 | modp1024 | modp1536 | modp2048 | modp3072 | modp4096 | modp6144 | modp768 | none; Default: modp1024)
Diffie-Helman
group used
for Perfect
Forward
Secrecy.
Manual:IP/IPsec
133
Manual SA
Sub-menu: /ip ipsec manual-sa
Menu is used to configure SAs manually. Created SA template then can be used in policy configuration.
Property
Description
ah-algorithm (in/out
in,out = md5|null|sha1; Default: null)
Incoming-authentication-key/outgoing-authentication-key
Incoming-SA-SPI/outgoing-SA-SPI
esp-auth-algorithm (in/out
in,out = md5|null|sha1; Default: null)
Incoming-authentication-key/outgoing -authentication-key
esp-enc-algorithm (in/out
in,out = 3des | aes-128 | aes-192 | aes-256 | des | ...; Default: null)
Incoming-encryption-algorithm
Incoming-encryption-key/outgoing-encryption-key
Lifetime of this SA
Installed SA
Sub-menu: /ip ipsec installed-sa
This facility provides information about installed security associations including the keys.
Property
Description
AH (yes | no)
ESP (yes | no)
add-lifetime (time/time)
soft - time period after which ike will try to establish new SA
hard - time period after which SA is deleted
addtime (time)
auth-key (string)
dst-address (IP)
enc-algorithm (des | 3des | aes ...) Shows currently used encryption algorithm
pfs (yes | no)
replay (integer)
spi (string)
src-address (IP)
state (string)
Manual:IP/IPsec
134
Flushing SAs
Sometimes after incorrect/incomplete negotiations took place, it is required to flush manually the installed SA table
so that SA could be renegotiated. This option is provided by the /ip ipsec installed-sa flush
command.
This command accepts only one property:
Property
Description
Remote Peers
Sub-menu: /ip ipsec remote-peers
This submenu provides you with various statistics about remote peers that currently have established phase 1
connections with this router. Note that if peer doesn't show up here, it doesn't mean that no IPsec traffic is being
exchanged with it.
Read only properties:
Property
Description
local-address (ip/ipv6
address)
remote-address (ip/ipv6
address)
state (string)
State of phase 1 negotiation with the peer. For example when phase1 and phase 2 are negotiated it will show
state "established".
established (time)
Statistics
Sub-menu: /ip ipsec statistics
This menu shows various ipsec statistics
Manual:IP/IPsec
135
Property
Description
in-errors (integer)
in-buffer-errors (integer)
No free buffer.
in-header-errors (integer)
Header error
in-no-states (integer)
No state is found i.e. Either inbound SPI, address, or IPsec protocol at SA is wrong
in-state-protocol-errors
(integer)
Transformation protocol specific error, for example SA key is wrong or hardware accelerator is
unable to handle amount of packets.
in-state-mode-errors (integer)
in-state-sequence-errors
(integer)
in-state-expired (integer)
State is expired
in-state-mismatches (integer)
State has mismatched option, for example UDP encapsulation type is mismatched.
in-state-invalid (integer)
State is invalid
in-template-mismatches (integer)
No matching template for states, e.g. Inbound SAs are correct but SP rule is wrong
in-no-policies (integer)
No policy is found for states, e.g. Inbound SAs are correct but no SP is found
in-policy-blocked (integer)
Policy discards
in-policy-errors (integer)
Policy errors
out-errors (integer)
out-bundle-errors (integer)
No state is found
out-state-protocol-errors
(integer)
out-state-mode-errors (integer)
out-state-sequence-errors
(integer)
out-state-expired (integer)
State is expired
out-policy-blocked (integer)
Policy discards
out-policy-dead (integer)
Policy is dead
out-policy-errors (integer)
Policy error
Application Examples
Simple Mutual PSK XAuth Config
Server side config:
/ip ipsec peer
add address=2.2.2.1 auth-method=pre-shared-key-xauth secret="123" passive=yes
/ip ipsec user
add name=test password=345
Client side config:
Manual:IP/IPsec
136
Typically in RoadWarrior setups as this it is impossible to know from which address user will connect, so we need to
set up generate-policy parameter on the server side. However this leads to other problems, client can generate
any policy and access any network in the office. Even set 0.0.0.0/0 and deny internet access to office workers.
Mode Conf, policy group and policy templates will allow us to overcome these problems.
IpSec Server Config
At first we need a pool from which RoadWarrior will will get an address. Typically in office you set up DHCP
server for local workstations, the same DHCP pool can be used.
/ip pool
add name=ipsec-RW ranges=192.168.55.2-192.168.55.254
Next we need to set up what settings to send to the client using Mode Conf.
/ip ipsec mode-cfg
add address-pool=ipsec-RW name=RW-cfg split-include=\
10.5.8.0/24,192.168.55.0/24
Manual:IP/IPsec
As you can see we specified from which pool to give out address and two allowed subnets.
Now to allow only specific source/destination address in generated policies we will use policy group and create
policy templates:
/ip ipsec policy group
add name=RoadWarrior
/ip ipsec policy
add dst-address=192.168.55.0/24 group=RoadWarrior src-address=10.5.8.0/24 \
template=yes
add dst-address=192.168.55.0/24 group=RoadWarrior src-address=192.168.55.0/24 \
template=yes
Now we just add xauth users and peer with enabled Mode Conf and policy group.
/ip ipsec user
add name=user1 password=123
add name=user2 password=234
/ip ipsec peer
add auth-method=pre-shared-key-xauth generate-policy=port-strict mode-cfg=RW-cfg \
policy-group=RoadWarrior secret=123 passive=yes
137
Manual:IP/IPsec
n:phase2-life-kbytes:0
n:policy-nailed:1
n:policy-list-auto:1
n:client-addr-auto:1
s:network-host:2.2.2.2
s:client-auto-mode:pull
s:client-iface:virtual
s:network-natt-mode:disable
s:network-frag-mode:disable
s:auth-method:mutual-psk-xauth
s:ident-client-type:address
s:ident-server-type:address
b:auth-mutual-psk:MTIz
s:phase1-exchange:main
s:phase1-cipher:3des
s:phase1-hash:md5
s:phase2-transform:esp-3des
s:phase2-hmac:sha1
s:ipcomp-transform:disabled
n:phase2-pfsgroup:2
s:policy-level:require
138
Manual:IP/IPsec
139
NAME
COMMON-NAME
FINGERPRINT
0 K L A T myCa
myCa
7fa636e6576495fe78f1a4...
1 K
I T server
server
cf0650a291bf4685f2fbd3...
2 K
client1
client1
26233de30e89b203b946ab...
3 K
client2
client2
cf172b62201befaf8d8966...
Testing CRL
Now lets say client2 should not be able to connect anymore. We need to revoke its certificate so that it is excluded
from CRL list.
/certificate
issued-revoke client2
Notice R flag, which means that certificate is revoked
[admin@pe0] /certificate> print
Flags: K - private-key, D - dsa, L - crl, C - smart-card-key,
A - authority, I - issued, R - revoked, E - expired, T - trusted
#
NAME
COMMON-NAME
FINGERPRINT
0 K L A T myCa
myCa
7fa636e6576495fe78f1a4...
1 K
I T server
server
cf0650a291bf4685f2fbd3...
2 K
client1
client1
26233de30e89b203b946ab...
3 K
client2
client2
cf172b62201befaf8d8966...
Now if you kill current connection client2 will no be able to establish phase1.
Manual:IP/IPsec
Two remote office routers are connected to internet and office workstations behind routers are NATed. Each office
has its own local subnet, 10.1.202.0/24 for Office1 and 10.1.101.0/24 for Office2. Both remote offices needs secure
tunnel to local networks behind routers.
IP Connectivity
On both routers ether1 is used as wan port and ether2 is used to connect workstations. Also NAT rules are set tu
masquerade local networks.
Office1 router:
/ip address
add address=192.168.90.1/24 interface=ether1
add address=10.1.202.1/24 interface=ether2
/ip route
add gateway=192.168.90.254
/ip firewall nat
add chain=srcnat out-interface=ether1 action=masquerade
Office2 router:
/ip address
add address=192.168.80.1/24 interface=ether1
add address=10.1.101.1/24 interface=ether2
/ip route
add gateway=192.168.80.254
/ip firewall nat
140
Manual:IP/IPsec
add chain=srcnat out-interface=ether1 action=masquerade
IpSec Peer's config
Next step is to add peer's configuration. We need to specify peers address and port and pre-shared-key. Other
parameters are left to default values.
Office1 router:
/ip ipsec peer
add address=192.168.80.1/32 port=500 auth-method=pre-shared-key secret="test"
Office2 router:
/ip ipsec peer
add address=192.168.90.1/32 port=500 auth-method=pre-shared-key secret="test"
Policy and proposal
It is important that proposed authentication and encryption algorithms match on both routers. In this example we can
use predefined "default" proposal
[admin@MikroTik] /ip ipsec proposal> print
Flags: X - disabled
0
name="default" auth-algorithms=sha1 enc-algorithms=3des lifetime=30m
pfs-group=modp1024
As we already have proposal as a next step we need correct IpSec policy. We want to encrypt traffic coming form
10.1.202.0/24 to 10.1.101.0/24 and vice versa.
Office1 router:
/ip ipsec policy
add src-address=10.1.202.0/24 src-port=any dst-address=10.1.101.0/24 dst-port=any \
sa-src-address=192.168.90.1 sa-dst-address=192.168.80.1 \
tunnel=yes action=encrypt proposal=default
Office2 router:
/ip ipsec policy
add src-address=10.1.101.0/24 src-port=any dst-address=10.1.202.0/24 dst-port=any \
sa-src-address=192.168.80.1 sa-dst-address=192.168.90.1 \
tunnel=yes action=encrypt proposal=default
Note that we configured tunnel mode instead of transport, as this is site to site encryption.
141
Manual:IP/IPsec
142
NAT Bypass
At this point if you will try to establish IpSec tunnel it will not work, packets will be rejected. This is because both
routers have NAT rules that is changing source address after packet is encrypted. Remote router reiceves encrypted
packet but is unable to decrypt it because source address do not match address specified in policy configuration. For
more information see packet flow ipsec example.
To fix this we need to set up NAT bypass rule.
Office1 router:
/ip firewall nat
add chain=srcnat action=accept place-before=0 \
src-address=10.1.202.0/24 dst-address=10.1.101.0/24
Office2 router:
/ip firewall nat
add chain=srcnat action=accept place-before=0 \
src-address=10.1.101.0/24 dst-address=10.1.202.0/24
It is very important that bypass rule is placed at the top of all other NAT rules.
Note: If you previously tried to establish tunnel before NAT bypass rule was added, you have to clear
connection table from existing connection or restart the routers
Client needs secure connection to the office with public address 1.1.1.1, but server does not know what will be the
source address from which client connects. It is so called road-warrior setup. Our client will also be located behind
the router with enabled NAT.
For the setup RouterOS router will be used as the client device behind NAT (it can be any device: Windows PC,
Smartphone, Linux PC, etc.)
Manual:IP/IPsec
IP Connectivity
On the server:
/ip address
add address=1.1.1.1/24 interface=ether1
/ip route
add gateway=1.1.1.2
On the clients router:
/ip address
add address=2.2.2.2/24 interface=ether1
add address=10.5.8.0/24 interface=ether2
/ip route
add gateway=2.2.2.1
/ip firewall net
add chain=srcnat action=masquerade out-interface=ether1
On the client:
/ip address
add address=10.5.8.120/24 interface=ether1
L2TP Config
On the server:
/interface l2tp-server
set enabled=yes profil=default
/ip pool
add name=l2tp-pool ranges=192.168.1.2-192.168.1.20
/ppp profile
set default local-address=192.168.1.1 remote-address=l2tp-pool
/ppp secret
add name=l2tp-test password=test123456
On the client:
/interface l2tp-client
add connect-to=1.1.1.1 disabled=no name=l2tp-out1 password=password user=l2tp-test
143
Manual:IP/IPsec
144
IpSec Config
On server side:
/ip ipsec proposal
set [ find default=yes ] enc-algorithms=3des,aes-128,aes-192,aes-256
/ip ipsec peer
add generate-policy=yes hash-algorithm=sha1 nat-traversal=yes secret=test123456 \
send-initial-contact=no
RouterOS as client:
/ip
set
/ip
add
ipsec proposal
[ find default=yes ] enc-algorithms=aes-128
ipsec peer
address=1.1.1.1/32 hash-algorithm=sha1 nat-traversal=yes secret=test123456
Manual:Interface/EoIP
145
Manual:Interface/EoIP
Applies to RouterOS: 2.9, v3, v4+
Summary
Sub-menu: /interface eoip
Standards: GRE RFC 1701
Ethernet over IP (EoIP) Tunneling is a MikroTik RouterOS protocol that creates an Ethernet tunnel between two
routers on top of an IP connection. The EoIP tunnel may run over IPIP tunnel, PPTP tunne or any other connection
capable of transporting IP.
When the bridging function of the router is enabled, all Ethernet traffic (all Ethernet protocols) will be bridged just
as if there where a physical Ethernet interface and cable between the two routers (with bridging enabled). This
protocol makes multiple network schemes possible.
Network setups with EoIP interfaces:
Possibility to bridge LANs over the Internet
Possibility to bridge LANs over encrypted tunnels
Possibility to bridge LANs over 802.11b 'ad-hoc' wireless networks
The EoIP protocol encapsulates Ethernet frames in GRE (IP protocol number 47) packets (just like PPTP) and sends
them to the remote side of the EoIP tunnel.
Properties
Property
Description
keep-alive timer, sets time interval (seconds) in what keep-alive messages should be received. If 3 messages are
missed, interface running flag is removed. For this to work, keepalive has to be set to same value on both ends
of the tunnel, since one end is expecting messages from the other one and is sending keepalive messages in that
direction.
Layer2 Maximum transmission unit. Not configurable for EoIP. Read more>>
local-address (IP; Default: Source address of the tunnel packets, local on the router.
)
mac-address (MAC; Default: Media Access Control number of an interface. The address numeration authority allows to use MAC addresses
)
in the range from 00:00:5E:80:00:00 - 00:00:5E:FF:FF:FF freely
mtu (integer; Default: 1500)
Interface name
remote-address (IP;
Default: )
Unique tunnel identifier, which must match other side of the tunnel
Manual:Interface/EoIP
146
Notes
tunnel-id is method of identifying tunnel. It must be unique for each EoIP tunnel.
mtu should be set to 1500 to eliminate packet refragmentation inside the tunnel (that allows transparent bridging of
Ethernet-like networks, so that it would be possible to transport full-sized Ethernet frame over the tunnel).
When bridging EoIP tunnels, it is highly recommended to set unique MAC addresses for each tunnel for the bridge
algorithms to work correctly. For EoIP interfaces you can use MAC addresses that are in the range from
00:00:5E:80:00:00 - 00:00:5E:FF:FF:FF , which IANA has reserved for such cases. Alternatively, you can set the
second bit of the first byte to mark the address as locally administered address, assigned by network administrator,
and use any MAC address, you just need to ensure they are unique between the hosts connected to one bridge.
Note: EoIP tunnel adds at least 42 byte overhead (8byte GRE + 14 byte Ethernet + 20 byte IP)
Setup examples
Let us assume we want to bridge two networks: 'Office LAN' and 'Remote LAN'. By using EoIP
setup can be made so that Office and Remote LANs are in the same Layer2 broadcast domain.
Consider following setup:
As you know wireless station cannot be bridged, to overcome this limitation (not involving WDS) we will create
EoIP tunnel over the wireless link and bridge it with interfaces connected to local networks.
We will not cower wireless configuration in this example, lets assume that wireless link is already established
At first we create EoIP tunnel on our gateway ...
[admin@Our_GW] interface eoip> add name="eoip-remote" tunnel-id=0 \
\... remote-address=10.0.0.2
[admin@Our_GW] interface eoip> enable eoip-remote
[admin@Our_GW] interface eoip> print
Flags: X - disabled, R - running
0
name=eoip-remote mtu=1500 arp=enabled remote-address=10.0.0.2 tunnel-id=0
[admin@Our_GW] interface eoip>
... and on Remote router
Manual:Interface/EoIP
[admin@Remote] interface eoip> add name="eoip" tunnel-id=0 \
\... remote-address=10.0.0.1
[admin@Remote] interface eoip> enable eoip-main
[admin@Remote] interface eoip> print
Flags: X - disabled, R - running
0
name=eoip mtu=1500 arp=enabled remote-address=10.0.0.1 tunnel-id=0
[admin@Remote] interface eoip>
Next step is to bridge local interfaces with EoIP tunnel On Our GW ...
[admin@Our_GW] interface bridge> add
[admin@Our_GW] interface bridge> print
Flags: X - disabled, R - running
0 R name="bridge1" mtu=1500 arp=enabled mac-address=00:00:00:00:00:00
protocol-mode=none priority=0x8000 auto-mac=yes
admin-mac=00:00:00:00:00:00 max-message-age=20s forward-delay=15s
transmit-hold-count=6 ageing-time=5m
[admin@Our_GW] interface bridge> port add bridge=bridge1 interface=eoip-remote
[admin@Our_GW] interface bridge> port add bridge=bridge1 interface=office-eth
[admin@Our_GW] interface bridge> port print
Flags: X - disabled, I - inactive, D - dynamic
#
INTERFACE
BRIDGE PRIORITY PATH-COST
0
eoip-remote
bridge1 128
10
1
office-eth
bridge1 128
10
[admin@Our_GW] interface bridge>
... and Remote router:
[admin@Remote] interface bridge> add
[admin@Remote] interface bridge> print
Flags: X - disabled, R - running
0 R name="bridge1" mtu=1500 arp=enabled mac-address=00:00:00:00:00:00
protocol-mode=none priority=0x8000 auto-mac=yes
admin-mac=00:00:00:00:00:00 max-message-age=20s forward-delay=15s
transmit-hold-count=6 ageing-time=5m
[admin@Remote] interface bridge> port add bridge=bridge1 interface=ether
[admin@Remote] interface bridge> port add bridge=bridge1 interface=eoip-main
[admin@Remote] interface bridge> port print
Flags: X - disabled, I - inactive, D - dynamic
#
INTERFACE
BRIDGE PRIORITY PATH-COST
0
ether
bridge1 128
10
1
eoip-main
bridge1 128
10
[admin@Remote] interface bridge>
Now both sites are in the same Layer2 broadcast domain. You can set up IP addresses from the same network on
both sites.
[ Top | Back to Content ]
147
Manual:Interface/Gre
148
Manual:Interface/Gre
Applies to RouterOS: v5+
Summary
Sub-menu: /interface gre
Standards: GRE RFC 1701
GRE (generic routing encapsulation) is a tunneling protocol that was originally developed by Cisco. It can
encapsulate wide variety of protocols creating virtual point-to-point link.
GRE the same as IPIP and EoIP were originally developed as stateless tunnels. Meaning that if remote end of the
tunnels goes down all traffic that was routed over the tunnels gets blackholed. To solve this problem RouterOS have
added keepalive feature for GRE tunnels.
GRE tunnel adds 24 byte overhead (4-byte gre header + 20-byte IP header).
Note: Gre tunnel can forward only IP and IPv6 packets (ethernet type 800 and 86dd)
Properties
Property
Description
Ip addres that will be used as local tunnel end. If set to 0.0.0.0 then ip address of outgoing
interface will be taken.
Manual:Interface/Gre
149
Setup examples
The goal of example is to get Layer 3 connectivity between two remote sites over the internet.
We two sites Site1 with local network range 10.1.101.0/24 and Site2 with local network range 10.1.202.0/24.
First step is to create GRE tunnels. Router on site 1:
/interface gre add name=myGre remote-address=192.168.90.1 local-address=192.168.80.1
Router on site 2:
/interface gre add name=myGre remote-address=192.168.80.1 local-address=192.168.90.1
Now we just need to set up tunnel addresses and proper routing. Router on site 1:
/ip address
add address=172.16.1.1/30 interface=myGre
/ip route
add dst-address=10.1.202.0/24 gateway=172.16.1.2
Router on site 2:
/ip address
add address=172.16.1.2/30 interface=myGre
/ip route
add dst-address=10.1.101.0/24 gateway=172.16.1.1
Manual:Interface/Gre
150
Manual:Interface/IPIP
Applies to RouterOS: 2.9, v3, v4+
Summary
Sub-menu: /interface ipip
Standards: IPIP RFC 2003
The IPIP tunneling implementation on the MikroTik RouterOS is RFC 2003 compliant. IPIP tunnel is a simple
protocol that encapsulates IP packets in IP to make a tunnel between two routers. The IPIP tunnel interface appears
as an interface under the interface list. Many routers, including Cisco and Linux based, support this protocol. This
protocol makes multiple network schemes possible.
IP tunneling protocol adds the following possibilities to a network setups:
to tunnel Intranets over the Internet
to use it instead of source routing
Properties
Property
Description
Interface name
Note: There is no authentication or 'state' for this interface. The bandwidth usage of the interface may be
monitored with the monitor feature from the interface menu.
IPv6
Sub-menu: /interface ipipv6
IP/IPv6 over IPv6 tunnel functionality is added in v5RC6 and is configurable from another menu: /interface
ipipv6 IPv6 version uses the same properties as IPv4 version.
Manual:Interface/IPIP
151
Setup examples
Suppose we want to add an IPIP tunnel between routers R1 and R2:
At first, we need to configure IPIP interfaces and then add IP addresses to them.
The configuration for router R1 is as follows:
[admin@MikroTik] interface ipip> add
local-address: 10.0.0.1
remote-address: 22.63.11.6
[admin@MikroTik] interface ipip> print
Flags: X - disabled, R - running
#
NAME
MTU
LOCAL-ADDRESS
REMOTE-ADDRESS
0 X
ipip1
1480
10.0.0.1
22.63.11.6
NAME
MTU
LOCAL-ADDRESS
REMOTE-ADDRESS
0 X
ipip1
1480
22.63.11.6
10.0.0.1
Manual:Interface/IPIP
152
Manual:Interface/PPP
Applies to RouterOS: v5, v6+
Summary
Standards: RFC 1661
Package: ppp
PPP Client
Sub-menu: /interface ppp-client
Properties
Property
add-default-route (yes | no; Default: no)
Description
Whether to add default route to forward all traffic over the tunnel.
allow (pap | chap | mschap1 | mschap2; Default: Allowed protocols to use for authentication
pap,chap,mschap1,mschap2)
apn (string; Default: )
comment (string; Default: )
Which of the port channels used for data transfer. Read more >>
AT dial command to use. The default one sets tone dialing mode.
Which of the port channels used for info. Read more >>
Maximum Receive Unit. Max packet size that PPP interface will be able to receive without
packet fragmentation.
Maximum Transmission Unit. Max packet size that PPP interface will be able to send without
packet fragmentation.
Maximum packet size that can be received on the link. If a packet is bigger than tunnel MTU,
it will be split into multiple packets, allowing full size IP or Ethernet packets to be sent over
the tunnel. Read more >>
Enable/disable null-modem mode (when enabled, no modem initialization strings are sent)
Manual:Interface/PPP
153
Serial or USB Port name where modem is connected. Read more >>
Manual:Interface/PPPoE
Applies to RouterOS: v3, v4
Summary
The PPPoE (Point to Point Protocol over Ethernet) protocol provides extensive user management, network
management and accounting benefits to ISPs and network administrators. Currently PPPoE is used mainly by ISPs to
control client connections for xDSL and cable modems as well as plain Ethernet networks. PPPoE is an extension of
the standard Point to Point Protocol (PPP). The difference between them is expressed in transport method: PPPoE
employs Ethernet instead of serial modem connection.
Generally speaking, PPPoE is used to hand out IP addresses to clients based on the username (and workstation, if
desired) authentication as opposed to workstation only authentication, when static IP addresses or DHCP are used. It
is adviced not to use static IP addresses or DHCP on the same interfaces as PPPoE for obvious security reasons.
The PPPoE client and server work over any Ethernet level interface on the router - wireless 802.11 (Aironet, Cisco,
WaveLan, Prism, Atheros), 10/100/1000 Mbit/s Ethernet, RadioLan and EoIP (Ethernet over IP tunnel).
Feature list
Note that when RADIUS server is authenticating a user with CHAP, MS-CHAPv1 or MS-CHAPv2, the RADIUS
protocol does not use shared secret, it is used only in authentication reply. So if you have a wrong shared secret,
RADIUS server will accept the request. You can use /radius monitor command to see bad-replies parameter. This
value should increase whenever a client tries to connect.
Supported connections:
MikroTik RouterOS PPPoE client to any PPPoE server (access concentrator)
Manual:Interface/PPPoE
MikroTik RouterOS server (access concentrator) to multiple PPPoE clients (clients are avaliable for almost all
operating systems and most routers)
Specifications
Packages required: ppp
License required: Level1 (limited to 1 interface) , Level3 (limited to 200 interfaces) , Level4 (limited to 200
interfaces) , Level5 (limited to 500 interfaces) , Level6 (unlimited)
Submenu level: /interface pppoe-server, /interface pppoe-client
Standards and Technologies: PPPoE (RFC 2516)
Hardware usage: PPPoE server may require additional RAM (uses approx. 9KiB (plus extra 10KiB for packet
queue, if data rate limitation is used) for each connection) and CPU power. Maximum of 65535 connections is
supported.
/ip pool
add name="pppoe-pool" ranges=10.1.1.62-10.1.1.72
/ppp profile
add name="pppoe-profile" local-address=10.1.1.1 remote-address=pppoe-pool
/ppp secret
add name=user password=passwd service=pppoe profile=pppoe-profile
/interface pppoe-server server
add service-name=internet interface=wlan1 default-profile=pppoe-profile
154
Manual:Interface/PPPoE
PPPoE Operation
Stages
PPPoE has two stages:
Discovery stage - a client discovers all available access concentrators and selects one of them to establish PPPoE
session.This stage has four steps: initialization, offer, request and session confirmation . PPPoE Discovery uses
special Ethernet frames with their own Ethernet frame type 0x8863.
To initiate discovery, PPPoE client sends PADI frame to the broadcast Ethernet address (FF:FF:FF:FF:FF:FF) and
may specify particular service name.
When server receives PADI frame, it responds with PADO frame to Client's unicast Ethernet address. There can be
more than one server in broadcast range of the client. In such case client collects PADO frames and picks one (in
most cases it picks the server which responded first) to start session.
Client sends PADR frame to unicast Ethernet address of the server it chose. If server agrees to set up a session with
this particular client, it allocates resources to set up PPP session and assigns Session ID number. This number is sent
back to client in PADS frame. When client receives PADS frame, it knows servers mac address and Session ID, it
allocates resources and session can begin.
Session - When discovery stage is completed, both peers know PPPoE Session ID and other peer's Etehrnet
(MAC) address which together defines PPPoE session. PPP frames are encapsulated in PPPoE session frames,
which have Ethernet frame type 0x8864.
When server sends confirmation and client receives it, PPP Session stage is started that consists of following
steps:
LCP negotiation
Authentication
IPCP negotiation - client is assigned with an IP address.
PPPoE server sends Echo-Request packets to the client to determine the state of the session, otherwise server will not
be able to determine that session is terminated in cases when client terminates session without sending
155
Manual:Interface/PPPoE
156
Terminate-Request packet.
More detailed description of PPPoE protocol can be found in RFC 2516
Description
PADI
PADO
PADR
PADS
PADT
MTU
Typically largest Ethernet frame that can be transmitted without fragmentation is 1500 bytes. PPPoE adds another 6
bytes of overhead and PPP field adds two more bytes, leaving 1492 bytes for IP datagram. Therefore max PPPoE
MRU and MTU values must not be larger than 1492.
TCP stacks try to avoid fragmentation, os they use an MSS (Maximum Segment Size). By default MSS is chosen as
MTU of the outgoing interface minus the usual size of the TCP and IP headers (40 bytes), which results in 1460
bytes for an Eternet interface. Unfortunately there may be intermediate links with lower MTU which will cause
fragmentation. In such case TCP stack performs path MTU discovery. Routers which cannot forward the datagram
without fragmentation are supposed to drop packet and send ICMP-Fragmentation-Required to originating host.
When host receives such ICMP, it tries lower MTU. This should work in ideal world, however in real world many
routers do not generate fragmentation-required datagrams, also many firewalls drop all ICMP datagrams.
Workaround for this problem is to adjust MSS if it is too big. By default RouterOS adds mangle rules to intercept
TCP SYN packets and silently adjust any advertised MSS option so they will be appropriate for the PPPoE link.
Additional information on maximum supported MTUs for routerboards are listed here.
Manual:Interface/PPPoE
157
PPPoE Client
Sub-menu: /interface pppoe-client
Properties
Property
Description
Access Concentrator name, this may ne left blank and the client will connect to any access
concentrator on the broadcast domain
maximum packet size that can be received on the link. If a packet is bigger than tunnel MTU, it
will be split into multiple packets, allowing full size IP or Ethernet packets to be sent over the
tunnel. Read more >>
specifies the service name set on the access concentrator, can be left blank to connect to any
PPPoE server
Status
Command /interface pppoe-client monitor will display current PPPoE status.
Available read only properties:
Property
Description
ac-mac (MAC address) MAC address of the access concentrator (AC) the client is connected to
ac-name (string)
encoding (string)
encryption and encoding (if asymmetric, separated with '/') being used in this connection
mru (integer)
mtu (integer)
uptime (time)
dialing,
verifying password...,
connected,
disconnected.
Manual:Interface/PPPoE
158
Scanner
Starting from v3.21 RouterOS has new tool - PPPoE Scanner. It allows you to scan all active PPPoE servers in
broadcast domain. Command to run scanner is as follows/interface pppoe-client scan
<interface>
Available read only properties:
Property
service (string)
Description
Service name configured on server
Notes
Note for Windows. Some connection instructions may use the form where the "phone number", such as
"MikroTik_AC\mt1", is specified to indicate that "MikroTik_AC" is the access concentrator name and "mt1" is the
service name.
Specifying MRRU means enabling MP (Multilink PPP) over single link. This protocol is used to split big packets
into smaller ones. Under Windows it can be enabled in Networking tag, Settings button, "Negotiate multi-link for
single link connections". Their MRRU is hardcoded to 1614. This setting is usefull to overcome PathMTU discovery
failures. The MP should be enabled on both peers.
Example
To add and enable PPPoE client on the ether1 interface connecting to the AC that provides testSN service using user
name user with the password passwd:
[admin@RemoteOffice] interface pppoe-client> add interface=ether1 service-name=testSN user=user
password=passwd disabled=no
[admin@RemoteOffice] interface pppoe-client> print
Flags: X - disabled, R - running
0
Manual:Interface/PPPoE
159
Additional Resources
PPPoE Clients:
RASPPPoE [1]for Windows 95, 98, 98SE, ME, NT4, 2000, XP, .NET
Properties
Property
Description
Defines the time period (in seconds) after which the router is starting to send keepalive
packets every second. If no traffic and no keepalive responses came for that period of time
(i.e. 2 * keepalive-timeout), not responding client is proclaimed disconnected.
Maximum Receive Unit. The optimal value is the MTU of the interface the tunnel is working
over decreased by 20 (so, for 1500-byte Ethernet link, set the MTU to 1480 to avoid
fragmentation of packets)
Maximum Transmission Unit. The optimal value is the MTU of the interface the tunnel is
working over decreased by 20 (so, for 1500-byte Ethernet link, set the MTU to 1480 to avoid
fragmentation of packets)
Maximum packet size that can be received on the link. If a packet is bigger than tunnel MTU,
it will be split into multiple packets, allowing full size IP or Ethernet packets to be sent over
the tunnel. Read more >>
Allow only one session per host (determined by MAC address). If a host will try to establish a
new session, the old one will be closed
The PPPoE service name. Server will accept clients which sends PADI message with
service-names that matches this setting or if service-name field in PADI message is not set.
Manual:Interface/PPPoE
Notes
The default keepalive-timeout value of 10 is OK in most cases. If you set it to 0, the router will not disconnect clients
until they explicitly log out or the router is restarted. To resolve this problem, the one-session-per-host property can
be used.
Security issue: do not assign an IP address to the interface you will be receiving the PPPoE requests on.
Specifying MRRU means enabling MP (Multilink PPP) over single link. This protocol is used to split big packets
into smaller ones. Under Windows it can be enabled in Networking tag, Settings button, "Negotiate multi-link for
single link connections". Their MRRU is hardcoded to 1614. This setting is usefull to overcome PathMTU discovery
failures. The MP should be enabled on both peers.
Example
To add PPPoE server on ether1 interface providing ex service and allowing only one connection per host:
[admin@MikroTik] interface pppoe-server server> add interface=ether1 service-name=ex
one-session-per-host=yes
[admin@MikroTik] interface pppoe-server server> print
Flags: X - disabled
0 X service-name="ex" interface=ether1 mtu=1480 mru=1480 mrru=disabled
authentication=mschap2,mschap,chap,pap keepalive-timeout=10
one-session-per-host=yes max-sessions=0 default-profile=default
[admin@MikroTik] interface pppoe-server server>
PPPoE Server
Sub-menu: /interface pppoe-server
There are two types of interface (tunnel) items in PPTP server configuration - static users and dynamic connections.
An interface is created for each tunnel established to the given server. Static interfaces are added administratively if
there is a need to reference the particular interface name (in firewall rules or elsewhere) created for the particular
user. Dynamic interfaces are added to this list automatically whenever a user is connected and its username does not
match any existing static entry (or in case the entry is active already, as there can not be two separate tunnel
interfaces referenced by the same name). Dynamic interfaces appear when a user connects and disappear once the
user disconnects, so it is impossible to reference the tunnel created for that use in router configuration (for example,
in firewall), so if you need a persistent rules for that user, create a static entry for him/her. Otherwise it is safe to use
dynamic configuration. Note that in both cases PPP users must be configured properly - static entries do not replace
PPP configuration.
Property Description
encoding (read-only: text) - encryption and encoding (if asymmetric, separated with '/') being used in this
connection
mru (read-only: integer) - client's MRU
mtu (read-only: integer) - client's MTU
name (name) - interface name
remote-address (read-only: MAC address) - MAC address of the connected client
service (name) - name of the service the user is connected to
uptime (read-only: time) - shows how long the client is connected
user (name) - the name of the connected user (must be present in the user darabase anyway)
160
Manual:Interface/PPPoE
Example
To view the currently connected users:
[admin@MikroTik] interface pppoe-server> print
Flags: X - disabled, D - dynamic, R - running
#
NAME
USER
SERVICE
REMOTE... ENCODING UPTIME
0 DR <pppoe-ex> user
ex
00:0C:... MPPE12... 40m45s
[admin@MikroTik] interface pppoe-server>
To disconnect the user ex:
[admin@MikroTik] interface pppoe-server> remove [find user=ex]
[admin@MikroTik] interface pppoe-server> print
[admin@MikroTik] interface pppoe-server>
Application Examples
PPPoE in a multipoint wireless 802.11g network
In a wireless network, the PPPoE server may be attached to an Access Point (as well as to a regular station of
wireless infrastructure). Either our RouterOS client or Windows PPPoE clients may connect to the Access Point for
PPPoE authentication. Further, for RouterOS clients, the radio interface may be set to MTU 1600 so that the PPPoE
interface may be set to MTU 1500. This optimizes the transmission of 1500 byte packets and avoids any problems
associated with MTUs lower than 1500. It has not been determined how to change the MTU of the Windows
wireless interface at this moment.
Let us consider the following setup where the MikroTik Wireless AP offers wireless clients transparent access to the
local network with authentication:
161
Manual:Interface/PPPoE
[admin@PPPoE-Server] interface wireless> set 0 mode=ap-bridge \
frequency=2442 band=2.4ghz-b/g ssid=mt disabled=no
[admin@PPPoE-Server] interface wireless> print
Flags: X - disabled, R - running
0 X name="wlan1" mtu=1500 mac-address=00:0C:42:18:5C:3D arp=enabled
interface-type=Atheros AR5413 mode=ap-bridge ssid="mt" frequency=2442
band=2.4ghz-b/g scan-list=default antenna-mode=ant-a wds-mode=disabled
wds-default-bridge=none wds-ignore-ssid=no default-authentication=yes
default-forwarding=yes default-ap-tx-limit=0 default-client-tx-limit=0
hide-ssid=no security-profile=default compression=no
[admin@PPPoE-Server] interface wireless>
Now, configure the Ethernet interface, add the IP address and set the default route:
[admin@PPPoE-Server] ip address> add address=10.1.0.3/24 interface=Local
[admin@PPPoE-Server] ip address> print
Flags: X - disabled, I - invalid, D - dynamic
#
ADDRESS
NETWORK
BROADCAST
INTERFACE
0
10.1.0.3/24
10.1.0.0
10.1.0.255
Local
[admin@PPPoE-Server] ip address> /ip route
[admin@PPPoE-Server] ip route> add gateway=10.1.0.1
[admin@PPPoE-Server] 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
G GATEWAY
DISTANCE INTER...
0 ADC 10.1.0.0/24
10.1.0.3
0
Local
1 A S 0.0.0.0/0
r 10.1.0.1
1
Local
[admin@PPPoE-Server] ip route> /interface ethernet
[admin@PPPoE-Server] interface ethernet> set Local arp=proxy-arp
[admin@PPPoE-Server] interface ethernet> print
Flags: X - disabled, R - running
#
NAME
MTU
MAC-ADDRESS
ARP
0 R Local
1500 00:0C:42:03:25:53 proxy-arp
[admin@PPPoE-Server] interface ethernet>
We should add PPPoE server to the wireless interface:
[admin@PPPoE-Server] interface pppoe-server server> add interface=wlan1 \
service-name=mt one-session-per-host=yes disabled=no
[admin@PPPoE-Server] interface pppoe-server server> print
Flags: X - disabled
0
service-name="mt" interface=wlan1 max-mtu=1480 max-mru=1480 mrru=disabled
authentication=pap,chap,mschap1,mschap2 keepalive-timeout=10
one-session-per-host=yes max-sessions=0 default-profile=default
[admin@PPPoE-Server] interface pppoe-server server>
Finally, we can set up PPPoE clients:
162
Manual:Interface/PPPoE
[admin@PPPoE-Server] ip pool> add name=pppoe ranges=10.1.0.100-10.1.0.200
[admin@PPPoE-Server] ip pool> print
# NAME
RANGES
0 pppoe
10.1.0.100-10.1.0.200
[admin@PPPoE-Server] ip pool> /ppp profile
[admin@PPPoE-Server] ppp profile> set default use-encryption=yes \
local-address=10.1.0.3 remote-address=pppoe
[admin@PPPoE-Server] ppp profile> print
Flags: * - default
0 * name="default" local-address=10.1.0.3 remote-address=pppoe
use-compression=no use-vj-compression=no use-encryption=yes only-one=no
change-tcp-mss=yes
1 * name="default-encryption" use-compression=default
use-vj-compression=default use-encryption=yes only-one=default
change-tcp-mss=default
[admin@PPPoE-Server] ppp profile> .. secret
[admin@PPPoE-Server] ppp secret> add name=w password=wkst service=pppoe
[admin@PPPoE-Server] ppp secret> add name=l password=ltp service=pppoe
[admin@PPPoE-Server] ppp secret> print
Flags: X - disabled
#
NAME
SERVICE CALLER-ID PASSWORD PROFILE
REMOTE-ADDRESS
0
w
pppoe
wkst
default
0.0.0.0
1
l
pppoe
ltp
default
0.0.0.0
[admin@PPPoE-Server] ppp secret>
Thus we have completed the configuration and added two users: w and l who are able to connect to Internet, using
PPPoE client software.
Note that Windows XP built-in client supports encryption, but RASPPPOE does not. So, if it is planned not to
support Windows clients older than Windows XP, it is recommended not to require encryption. In other case, the
server will accept clients that do not encrypt data.
Troubleshooting
I can connect to my PPPoE server. The ping goes even through it, but I still cannot open web pages
Make sure that you have specified a valid DNS server in the router (in /ip dns or in /ppp profile the dns-server
parameter).
The PPPoE server shows more than one active user entry for one client, when the clients disconnect, they
are still shown and active
Set the keepalive-timeout parameter (in the PPPoE server configuration) to 10 if You want clients to be
considered logged off if they do not respond for 10 seconds.
Note that if the keepalive-timeout parameter is set to 0 and the only-one parameter (in PPP profile
settings) is set to yes then the clients might be able to connect only once. To resolve this problem
one-session-per-host parameter in PPPoE server configuration should be set to yes
My Windows XP client cannot connect to the PPPoE server
You have to specify the "Service Name" in the properties of the XP PPPoE client. If the service name is not set, or it
does not match the service name of the MikroTik PPPoE server, you get the "line is busy" errors, or the system
163
Manual:Interface/PPPoE
shows "verifying password - unknown error"
I want to have logs for PPPoE connection establishment
Configure the logging feature under the /system logging facility and enable the PPP type logs. Read more >>
[ Top | Back to Content ]
References
[1] http:/ / www. raspppoe. com/
Manual:Interface/PPTP
Applies to RouterOS: v3, v4, v5+
Summary
Standards: RFC 2637
PPTP is a secure tunnel for transporting IP traffic using PPP. PPTP encapsulates PPP in virtual lines that run over IP.
PPTP incorporates PPP and MPPE (Microsoft Point to Point Encryption) to make encrypted links. The purpose of
this protocol is to make well-managed secure connections between routers as well as between routers and PPTP
clients (clients are available for and/or included in almost all OSs including Windows).
Multilink PPP (MP) is supported in order to provide MRRU (the ability to transmit full-sized 1500 and larger
packets) and bridging over PPP links (using Bridge Control Protocol (BCP) that allows to send raw Ethernet frames
over PPP links). This way it is possible to setup bridging without EoIP. The bridge should either have an
administratively set MAC address or an Ethernet-like interface in it, as PPP links do not have MAC addresses.
PPTP includes PPP authentication and accounting for each PPTP connection. Full authentication and accounting of
each connection may be done through a RADIUS client or locally.
MPPE 40bit RC4 and MPPE 128bit RC4 encryption are supported.
PPTP traffic uses TCP port 1723 and IP protocol GRE (Generic Routing Encapsulation, IP protocol ID 47), as
assigned by the Internet Assigned Numbers Authority (IANA). PPTP can be used with most firewalls and routers by
enabling traffic destined for TCP port 1723 and protocol 47 traffic to be routed through the firewall or router.
PPTP connections may be limited or impossible to setup though a masqueraded/NAT IP connection. Please see the
Microsoft and RFC links listed below for more information.
PPTP Client
Sub-menu: /interface pptp-client
Properties
164
Manual:Interface/PPTP
165
Property
Description
add-default-route (yes | no; Default: no) Whether to add PPTP remote address as a default route.
allow (mschap2 | mschap1 | chap | pap;
Default: mschap2, mschap1, chap, pap)
Maximum Receive Unit. Max packet size that PPTP interface will be able to receive without
packet fragmentation.
Maximum Transmission Unit. Max packet size that PPTP interface will be able to send without
packet fragmentation.
Maximum packet size that can be received on the link. If a packet is bigger than tunnel MTU, it
will be split into multiple packets, allowing full size IP or Ethernet packets to be sent over the
tunnel. Read more >>
Quick example
This example demonstrates how to set up PPTP client with username "pptp-hm", password "123" and server
10.1.101.100
[admin@dzeltenais_burkaans] /interface pptp-client>add name=pptp-hm user=pptp-hm password=123 \
\... connect-to=10.1.101.100 disabled=no
[admin@dzeltenais_burkaans] /interface pptp-client> print detail
Flags: X - disabled, R - running
0
PPTP Server
Sub-menu: /interface pptp-server
This sub-menu shows interfaces for each connected PPTP clients.
An interface is created for each tunnel established to the given server. There are two types of interfaces in PPTP
server's configuration
Static interfaces are added administratively if there is a need to reference the particular interface name (in firewall
rules or elsewhere) created for the particular user.
Dynamic interfaces are added to this list automatically whenever a user is connected and its username does not
match any existing static entry (or in case the entry is active already, as there can not be two separate tunnel
interfaces referenced by the same name).
Dynamic interfaces appear when a user connects and disappear once the user disconnects, so it is impossible to
reference the tunnel created for that use in router configuration (for example, in firewall), so if you need a persistent
Manual:Interface/PPTP
166
rules for that user, create a static entry for him/her. Otherwise it is safe to use dynamic configuration.
Note: in both cases PPP users must be configured properly - static entries do not replace PPP configuration.
Server configuration
Sub-menu: /interface pptp-server server
Properties
Property
Description
authentication (pap | chap | mschap1 Authentication methods that server will accept.
| mschap2; Default: mschap1,mschap2)
default-profile (name; Default:
default-encryption)
enabled (yes | no; Default: no)
keepalive-timeout (time; Default: 30) If server during keepalive period does not receive any packet, it will send keepalive packets every
second five times. If the server does not receives response from the client, then disconnect after 5
seconds. Logs will show 5x "LCP missed echo reply" messages and then disconnect.
max-mru (integer; Default: 1460)
Maximum Receive Unit. Max packet size that PPTP interface will be able to receive without packet
fragmentation.
Maximum Transmission Unit. Max packet size that PPTP interface will be able to send without
packet fragmentation.
mrru (disabled | integer; Default: disabled) Maximum packet size that can be received on the link. If a packet is bigger than tunnel MTU, it will
be split into multiple packets, allowing full size IP or Ethernet packets to be sent over the tunnel.
Read more >>
Monitoring
Monitor command can be used to monitor status of the tunnel on both client and server.
[admin@dzeltenais_burkaans] /interface pptp-client> monitor 0
status: "connected"
uptime: 7h24m18s
idle-time: 6h21m4s
encoding: "MPPE128 stateless"
mtu: 1460
mru: 1460
Manual:Interface/PPTP
167
Read-only properties
Property
Description
status ()
Current PPTP status. Value other than "connected" indicates that there are some problems estabising tunnel.
uptime (time)
mtu (integer)
mru (integer)
Application Examples
Connecting Remote Client
The following example shows how to connect a computer to a remote office network over PPTP encrypted tunnel
giving that computer an IP address from the same network as the remote office has (without need of bridging over
EoIP tunnels)
Consider following setup
Office router is connected to internet through ether1. Workstations are connected to ether2. Laptop is connected to
the internet and can reach Office router's public IP (in our example it is 192.168.80.1).
First step is to create a user
[admin@RemoteOffice] /ppp secret> add name=Laptop service=pptp password=123
local-address=10.1.101.1 remote-address=10.1.101.100
[admin@RemoteOffice] /ppp secret> print detail
Flags: X - disabled
0
name="Laptop" service=pptp caller-id="" password="123" profile=default
local-address=10.1.101.1 remote-address=10.1.101.100 routes==""
[admin@RemoteOffice] /ppp secret>
Manual:Interface/PPTP
168
Notice that pptp local address is the same as routers address on local interface and remote address is form the same
range as local network (10.1.101.0/24).
Next step is to enable pptp server and pptp client on the laptop.
[admin@RemoteOffice]
[admin@RemoteOffice]
enabled:
max-mtu:
max-mru:
mrru:
authentication:
keepalive-timeout:
default-profile:
[admin@RemoteOffice]
PPTP client from the laptop should connect to routers public IP which in our example is 192.168.80.1.
Please, consult the respective manual on how to set up a PPTP client with the software You are using.
At this point (when pptp client is successfully connected) if you will try to ping any workstation form the laptop,
ping will time out, because Laptop is unable to get ARPs from workstations. Solution is to set up proxy-arp on
local interface
[admin@RemoteOffice]
[admin@RemoteOffice]
Flags: X - disabled,
#
NAME
0 R ether1
1 R ether2
[admin@RemoteOffice]
After proxy-arp is enabled client can successfully reach all workstations in local network behind the router.
Manual:Interface/PPTP
169
Site-to-Site PPTP
The following is an example of connecting two Intranets using PPTP tunnel over the Internet.
Consider following setup
Office and Home routers are connected to internet through ether1, workstations and laptops are connected to ether2.
Both local networks are routed through pptp client, thus they are not in the same broadcast domain. If both networks
should be in the same broadcast domain then you need to use BCP and bridge pptp tunnel with local interface.
First step is to create a user
[admin@RemoteOffice] /ppp secret> add name=Home service=pptp password=123
local-address=172.16.1.1 remote-address=172.16.1.2 routes="10.1.202.0/24 172.16.1.2 1"
[admin@RemoteOffice] /ppp secret> print detail
Flags: X - disabled
0
Notice that we set up pptp to add route whenever client connects. If this option is not set, then you will need static
routing configuration on the server to route traffic between sites through pptp tunnel.
Next step is to enable pptp server on the office router and configure pptp client on the Home router.
[admin@RemoteOffice]
[admin@RemoteOffice]
enabled:
max-mtu:
max-mru:
mrru:
authentication:
keepalive-timeout:
default-profile:
[admin@RemoteOffice]
Manual:Interface/PPTP
170
Now we need to add route to reach local network behind Home router
[admin@RemoteOffice] /ip route> add dst-address=10.1.101.0/24 gateway=pptp-out1
Now after tunnel is established and routes are set, you should be able to ping remote network.
Read More
BCP (Bridge Control Protocol)
http://msdn.microsoft.com/library/backgrnd/html/understanding_pptp.htm
http://support.microsoft.com/support/kb/articles/q162/8/47.asp
http://www.ietf.org/rfc/rfc2637.txt?number=2637
http://www.ietf.org/rfc/rfc3078.txt?number=3078
http://www.ietf.org/rfc/rfc3079.txt?number=3079
[ Top | Back to Content ]
Manual:Interface/L2TP
Applies to RouterOS: v3, v4, v5+
Summary
Standards: RFC 2661
L2TP is a secure tunnel protocol for transporting IP traffic using PPP. L2TP encapsulates PPP in virtual lines that
run over IP, Frame Relay and other protocols (that are not currently supported by MikroTik RouterOS). L2TP
incorporates PPP and MPPE (Microsoft Point to Point Encryption) to make encrypted links. The purpose of this
protocol is to allow the Layer 2 and PPP endpoints to reside on different devices interconnected by a
packet-switched network. With L2TP, a user has a Layer 2 connection to an access concentrator - LAC (e.g., modem
bank, ADSL DSLAM, etc.), and the concentrator then tunnels individual PPP frames to the Network Access Server NAS. This allows the actual processing of PPP packets to be separated from the termination of the Layer 2 circuit.
From the user's perspective, there is no functional difference between having the L2 circuit terminate in a NAS
directly or using L2TP.
It may also be useful to use L2TP just as any other tunneling protocol with or without encryption. The L2TP
standard says that the most secure way to encrypt data is using L2TP over IPsec (Note that it is default mode for
Microsoft L2TP client) as all L2TP control and data packets for a particular tunnel appear as homogeneous UDP/IP
data packets to the IPsec system.
Manual:Interface/L2TP
171
Multilink PPP (MP) is supported in order to provide MRRU (the ability to transmit full-sized 1500 and larger
packets) and bridging over PPP links (using Bridge Control Protocol (BCP) that allows to send raw Ethernet frames
over PPP links). This way it is possible to setup bridging without EoIP. The bridge should either have an
administratively set MAC address or an Ethernet-like interface in it, as PPP links do not have MAC addresses.
L2TP includes PPP authentication and accounting for each L2TP connection. Full authentication and accounting of
each connection may be done through a RADIUS client or locally.
MPPE 40bit RC4 and MPPE 128bit RC4 encryption are supported.
L2TP traffic uses UDP protocol for both control and data packets. UDP port 1701 is used only for link
establishment, further traffic is using any available UDP port (which may or may not be 1701). This means that
L2TP can be used with most firewalls and routers (even with NAT) by enabling UDP traffic to be routed through the
firewall or router.
L2TP Client
Sub-menu: /interface l2tp-client
Property
Description
add-default-route (yes | no; Default: no) Whether to add L2TP remote address as a default route.
allow (mschap2 | mschap1 | chap | pap;
Default: mschap2, mschap1, chap, pap)
Maximum Receive Unit. Max packet size that L2TP interface will be able to receive without
packet fragmentation.
Maximum Transmission Unit. Max packet size that L2TP interface will be able to send without
packet fragmentation.
Maximum packet size that can be received on the link. If a packet is bigger than tunnel MTU, it
will be split into multiple packets, allowing full size IP or Ethernet packets to be sent over the
tunnel. Read more >>
This example demonstrates how to set up L2TP client with username "l2tp-hm", password "123" and server
10.1.101.100
[admin@dzeltenais_burkaans] /interface l2tp-client>add name=l2tp-hm user=l2tp-hm password=123 \
\... connect-to=10.1.101.100 disabled=no
[admin@dzeltenais_burkaans] /interface l2tp-client> print detail
Flags: X - disabled, R - running
0
Manual:Interface/L2TP
172
L2TP Server
Sub-menu: /interface l2tp-server
This sub-menu shows interfaces for each connected L2TP clients.
An interface is created for each tunnel established to the given server. There are two types of interfaces in L2TP
server's configuration
Static interfaces are added administratively if there is a need to reference the particular interface name (in firewall
rules or elsewhere) created for the particular user.
Dynamic interfaces are added to this list automatically whenever a user is connected and its username does not
match any existing static entry (or in case the entry is active already, as there can not be two separate tunnel
interfaces referenced by the same name).
Dynamic interfaces appear when a user connects and disappear once the user disconnects, so it is impossible to
reference the tunnel created for that use in router configuration (for example, in firewall), so if you need a persistent
rules for that user, create a static entry for him/her. Otherwise it is safe to use dynamic configuration.
Note: in both cases PPP users must be configured properly - static entries do not replace PPP configuration.
Server configuration
Sub-menu: /interface l2tp-server server
Properties
Property
authentication (pap | chap |
mschap1 | mschap2; Default:
mschap1,mschap2)
Description
Authentication methods that server will accept.
Maximum Receive Unit. Max packet size that L2TP interface will be able to receive without packet
fragmentation.
keeplaive-timeout (integer;
Default: 30)
If server during keepalive period does not receive any packet, it will send keepalive packets every
second five times. If the server does not receives response from the client, then disconnect after 5
seconds. Logs will show 5x "LCP missed echo reply" messages and then disconnect. Available starting
from v5.22 and v6rc3.
Maximum Transmission Unit. Max packet size that L2TP interface will be able to send without packet
fragmentation.
Maximum packet size that can be received on the link. If a packet is bigger than tunnel MTU, it will be
split into multiple packets, allowing full size IP or Ethernet packets to be sent over the tunnel. Read
more >>
Manual:Interface/L2TP
173
default-profile: default-encryption
[admin@MikroTik] interface l2tp-server server>
Monitoring
Monitor command can be used to monitor status of the tunnel on both client and server.
[admin@dzeltenais_burkaans] /interface l2tp-client> monitor 0
status: "connected"
uptime: 7h24m18s
idle-time: 6h21m4s
encoding: "MPPE128 stateless"
mtu: 1460
mru: 1460
Read-only properties
Property
status ()
Description
Current L2TP status. Value other than "connected" indicates that there are some problems estabising tunnel.
uptime (time)
mtu (integer)
mru (integer)
Manual:Interface/L2TP
174
Application Examples
Connecting Remote Client
The following example shows how to connect a computer to a remote office network over L2TP encrypted tunnel
giving that computer an IP address from the same network as the remote office has (without need of bridging over
EoIP tunnels)
Consider following setup
Office router is connected to internet through ether1. Workstations are connected to ether2. Laptop is connected to
the internet and can reach Office router's public IP (in our example it is 192.168.80.1).
First step is to create a user
[admin@RemoteOffice] /ppp secret> add name=Laptop service=l2tp password=123
local-address=10.1.101.1 remote-address=10.1.101.100
[admin@RemoteOffice] /ppp secret> print detail
Flags: X - disabled
0
name="Laptop" service=l2tp caller-id="" password="123" profile=default
local-address=10.1.101.1 remote-address=10.1.101.100 routes==""
[admin@RemoteOffice] /ppp secret>
Notice that L2TP local address is the same as routers address on local interface and remote address is form the same
range as local network (10.1.101.0/24).
Next step is to enable L2TP server and L2TP client on the laptop.
[admin@RemoteOffice]
[admin@RemoteOffice]
enabled:
max-mtu:
max-mru:
mrru:
authentication:
Manual:Interface/L2TP
175
default-profile: default-encryption
[admin@RemoteOffice] /interface l2tp-server server>
L2TP client from the laptop should connect to routers public IP which in our example is 192.168.80.1.
Please, consult the respective manual on how to set up a L2TP client with the software You are using.
Note: By default Windows sets up L2TP with IPsec. To disable IpSec registry modifications are required.
Read more >>
At this point (when L2TP client is successfully connected) if you will try to ping any workstation
form the laptop, ping will time out, because Laptop is unable to get ARPs from workstations.
Solution is to set up proxy-arp on local interface
[admin@RemoteOffice]
[admin@RemoteOffice]
Flags: X - disabled,
#
NAME
0 R ether1
1 R ether2
[admin@RemoteOffice]
After proxy-arp is enabled client can successfully reach all workstations in local network behind the router.
Site-to-Site L2TP
The following is an example of connecting two Intranets using L2TP tunnel over the Internet.
Consider following setup
Office and Home routers are connected to internet through ether1, workstations and laptops are connected to ether2.
Both local networks are routed through L2TP client, thus they are not in the same broadcast domain. If both
networks should be in the same broadcast domain then you need to use BCP and bridge L2TP tunnel with local
interface.
First step is to create a user
Manual:Interface/L2TP
176
Notice that we set up L2TP to add route whenever client connects. If this option is not set, then you will need static
routing configuration on the server to route traffic between sites through L2TP tunnel.
Next step is to enable L2TP server on the office router and configure L2TP client on the Home router.
[admin@RemoteOffice]
[admin@RemoteOffice]
enabled:
max-mtu:
max-mru:
mrru:
authentication:
default-profile:
[admin@RemoteOffice]
On home router you need to add route manually, or you can also use profile to add it automatically when client
connects. In this case we will use manual route:
[admin@Home] /ip route> add dst-address=10.1.101.0/24 gateway=l2tp-out1
After tunnel is established and routes are set, you should be able to ping remote network.
Read More
BCP (Bridge Control Protocol)
Disable IpSec used with L2TP on Windows [1]
MikroTik RouterOS and Windows XP IPSec/L2TP
[ Top | Back to Content ]
References
[1] http:/ / support. microsoft. com/ default. aspx?scid=kb%3Ben-us%3B258261. php
Manual:Interface/SSTP
Manual:Interface/SSTP
Applies to RouterOS: v5, v6+
Summary
Standards: SSTP specification [1]
Package: ppp
Secure Socket Tunneling Protocol (SSTP) is the way to transport PPP tunnel over SSL 3.0 channel. The use of SSL
over TCP port 443 allows SSTP to pass through virtually all firewalls and proxy servers.
SSTP connection mechanism
TCP connection is established from client to server (by default on port 443);
SSL validates server certificate. If certificate is valid connection is established otherwise connection is torn down.
The client sends SSTP control packets within the HTTPS session which establishes the SSTP state machine on
both sides.
PPP negotiation over SSTP. Client authenticates to the server and binds IP addresses to SSTP interface
SSTP tunnel is now established and packet encapsulation can begin.
If both client and server are Mikrotik routers, then it is possible to establish SSTP tunnel without certificates and
with any available authentication type. Otherwise to establish secure tunnels mschap authentication and client/server
certificates from the same chain should be used. Read more>>
Note: Starting from v5.0beta2 SSTP does not require certificates to operate. This feature will work only
between two MikroTik routers, as it is not according to standards.
Currently, SSTP clients exist only in Windows Vista, Windows 7 and RouterOS.
177
Manual:Interface/SSTP
Note: While connecting to SSTP server, Windows does CRL (certificate revocation list) checking on server
certificate which can introduce significant delay to complete connection or even prevent user from accessing
sstp server at all if Windows is unable to access CRL distribution point! Custom generated CA which does
not include CRLs can be used to minimize connection delays and certificate costs (signed certificates with
known CA usually are not for free), but this custom CA must be imported into each Windows client
individually. It is possible to disable CRL check in Windows registry, but it is supported only by Windows Server 2008 http:/ /
support.microsoft.com/kb/947054
Certificates
Note: Starting from RouterOS v6rc10 SSTP respects CRL
To set up secure SSTP tunnel, certificates are required. On the server authentication is done only
by username and password, but on the client - server is authenticated using server certificate. It is
also used by client to cryptographicly bind SSL and PPP authentication, meaning - the clients
sends a special value over SSTP connection to server, this value is derived from the key data that
is generated during PPP authentication and server certificate, this allows server to check if both channels are secure.
If sstp clients are Windows PCs then only way to set up secure SSTP tunnel when using self-signed certificate is by
importing "server" certificate on SSTP server and on windows PC add CA certificate in trusted root [2].
Note: If your server certificate is issued by CA which is known by Windows, then Windows client will work
witout any additional certificates.
Warning: RSA Key length must be at least 472 bits if certificate is used by SSTP. Shorter keys are
considered as security threats.
Similar configuration on RouterOS client would be, importing CA certificate and enabling
verify-server-certificate option. In this scenario Man-in-the-Middle attacks are not possible.
Between two Mikrotik routers it is also possible to set up insecure tunnel by not using certificates
at all. In this case data going through SSTP tunnel is using anonymous DH and Man-in-the-Middle attacks are easily
accomplished. This scenario is not compatible with Windows clients.
It is also possible to make secure SSTP tunnel by adding additional authorization with client certificate.
Configuration requirements are:
certificates on both server and client
verification options enabled on server and client
This scenario is also not possible with Windows clients, because there is no way to set up client certificate on
Windows.
178
Manual:Interface/SSTP
179
certificate is not yet valid - notBefore date is after the current time.
certificate has expired - notAfter date is before the current time.
invalid certificate purpose - the supplied certificate cannot be used for the specified purpose.
self signed certificate in chain - the certificate chain could be built up using the untrusted certificates but the root
could not be found locally.
unable to get issuer certificate locally - CA certificate is not imported locally.
server's IP address does not match certificate - server address verification is enabled, but address provided in
certificate does not match servers address.
Hostname verification
Starting from v5.6 when server ceritificate verification is enabled on sstp client, additionally IP addresses found in
certificate's subjectAltName and then issuer CN will be compared to the real address. DNS names are ignored. v5.7
adds new parameter verify-server-address-from-certificate to disable/enable hostname
verification.
SSTP Client
Sub-menu: /interface sstp-client
Properties
Property
Description
Maximum Receive Unit. Max packet size that SSTP interface will be able to
receive without packet fragmentation.
Maximum Transmission Unit. Max packet size that SSTP interface will be
able to send without packet fragmentation.
Maximum packet size that can be received on the link. If a packet is bigger
than tunnel MTU, it will be split into multiple packets, allowing full size IP
or Ethernet packets to be sent over the tunnel. Read more >>
Manual:Interface/SSTP
180
If set to yes, then client checks whether certificate belongs to the same
certificate chain as server's certificate. To make it work CA certificate must
be imported.
Quick example
This example demonstrates how to set up SSTP client with username "sstp-test", password "123" and server
10.1.101.1
[admin@MikroTik]
SSTP Server
Sub-menu: /interface sstp-server
This sub-menu shows interfaces for each connected SSTP clients.
An interface is created for each tunnel established to the given server. There are two types of interfaces in SSTP
server's configuration
Static interfaces are added administratively if there is a need to reference the particular interface name (in firewall
rules or elsewhere) created for the particular user.
Dynamic interfaces are added to this list automatically whenever a user is connected and its username does not
match any existing static entry (or in case the entry is active already, as there can not be two separate tunnel
interfaces referenced by the same name).
Dynamic interfaces appear when a user connects and disappear once the user disconnects, so it is impossible to
reference the tunnel created for that use in router configuration (for example, in firewall), so if you need a persistent
rules for that user, create a static entry for him/her. Otherwise it is safe to use dynamic configuration.
Note: in both cases PPP users must be configured properly - static entries do not replace PPP configuration.
Server configuration
Sub-menu: /interface sstp-server server
Properties:
Manual:Interface/SSTP
Property
181
Description
Force AES encryption. If enabled windows clients (supports only RC4) will be unable to
connect.
keepalive-timeout (integer | disabled; Default: If server during keepalive period does not receive any packet, it will send keepalive packets
60)
every second five times. If the server does not receives response from the client, then
disconnect after 5 seconds. Logs will show 5x "LCP missed echo reply" messages and then
disconnect.
max-mru (integer; Default: 1500)
Maximum Receive Unit. Max packet size that SSTP interface will be able to receive
without packet fragmentation.
Maximum Transmission Unit. Max packet size that SSTP interface will be able to send
without packet fragmentation.
Maximum packet size that can be received on the link. If a packet is bigger than tunnel
MTU, it will be split into multiple packets, allowing full size IP or Ethernet packets to be
sent over the tunnel. Read more >>
If set to yes, then server checks whether client's certificate belongs to the same certificate
chain.
Monitoring
Monitor command can be used to monitor status of the tunnel on both client and server.
[admin@dzeltenais_burkaans] /interface sstp-server> monitor 0
status: "connected"
uptime: 17m47s
idle-time: 17m47s
Manual:Interface/SSTP
182
user: "sstp-test"
caller-id: "10.1.101.18:43886"
mtu: 1500
Read-only properties
Property
Description
status ()
Current SSTP status. Value other than "connected" indicates that there are some problems estabising tunnel.
uptime (time)
idle-time (time)
user (string)
mtu (integer)
caller-id (IP:ID)
Application Examples
Connecting Remote Client
The following example shows how to connect a computer to a remote office network over secure SSTP encrypted
tunnel giving that computer an IP address from the same network as the remote office has (without need of bridging
over EoIP tunnels)
Consider following setup:
Office router is connected to internet through ether1. Workstations are connected to ether2. Laptop is connected to
the internet and can reach Office router's public IP (in our example it is 192.168.80.1).
Before you begin to configure SSTP you need to create a server certificate and import it to the router (instructions
here).
Now it is time to create a user
[admin@RemoteOffice] /ppp secret> add name=Laptop service=sstp password=123
local-address=10.1.101.1 remote-address=10.1.101.100
Manual:Interface/SSTP
183
/interface sstp-server
/interface sstp-server
/interface sstp-server
/interface sstp-server
enabled: yes
port: 443
max-mtu: 1500
max-mru: 1500
mrru: disabled
keepalive-timeout: 60
default-profile: default
certificate: server
verify-client-certificate: no
authentication: mschap2
server>
server>
server>
server>
set certificate=server
set enabled=yes
set authentication=mschap2
print
ENCODING
Manual:Interface/SSTP
184
user: "Laptop"
caller-id: "192.168.99.1:43886"
mtu: 1500
At this point (when SSTP client is successfully connected) if you will try to ping any workstation form the laptop,
ping will time out, because Laptop is unable to get ARPs from workstations. Solution is to set up proxy-arp on
local interface
[admin@RemoteOffice]
[admin@RemoteOffice]
Flags: X - disabled,
#
NAME
0 R ether1
1 R ether2
[admin@RemoteOffice]
After proxy-arp is enabled client can successfully reach all workstations in local network behind the router.
Site-to-Site SSTP
The following is an example of connecting two Intranets using SSTP tunnel over the Internet.
Consider following setup
Office and Home routers are connected to internet through ether1, workstations and laptops are connected to ether2.
In this example both local networks are routed through sstp client, thus they are not in the same broadcast domain.
To overcome this problem as any other ppp tunnel SSTP also supports BCP which allows to bridge SSTP tunnel
with local interface.
First step is to create a user
[admin@RemoteOffice] /ppp secret> add name=Home service=sstp password=123
local-address=172.16.1.1 remote-address=172.16.1.2 routes="10.1.202.0/24 172.16.1.2 1"
[admin@RemoteOffice] ppp secret> print detail
Flags: X - disabled
Manual:Interface/SSTP
0
185
Notice that we set up SSTP to add route whenever client connects. If this option is not set, then you will need static
routing configuration on the server to route traffic between sites through SSTP tunnel.
Now we need to upload and import CA and server/client certificates. Assume that files are already uploaded use
following commands:
admin@RemoteOffice] /certificate> import file-name=ca.crt
passphrase:
admin@RemoteOffice] /certificate> import file-name=server.crt
passphrase: ****
admin@RemoteOffice] /certificate> import file-name=server.key
passphrase: ****
Set up proper names:
admin@RemoteOffice] /certificate>set 0 name=CA
admin@RemoteOffice] /certificate>set 1 name=server
admin@RemoteOffice] /certificate> print
Flags: K - decrypted-private-key, Q - private-key, R - rsa, D - dsa
0
1 KR name="server" subject=C=LV,ST=RI,L=Riga,O=MT,CN=server,[email protected]
issuer=C=LV,ST=RI,L=Riga,O=MT,CN=MT CA,[email protected] serial-number="01"
[email protected] invalid-before=jun/25/2008 07:24:33 invalid-after=jun/23/2018 07:24:33
ca=yes
Do the same on client side, but instead of server's certificate import client's certificate.
Next step is to enable SSTP server on the office router and configure SSTP client on the Home router.
[admin@RemoteOffice] /interface sstp-server server> set certificate=server
[admin@RemoteOffice] /interface sstp-server server> set enabled=yes
[admin@RemoteOffice] /interface sstp-server server> set verify-client-certificate=yes
[admin@RemoteOffice] /interface sstp-server server> print
enabled: yes
port: 443
max-mtu: 1500
max-mru: 1500
mrru: disabled
keepalive-timeout: 60
default-profile: default
certificate: server
verify-client-certificate: yes
authentication: pap,chap,mschap1,mschap2
Manual:Interface/SSTP
186
Now we need to add static route on Home router to reach local network behind Office router
[admin@Home] /ip route> add dst-address=10.1.101.0/24 gateway=sstp-out1
After tunnel is established you should be able to ping remote network.
Troubleshooting
After Windows 7 upgrade SSTP is unable to connect (windows error 631) ?
MS Patch KB2585542 changes cypher to RC4 which was not supported on RouterOS. Starting from RouterOS
v5.13 RC4 is the preferred cipher and AES will be used only if peer does not advertise RC4.
I get following error when trying to connect Windows 7 client. Error 0x80070320 The oplock that was associated
with this handle is now associated with a different handle.
Disable verify-client-certificate option on the server.
Read More
Creating Certificates
BCP (Bridge Control Protocol)
http://technet.microsoft.com/en-us/library/cc731352(WS.10).aspx
Free trusted Class1 certificates [3] online
References
[1] http:/ / msdn. microsoft. com/ en-us/ library/ cc247338(PROT. 10). aspx
[2] http:/ / technet. microsoft. com/ en-us/ library/ dd458982. aspx
[3] http:/ / www. startssl. com/
Manual:Interface/OVPN
187
Manual:Interface/OVPN
Applies to RouterOS: v5+
Summary
Standards:
Package: ppp
Note: RouterOS supports only TCP mode. LZO compression is not supported and username/password
authentication is required
OVPN Client
Sub-menu: /interface ovpn-client
Properties
Property
Description
Allowed cipher.
Maximum Transmission Unit. Max packet size that OVPN interface will be able to
send without packet fragmentation.
Manual:Interface/OVPN
188
Quick example
This example demonstrates how to set up OVPN client with username "test", password "123" and server 10.1.101.1
[admin@bumba] /interface ovpn-client> add connect-to=10.1.101.1 user=test password=123 disabled=no
[admin@bumba] /interface ovpn-client> print
Flags: X - disabled, R - running
0
OVPN Server
Sub-menu: /interface ovpn-server
This sub-menu shows interfaces for each connected OVPN clients.
An interface is created for each tunnel established to the given server. There are two types of interfaces in OVPN
server's configuration
Static interfaces are added administratively if there is a need to reference the particular interface name (in firewall
rules or elsewhere) created for the particular user.
Dynamic interfaces are added to this list automatically whenever a user is connected and its username does not
match any existing static entry (or in case the entry is active already, as there can not be two separate tunnel
interfaces referenced by the same name).
Dynamic interfaces appear when a user connects and disappear once the user disconnects, so it is impossible to
reference the tunnel created for that use in router configuration (for example, in firewall), so if you need a persistent
rules for that user, create a static entry for him/her. Otherwise it is safe to use dynamic configuration.
Note: in both cases PPP users must be configured properly - static entries do not replace PPP configuration.
Server configuration
Sub-menu: /interface ovpn-server server
Properties:
Property
auth (; Default: sha1,md5)
Description
Authentication methods that server will accept.
certificate (name | none; Default: none) Name of the certificate that OVPN server will use.
cipher (aes128 | none; Default:
aes128,blowfish128)
default-profile (name; Default:
default)
enabled (yes | no; Default: no)
keepalive-timeout (integer | disabled; Defines the time period (in seconds) after which the router is starting to send keepalive packets
Default: 60)
every second. If no traffic and no keepalive responses has came for that period of time (i.e. 2 *
keepalive-timeout), not responding client is proclaimed disconnected
mac-address (MAC; Default: )
Maximum Transmission Unit. Max packet size that OVPN interface will be able to send without
packet fragmentation.
Manual:Interface/OVPN
189
require-client-certificate (yes |
no; Default: no)
If set to yes, then server checks whether client's certificate belongs to the same certificate chain.
Monitoring
Monitor command can be used to monitor status of the tunnel on both client and server.
[admin@dzeltenais_burkaans] /interface ovpn-server> monitor 0
status: "connected"
uptime: 17m47s
idle-time: 17m47s
user: "test"
caller-id: "10.1.101.18:43886"
mtu: 1500
Read-only properties
Property
Description
status ()
Current status. Value other than "connected" indicates that there are some problems estabising tunnel.
uptime (time)
idle-time (time)
user (string)
mtu (integer)
caller-id (IP:ID)
Manual:Interface/OVPN
Application Examples
Basic OVPN setup
[ Top | Back to Content ]
Summary
RouterOS supports BCP (Bridge Control Protocol) for PPP, PPTP, L2TP and PPPoE interfaces. BCP allows to
bridge Ethernet packets through the PPP link. Established BCP is independent part of the PPP tunnel, it is not related
to any IP address of PPP interface, bridging and routing can happen at the same time independently. BCP can be
used instead of EoIP + used VPN Tunnel or WDS link over the wireless network.
Requirements
BCP (Bridge Control Protocol) should be enabled on both sides (PPP server and PPP client) to make it work.
MikroTik RouterOS can be used with other PPP device, that supports BCP accordingly to the standards, but BCP
enabled is necessary.
Configuration Example
We need to interconnect two remote offices and make them in one Ethernet network. We have requirement to use
encryption to protect data exchange between two offices. Let's see, how it is possible with PPTP tunnel and BCP
protocol usage
190
191
192
MRRU allows to enable multi-link support over single link, it divides the packet to multiple channels therefore
increasing possible MTU and MRU (up to 65535 bytes)
/interface pptp-server server set enabled=yes mrru=1600
Office 2 configuration
First we need to create bridge interface and make sure that bridge will always have MAC address of existing
interface. Reason for that is simple - when BCP is used PPP bridge port do not have any MAC address.
/interface
/interface
/interface
//// where
193
Assign IP addresses,
194
195
Enable PPTP-server,
196
197
Configuration Example
Let's configure pppoe server compatible with Windows clients and MRRU enabled.
198
199
Configuration Example
ISP gives to its client two physical links (DSL lines) 1Mbps each. To get aggregated 2Mbps pipe we have to set up
MLPPP. Consider ISP router is pre-configured to support MLPPP.
Configuration on Mikorotik router (R1) is:
/interface pppoe-client
add service-name=ISP interface=ether1,ether2 user=xxx password=yyy disabled=no \
add-default-route=yes use-peer-dns=yes
[admin@RB800] /interface pppoe-client> print
Flags: X - disabled, R - running
0
Now when pppoe client is connected we can set up rest of configuration, local network address, enable dns requests,
set up masquerade and firewall
/ip address add address=192.168.88.1/24 interface=local
/ip dns set allow-remote-request=yes
/ip firewall nat
add chain=src-nat action=masquerade out-interface=pppoe-out1
See Also
PPPOE
Firewall and NAT
[ Top | Back to Content ]
200
201
202
203