You are on page 1of 33

Routing fundamentals

with Mikrotik
GLC webinar, 1 December 2016

Achmad Mardiansyah
achmad@glcnetworks.com
GLC Networks, Indonesia
www.glcnetworks.com
Agenda

● Introduction
● Layer 3 concept
● Routing
● Demo
● Q&A

2
www.glcnetworks.com
What is GLC?

● Garda Lintas Cakrawala (www.glcnetworks.com)


● An Indonesian company
● Located in Bandung
● Areas: Training, IT Consulting
● Mikrotik Certified Training Partner
● Mikrotik Certified Consultant
● Mikrotik distributor

3
www.glcnetworks.com
About GLC webinar?

● First webinar: january 1, 2010 (title:


tahun baru bersama solaris - new
year with solaris OS)
● As a sharing event with various
topics: linux, networking, wireless,
database, programming, etc
● Regular schedule: every 2 weeks
● Irregular schedule: as needed
● Checking schedule:
http://www.glcnetworks.com/main/sc
hedule
● You are invited to be a presenter
○ No need to be an expert
○ This is a forum for sharing: knowledge,
experiences, information

4
www.glcnetworks.com
Trainer Introduction

● Name: Achmad Mardiansyah


● Base: bandung, Indonesia
● Linux user since ’99
● Mikrotik user since 2007
● Certified Trainer (MTCNA/RE/WE/UME/INE/TCE)
● Mikrotik Certified Consultant
● Work: Telco engineer, Sysadmin, PHP programmer,
and Lecturer
● Personal website: http://achmad.glcnetworks.com
● More info:
http://au.linkedin.com/in/achmadmardiansyah

5
www.glcnetworks.com
Please introduce yourself

● Your name
● Your company/university?
● Your networking experience?
● Your mikrotik experience?
● Your expectation from this course?

6
www.glcnetworks.com
What is Mikrotik?

● Name of a company
● A brand
● A program (e.g. mikrotik academy)
● Headquarter: Riga, Latvia

7
www.glcnetworks.com
What are mikrotik products?

● Router OS
○ The OS. Specialized for networking
○ Website: www.mikrotik.com/download
● RouterBoard
○ The hardware
○ RouterOS installed
○ Website: www.routerboard.com

8
www.glcnetworks.com
What Router OS can do?

● Go to www.mikrotik.com
○ Download: what_is_routeros.pdf
○ Download: product catalog
○ Download: newsletter

9
www.glcnetworks.com
What are Mikrotik training & certifications?

Certificate validity is 3 years

10
www.glcnetworks.com
Layer 3 concept

11
www.glcnetworks.com
Layer 3

● Logical address
● 2 versions: IPv4 (our focus) and IPv6
● IPv4 32 bit long
● Consist of network part & host part
● Can be class based IP address (without subnet)
● Now it is classless IP address -> VLSM (variable
length subnet mask)
● CIDR (classless inter domain routing)

12
www.glcnetworks.com
IP spec (RFC 791)

● Defined long time ago (what 1981?)


● Defines how the IP header looks like
● Still used up to know
● New version -> IPv6

13
www.glcnetworks.com
How the layer 3 address look like?

● IPv4 address is 32 bit


● Written in binary
● Displayed to human in decimal every 8 bit (octet).
● Has 2 parts: network part and host part
● Like a phone number 0812 XXXXXXXX -> hierarchical

Network part host part

● All devices in the network will have same network address


● First and last address cannot be used (for network id and broadcast id)

14
www.glcnetworks.com
Layer 3 connection and addressing

● Devices that uses layer 3 information: router and host


● All devices must have a layer 3 address
● address is hierarchical
○ Network part (e.g. 192.168.0.2/26 -> the first 26 bit of all host in the network will be
the same) -> show the grouping identity
○ Host part
192.168.3.3/24
192.168.3.0/24

R3
192.168.0.3/26 192.168.3.9/24
192.168.0.1/26

192.168.1.1/24
192.168.0.0/26
R1

192.168.0.2/26
192.168.1.0/24
R2
192.168.2.9/24
192.168.1.9/24

192.168.2.2/24 192.168.2.0/24

15
www.glcnetworks.com
What is VLSM?

● Variable-Length Subnet Masking (VLSM)


● Can divide an IP address block into subnets of different sizes using / (slash)
notation
● Solution the in efficient of classful IP address (fixed length). No more class A,
class B, Class C -> pleeease dont say this classes anymore
● making it possible to create subnets with very different host counts without
wasting large numbers of addresses.
● RFC: 1878 (1995)
● Basis for CIDR
● Example: 23.45.0.0/16
○ 23.45.0.0/25
○ 23.45.0.128/25

16
www.glcnetworks.com
VLSM RFC

17
www.glcnetworks.com
What is CIDR?

● CIDR: Classless Inter-Domain Routing (sometimes is called supernetting)


● CIDR solves problem of wasted address space by providing a new and more
flexible way to specify network addresses in routers (using slash as notation)
● allow flexible allocation of Internet Protocol (IP) addresses.
● Replaces classfull network (class A,B,C,D). Please dont ever mention this
anymore...
● CIDR lets a routing table entry represent an aggregation of networks that exist
in the forward path
● Each IP address has a network prefix that identifies either one or several
network gateways.
● RFC: 1519

18
www.glcnetworks.com
CIDR RFC

19
www.glcnetworks.com
Routing

20
www.glcnetworks.com
What is routing table?
destination gateway
● A table at router that is used to
192.168.0.0/26 direct forward packet
192.168.1.0/24 direct ● Available on every devices (router
192.168.2.0/24 192.168.0.2 and host)
● Entry is executed sequentially
192.168.3.0/24 192.168.0.3

192.168.16.3/32 192.168.0.2 192.168.3.3/24


192.168.3.0/24
0.0.0.0/0 192.168.0.3
R3
192.168.0.3/26 192.168.3.9/24
192.168.0.1/26

192.168.1.1/24
192.168.0.0/26
R1

192.168.0.2/26
192.168.1.0/24
R2
192.168.2.9/24
192.168.1.9/24

192.168.2.2/24 192.168.2.0/24

21
www.glcnetworks.com
When router receive a packet…
(setup priority on routing table)
● Router will analyse the destination IP address
● Router will rearrange the routing entry and put priority
○ Longest prefix wins
○ Lowest distance wins

destination gateway destination gateway

192.168.0.0/26 direct 192.168.16.3/32 192.168.0.2

192.168.1.0/24 direct 192.168.0.0/26 direct

192.168.2.0/24 192.168.0.2 192.168.1.0/24 direct

192.168.3.0/24 192.168.0.3 192.168.2.0/24 192.168.0.2

192.168.16.3/32 192.168.0.2 192.168.3.0/24 192.168.0.3

0.0.0.0/0 192.168.0.3 0.0.0.0/0 192.168.0.3

22
www.glcnetworks.com
How the routing table works (R1)?

● It works like a firewall: match and action


● You should think in binary to understand how it works

destination gateway

192.168.16.3/32 192.168.0.2
11000000 10101000 00001000 00000011

192.168.0.0/26 direct
11000000 10101000 00000000 00

192.168.1.0/24 direct
11000000 10101000 00000001

192.168.2.0/24 192.168.0.2
11000000 10101000 00000010

192.168.3.0/24 192.168.0.3
11000000 10101000 00000011

0.0.0.0/0 192.168.0.3

23
www.glcnetworks.com
A packet arrived… (part 1)

Destination IP address of the packet is 192.168.16.3, which gateway do we use?


A: 192.168.16.3 = (11000000 10101000 00001000 00000011)

destination gateway

192.168.16.3/32 192.168.0.2
11000000 10101000 00001000 00000011 MATCH

192.168.0.0/26 direct
11000000 10101000 00000000 00

192.168.1.0/24 direct
11000000 10101000 00000001

192.168.2.0/24 192.168.0.2
11000000 10101000 00000010

192.168.3.0/24 192.168.0.3
11000000 10101000 00000011

0.0.0.0/0 192.168.0.3

24
www.glcnetworks.com
A packet arrived… (part 2)

Destination IP address of the packet is 192.168.2.6, which gateway do we use?


A: 192.168.2.6 = (11000000 10101000 00000010 00000110)

destination gateway

192.168.16.3/32 192.168.0.2
NOT MATCH
11000000 10101000 00001000 00000011

192.168.0.0/26 direct
11000000 10101000 00000000 00 NOT MATCH

192.168.1.0/24 direct NOT MATCH


11000000 10101000 00000001

192.168.2.0/24 192.168.0.2
11000000 10101000 00000010 MATCH

192.168.3.0/24 192.168.0.3
11000000 10101000 00000011

0.0.0.0/0 192.168.0.3

25
www.glcnetworks.com
A packet arrived… (part 3)

Destination IP address of the packet is 192.168.8.6, which gateway do we use?


A: 192.168.8.6 = (11000000 10101000 00001000 00000110)

destination gateway

192.168.16.3/32 192.168.0.2
NOT MATCH
11000000 10101000 00001000 00000011

192.168.0.0/26 direct
11000000 10101000 00000000 00 NOT MATCH

192.168.1.0/24 direct NOT MATCH


11000000 10101000 00000001

192.168.2.0/24 192.168.0.2
11000000 10101000 00000010 NOT MATCH

192.168.3.0/24 192.168.0.3 NOT MATCH


11000000 10101000 00000011

0.0.0.0/0 192.168.0.3
MATCH
26
www.glcnetworks.com
Static routing
destination gateway ● Entries on routing table is created
192.168.0.0/26 direct manually
● Admin must manage routing table
192.168.1.0/24 direct
in all routers
192.168.2.0/24 192.168.0.2
● Admin have full control
192.168.3.0/24 192.168.0.3

192.168.16.3/32 192.168.0.2 192.168.3.3/24


192.168.3.0/24
0.0.0.0/0 192.168.0.3
R3
192.168.0.3/26 192.168.3.9/24
192.168.0.1/26

192.168.1.1/24
192.168.0.0/26
R1

192.168.0.2/26
192.168.1.0/24
R2
192.168.2.9/24
192.168.1.9/24

192.168.2.2/24 192.168.2.0/24

27
www.glcnetworks.com
Dynamic routing
destination gateway ● Entries on routing table is created
192.168.0.0/26 direct automatically using routing protocol
(RIP, OSPF, BGP)
192.168.1.0/24 direct
● Admin must have a good
192.168.2.0/24 192.168.0.2
knowledge about routing protocol
192.168.3.0/24 192.168.0.3

192.168.16.3/32 192.168.0.2 192.168.3.3/24


192.168.3.0/24
0.0.0.0/0 192.168.0.3
R3
192.168.0.3/26 192.168.3.9/24
192.168.0.1/26

192.168.1.1/24
192.168.0.0/26
R1

192.168.0.2/26
192.168.1.0/24
R2
192.168.2.9/24
192.168.1.9/24

192.168.2.2/24 192.168.2.0/24

28
www.glcnetworks.com
DEMO

29
www.glcnetworks.com
Mikrotik routing table

30
www.glcnetworks.com
QA

31
www.glcnetworks.com
Interested?
Just come to our
training...
Special price for webinar attendees...

32
www.glcnetworks.com
End of slides

● Thank you for your attention


● Please submit your feedback: http://bit.ly/glcfeedback
● Like our facebook page: “GLC networks”
● Stay tune with our schedule

33
www.glcnetworks.com

You might also like