MikroTik RouterOS MTCRE - V7
MikroTik RouterOS MTCRE - V7
Quick Access
Internet is available
SSID: Internet
Password: Internet
http://training.mikrotiksa.com:808/files/
http://10.2.34.175:808/files
Please download a new copy of the manual RouterOS MTCRE
Housekeeping and Schedule
• Course materials
• Routers, cables
• Restrooms and smoking area locations
• 08:00 – 10:00 Morning Session I
• 10:00 – 10:20 Morning Break
• 10:20 – 12:000 Morning Session II
• 12:00 – 12:40 Lunch Break
• 12:40 – 14:00 Afternoon Session I
• 14:00 – 14:20 Afternoon Break
• 14:20 – 16:00 Afternoon Session II / Examination
• Crowthorne Gate Codes
IN 4425# OUT 7878#
About MikroTik SA
• Independent Wireless Specialist company
• Not owned by / affiliated to MikroTik Latvia
• Official training and support partner for MikroTik
• Specialist in all forms of wireless and wired networking
technologies
• Offers high speed PTP links, carrier independent
backbone services, high availability SLA's
• David Savage
• Is a MikroTik Certified Trainer and consultant
• Installs and manages and wireless networks
• Has over 21 years experience in the IT field
• Teaches general networking and MikroTik RouterOS
Introduce Yourself
• Please, introduce yourself to the class
• Your name
• Your Company
• Your previous knowledge about RouterOS
• Your previous knowledge about networking
• What do you expect from this course?
30 31 32 33 34 35
20 21 22 23 24 25
10 11 12 13 14 15
MTCIPv6E
IPv6 Engineer
Deploying IPv6 in the MikroTik
environment MTCSWE
Layer2 Engineer
MikroTik switches and VLANs
Router Setup HAPAC LAN
Ether1 To Training • You will need to work in
Switch / Router
groups of 2 (3 is also
possible)
Ether 2 Ether 3
• Connect your routers
together as shown in the
diagram
Ether 1 Ether 1 • The cables are colour coded
for easy identification
Wlan 1 • Decide on a group name
• Your group number is the
lowest seat number
Laptop 1 Laptop 2
Ether 2 on LAN Ether 2 on LAN • Access the LAN router
Copyright 2016 MikroTikSA (Pty) Ltd 10
Router Setup: HAPAC LAN
To Training Router
• Reset your router from the
Terminal using
/system reset no-defaults=yes
• Click on Files and delete all
backup and other files
• Add an IP address
192.168.x.254/24 to Ether 2
of your LAN router
192.168.x.0/24
laptop
192.168.x.254/24 • Gateway is LAN 192.168.x.254
on ether 2
• DNS 1.1.1.1 / 8.8.8.8
Laptop 1 Laptop 2 • Confirm you can access your
Ether 2 on LAN Ether 2 on LAN LAN router
Copyright 2016 MikroTikSA (Pty) Ltd
by its IP address
11
Router Setup: HAPAC LAN
To Training Router • Change your LAN router
System Identity to
X_name_LAN
– Where X is your seat number
• Enable the RoMON service in
Tool RoMON
192.168.x.0/24
A Active X X Route is available for use in the FIB (Forwarding Information Base)
U Unreachable X Discards packets and sends a ICMP host unreachable message. Removed in v7
H Hw.Offloaded X https://help.mikrotik.com/docs/display/ROS/L3+Hardware+Offloading
y Copy X
v VPN X
m Modem X
a LDP Address X
l LDP Mapping X
Static Routing
To Training Router • Create a link between your
LAN routers using the ether4
port
• Add IP addresses onto the link
between your LAN routers
192.168.x.0/24
192.168.y.0/24
– For x use your group number
(the first or even number in the
group)
– Check ping across the link (from
172.x.2.0/24 your router)
Wlan 1
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 34
Static Routing
• Setup routing between the
To Training Router
LAN routers to the relevant
local 192.168.n.0/24 ranges
• Turn of laptop wireless to
force access via LAN router
• Test if the routing is correct
192.168.x.0/24
192.168.y.0/24
using ping and traceroute to
– 192.168.n.254 (router's
address)
172.x.2.0/24
– 192.168.n.1 (workstation's
Wlan 1 address)
• Make sure your laptop
Firewall allows ping requests!
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 35
Multiple Hops and Route Aggregation
DST GW
10.1.1.55/24
172.16.0.0/29 10.1.1.55
172.16.0.0/30
192.168.0.0/22 10.1.1.55
192.168.2.0/24
192.168.33.0/24
192.168.34.0/24
172.16.190.0/24
172.16.191.0/24
172.16.192.0/24
172.16.193.0/24
10.20.0.0/16
10.21.0.0/16
10.22.0.0/16
192.168.y.0/24
• Default Gateway – 10.1.1.254
• DNS – 1.1.1.1,8.8.8.8
• Make sure your WAN router can
traceroute to an internet IP e.g.
1.1.1.1
Laptop 1 Laptop 2
Ether 2 on RB750 Ether 2 on RB750
Copyright 2016 MikroTikSA (Pty) Ltd 38
Static Routing 3
To Training Router • Add IP’s from the
172.<group_number> range to
the ether links between the
WAN and LAN routers
• Add static routes on the WAN
router to each LAN network
172.x.2.0/24
192.168.x.0/24 192.168.y.0/24
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 39
Static Routing 3
To Training Router
• Add default routes on the LAN
routers to route via the WAN
• You will need to calculate and
give the trainer aggregated
routes to add for your networks
• All laptops must be able to ping
each other via the shortest
172.x.2.0/24 path and access the internet
192.168.x.0/24 192.168.y.0/24
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 40
Router Setup WAN
• Set the system identity to Y_groupname_WAN
e.g. 50_Bad-Dogs_WAN
• Upgrade your routers to the latest MikroTik RouterOS ver 7.x
• Upgrade your Winbox loader version if required (3.x)
• Set up the NTP client – use ntp1.meraka.csir.co.za as server
– Do this on LAN and WAN
• Create a configuration backup called “your_name WAN
MTCRE base” and “your_name LAN MTCRE base” copy it to
your laptop
– Important as custom backup are saved to memory not flash and will
disappear after reboot
FIB
– Destination: 192.168.xx.1(/32)
– Gateway: (WAN)-gw_ip
– Ensure you have the correct routes
172.x.2.0/24
on the WAN router
Lan 1
Route via /24
Lan 2 • Traceroute to your neighbours
laptop and the internal IP of his
172.x.2.0/24 router (.254)
– Observe the path selection
– Tracing to the laptop should go via
the WAN router
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 55
ECMP Routes
• Equal-cost multi-path routing (ECMP) is a routing strategy
where next-hop packet forwarding to a single destination can
occur over multiple "best paths" which tie for top place in
routing metric calculations.
• Multipath routing can be used in conjunction with most
routing protocols, since it is a per-hop decision that is limited
to a single router.
• ECMP (Equal Cost Multi Path) routes have more than one
route with the same cost to the same remote network
12mbps
6mbps
7mbps
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 62
ECMP II
To Training Router • Create an ECMP default route on your
LAN router
– This is 2 default routes with the same
distance and different gateways values
– Gw1 – via WAN router
– Gw2 – via ether1 to trainer 10.20.1.254
• Rapidly browse the web and download
multiple files from the trainer router
– Monitor traffic flow through interfaces
– Try traceroute to multiple destinations
• Enable “check gateway” (arp) and test
operation unplugging the ether to the
WAN router
• Save a backup called backup-ECMP
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 63
Route Distance
• The Distance metric tells the router what the “cost” of a route is
• To prioritize one (identical) route over another, if they both point
to the same network, you can use the “distance” option.
• The candidate route with the lowest distance becomes the active
route.
• When forwarding a packet, the router will use the route with the
lowest distance and reachable gateway
– If there are 2 routes to the same destination/prefix with the same cost
then they will be entered as ECMP in the route table
• You can have multiple default routes with different costs to
enable failover to a secondary gateway
• Dynamic routing protocols have their own internal metrics and
are inserted into the FIB with a set Administrative Distance
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 66
Policy Routing
• Policy-based routing (PBR) is a technique used to make
routing decisions based on policies set by the network
administrator.
• When a router receives a packet it normally decides where
to forward it based on the destination address in the
packet header, used to look up an entry in a routing table
• There may be a need to forward the packet based on other
criteria:
– source address or subnet
– protocol (http/s, ICMP, smtp, VoIP etc.)
– QOS marker (DSCP, WMM, Priority)
– Packet size
– any other information in a packet header
EDGE1
192.168.1.0/24 ISP 2
/routing table
add fib name=net1-route
add fib name=net2-route
/routing table
add fib name=net1-route
add fib name=net2-route
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 75
Policy Route
To Training Router • Add default routes to each custom
routing table as required to route
via different gateways
• Do a traceroute with your laptops
default IP address and note the
results
• Now change your laptops IP to
192.168.x.130
– Test again and note the results
• Can you still trace to your partners
local IP?
– Update the mangle to bypass for any
192.168.x.0 destination
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 76
Protocol Routing
• Use firewall address lists to keep track of sets of users for
custom routing rules
• You can mark specific protocols to custom route these via
different gateways
– HTTP and mail via GW1, all other traffic via GW2
– Mark all VOIP traffic to send along a lower latency connection
• Use SIP traffic type or mark connections to a specific
destination server
• PCC can be used to track incoming connections for
returning the packet via the same gateway
• Netwatch / Scripting / Recursive Next Hop Lookup can be
used to monitor gateway availability and enable/disable
routes as required
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 80
Interface Routing
• The value of gateway can be specified as an interface
name instead of the nexthop IP address
• Routes defined in this way have the following special
properties:
– Unlike connected routes, routes with interface nexthops are not
used for nexthop lookup (route Scope is too high)
– It is possible to assign several interfaces as a value of gateway,
and create an ECMP route (it is not possible to have a connected
route with multiple gateway values)
• Interface routing is good for PPPoE (and other ppp)
connections from the router where:
– the value of gateway might change on a per connection basis
– the gateway IP might be the same for multiple connections (as
would be the case for multiple PPPoE to the same ISP
ROS V7
Copyright 2016 MikroTikSA (Pty) Ltd 82
PPPoE in RouterOS
• The PPPoE (Point to Point Protocol over Ethernet) protocol
provides extensive user management, network
management and accounting benefits to ISPs and network
administrators
• 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.
94
VRF and Router Management
• Any router management is not possible from vrf side
(winbox, telnet, ssh ...)
• MAC based management can be used e.g. MAC Winbox
and RoMON
• Ping and traceroute tools are updated to support VRFs
– Same system as policy routed tables
• Technically VRFs are based on policy routing
– There is exactly one policy route table for each active VRF
• The existing policy routing support in MT RouterOS is not
changed, however, it is not possible to have policy
routing within a VRF (only 1 route mark is supported)
Break between 3rd party device and remote network – local LAN still stays up
Target scope is modified to bring it within static route scope, now route
is available recursively via static route
Copyright 2016 MikroTikSA (Pty) Ltd 104
• By default (without any
configuration)
– Any active non connected
route can recurse through
a Connected Route
• An iBGP Route Can
Recurse through
– Static Routes
– OSPF / RIP / MME Routes
– Connected Routes
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 110
Preferred Source
To Training Router
• Ping your partners LAN router
from your LAN router
• Use Torch on the partner side
and check src/dst of ICMP
packets
• Change the preferred source
on the static route to your
partner to the 192.168.x.254
Lan 2
172.x.2.0/24 IP
• Use Torch to check ping
results
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 111
Administrative Distance
• Administrative distance is the measure used by routers to select
the best path when there are two or more different routes to the
same destination from two different routing protocols
• Administrative distance defines the reliability of a routing
protocol
– Each routing protocol is prioritized in order of most to least reliable
(believable) using an administrative distance value.
– A lower numerical value is preferred, e.g. an OSPF route with an
administrative distance of 110 will be chosen over a RIP route with an
administrative distance of 120
• A distance of 255 (unknown) will not be installed in the FIB
• Note that distance is different from metric in that metric defines
the cost within each specific protocol and not the RIB
– A metric is a standard of measurement, such as path length, that is
used by routing algorithms to determine the optimal path to a
destination
Copyright 2016 MikroTikSA (Pty) Ltd 112
Default Administrative Distance
Protocol Administrative distance
Directly connected route 0
Static route out an interface 1
Static route to next-hop address 1
External BGP 20
IGRP (Cisco) 100
OSPF 110
RIP 120
Internal BGP 200
DHCP-learned 254
Unknown / Blackhole / Prohibit 255
Advertised as External
Type 1 but should be an
internal network range
PTP Establishment
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 172
Point to Point
• By default a PTP connection can only have a single
neighbour so no other action is required aside from
adding the network or interface as required
172.x.2.0/24
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 177
PTMP Broadcast
PTMP To
Training Router • Remove static neighbours
• Convert the Broadcast
interface to ptmp-broadcast
on the WAN router
• Confirm correct operation
• Create a backup called
OSPF_ptmp.backup
– Only required on WAN router
172.x.2.0/24
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 178
Interface Settings
• interface - interface on which OSPF will run
• cost - interface cost expressed as link state metric
• priority - router's priority used to determine the
Designated Router/s (DR and BDR) for the network.
– the router with the higher priority takes precedence
• Authentication – Whether to use authentication and
which type to use
• authentication-key – authentication key used for simple
password authentication
• authentication-key-ID - key id is used to calculate message
digest (used only when MD5 authentication is enabled)
– Value should match on all OSPF routers from the same region.
CPE CPE
A B
172.x.2.0/24
Laptop 1 Laptop 2
Copyright 2016 MikroTikSA (Pty) Ltd 188
OSPF Logging
• To troubleshoot OSPF properly you will need to add the OSPF
topic into System Logging
• This will create a lot of very detailed messages and will fill up the
log very quickly – turn off when troubleshooting is complete!
– Hint: Do not log RAW packet information unless required
• Either one side has no authentication type set or if set the types
are mismatched (e.g. simple vs MD5)
Area Area
Area Area
IR
IR
area-id=0.0.0.1
area-id=0.0.0.2 area-id=0.0.0.3
No direct connection
to backbone area
ASBR
Receive
external routes
Receive external routes as a summary /
as a summary / default default route
route and inject external
routes
external network
EoIP, VLAN
PPTP,L2TP
PPPoE
Tagged Traffic
Egress Port
Trunk Port
CRS3xx series + + + + + + +
CRS1xx/CRS2xx series + + - +1 +1 - -
[QCA8337] + + - - +2 - -
[Atheros8327] + + - - +2 - -
[Atheros8227] + + - - - - -
[Atheros8316] + + - - +2 - -
[Atheros7240] + + - - - - -
[MT7621] + - - - - - -
[RTL8367] + - - - - - -
[ICPlus175D] + - - - - - -
1. Feature will not work properly in VLAN switching setups, you must make
sure that required packet are sent out with the correct VLAN tag using ACL
rules.
2. DCHP Snooping will not work properly with VLAN switching
IPIP
EoIP
GRE
IP Tunnels
• An IP tunnel is an Internet Protocol (IP) network communications
channel between two networks
• It is used to transport another network protocol by encapsulation
of its packets.
• IP tunnels are often used for connecting two disjoint IP networks
that don't have a native routing path to each other, via an
underlying routable protocol across an intermediate transport
network.
• In conjunction with the IPsec protocol they may be used to create
a virtual private network between two or more private networks
across a public network such as the Internet
• Another prominent use is to connect islands of IPv6 installations
across the IPv4 Internet (tunnel brokering)
172.16.0.0/30
10.10.0.1/24 10.40.0.1/24
192.168.0.0/24 192.168.20.0/24
Copyright 2016 MikroTikSA (Pty) Ltd 266
Ethernet Over IP (EOIP) Tunnel
• Ethernet over IP (EoIP) Tunneling is a MikroTik proprietry
protocol that creates an Ethernet (Layer2) tunnel between two
routers on top of an IP connection
• The EoIP tunnel may run over IPIP tunnel, PPTP tunnel 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:
– bridge LANs over the Internet
– bridge LANs over encrypted tunnels
– bridge LANs over 802.11b 'ad-hoc' wireless networks
PPPoE
PPTP
L2TP
SSTP