Professional Documents
Culture Documents
Copyright Notice
(Aviso sobre direitos autorais)
English:
This material is an effort intended to improve the level of knowledge of professionals
that work with Mikrotik RouterOS and should be used solely for self-study purposes.
Digital copies and/or any printed material contained in this presentation or derived
from it are property of MD Brasil TI & Telecom and cannot be used for any kind of
training, presentation or workshop, even non-commercial ones.
Reproduction of any part or picture requires previous written authorization of MD
Brasil. For information about how to obtain such authorization, please contact
mdbrasil@mdbrasil.com.br.
Portuguese:
Este material um esforo que visa aprimorar o grau de conhecimento de
profissionais que trabalham com Mikrotik RouterOS e deve ser usado apenas com
objetivos de auto estudo.
Cpias digitais e/ou materiais impressos com contedo desta apresentao ou dela
derivados so de propriedade a MD Brasil TI & Telecom a no podem ser usados para
qualquer tipo de treinamento, apresentao ou seminrio, mesmo os de finalidades
no comerciais.
A reproduo de qualquer parte ou figura requer prvia autorizao por escrito da
MD Brasil. Para informaes em como obter esta autorizao, por favor contate
mdbrasil@mdbrasil.com.br.
Copyright md brasil - direitos reservados
Introduction
Wardner Maia
Electronic and Telecommunications Engineer;
Introduction
http://mikrotikbrasil.com.br
Objectives:
To understand BGP filtering techniques to be applied to a
multi connected network and intended to implement
external routing policies, providing traffic balance,
security and reliability.
Target Audience:
ISPs and Telecom operators running or intending to run
BGP with Mikrotik RouterOS.
Agenda
1) BGP essentials and basics of BGP
filtering;
2) Case Studies:
2.1) Overview
2.2) Single-Homed Provider
2.3) Single-Homed + IXP
2.4) Multi-Homed + IXP
2.5) Multi-Homed + IXP +
Providing transit services
Copyright md brasil - direitos reservados
Agenda
1) BGP essentials and basics of BGP
filtering;
2) Case Studies:
2.1) Overview
2.2) Single-Homed Provider
2.3) Single-Homed + IXP
2.4) Multi-Homed + IXP
2.5) Multi-Homed + IXP +
Providing transit services
Copyright md brasil - direitos reservados
AS-3
AS-1
md1302192041
AS-2
Your AS
Autonomous System
One definition for an AS can be:
An Autonomous System (AS) is a group of IP networks run by
one or more network operators with a single, clearly defined
routing policy.
Autonomous System
md1302192042
IANA
RIRs
AFRINIC
LIRs
APNIC
ARIN
ID
CH
KR
TW
JP
VT
LACNIC
MX
RIPE
BR
md1303102108
10
BGP
AS-1
AS-3
md1302192041
BGP
BGP
BGP
AS-2
BGP
Your AS
11
BGP Protocol
12
BGP protocol
BGP Characteristics:
13
BGP Protocol
Basic principles:
BGP works exchanging routing information about
reachability of networks with NLRI (Network Layer
Reachability Information) messages;
NLRI messages have one or more network prefixes and
attributes associated with them;
14
Running BGP
AS-1
AS-2
md1302200234
15
BGP Messages
OPEN
First message sent after TCP connection establishment and
confirmed with a KEEPALIVE;
KEEPALIVE
Messages exchanged in intervals of 60 seconds to check peer
state;
UPDATE
Information about network prefixes;
NOTIFICATION
Sent when an error occurs;
AS-1
md1302200234
AS-2
Optional message:
ROUTE REFRESH
Ask the neighbor to send the routes again.
Copyright md brasil - direitos reservados
16
BGP states
Trying to get a
peer
3 - Active
2 - Connect
OPEN
4-OpenSent
KEEPALIVE
md1302200235
1-Idle
5-OpenConfirm
KEEPALIVE
Waiting for
start event
KEEPALIVE
UPDATE
6-Established
Neighbor
negotiation
complete
17
BGP states
Trying to get a
peer
3 - Active
OPEN
2 - Connect
OPEN
NOTIFICATION
4-OpenSent
1-Idle
NOTIFICATION
KEEPALIVE
md1302200235
Waiting for
start event
NOTIFICATION
5-OpenConfirm
KEEPALIVE
KEEPALIVE
UPDATE
6-Established
Neighbor
negotiation
complete
18
UPDATE message
Unreachable Routes
Withdrawn Routes (Variable)
Path Attributes
Path Attributes (Variable)
Length (1 byte)
NLRI
Length (1 byte)
19
Attributes Types
Mandatory
Well Known
Recognized by all BGP
implementations
Discretionary
Attributes
Optionally
recognized
Transitive
Optional
md1302201203
Intransitive
Not propagated to
other routers
20
Local Preference:
Attribute used to choose a preferred outbound path inside an
AS;
Copyright md brasil - direitos reservados
21
AS-100
Rede
1.1.0.0/20
AS-200
AS-Path
100
AS-Path
200, 100
md1302200202
AS-400
AS-Path
300, 200, 100
NETWORK
1.1.0.0/20
AS-300
AS-path
300,200,100
Copyright md brasil - direitos reservados
22
Looping Prevention
AS-100
Rede
1.1.0.0/20
AS-200
AS-Path
100
AS-Path
400, 300, 200, 100
md1302200202
AS-400
AS-Path
300, 200,
100
AS-Path
200,
100
AS-300
23
Understanding Next-Hop
AS-100
10.1.1.1
AS-200
10.1.1.5
Next-Hop
10.1.1.1
Next-Hop
10.1.1.5
md1302201736
10.1.1.9
AS-400
Next-Hop
10.1.1.9
NETWORK
1.1.0.0/20
AS-Path
300,200,100
AS-300
Next-Hop
10.1.1.9
24
AS-10
10.1.1.1
Network
1.1.0.0/20
Next-Hop
10.1.1.1
AS-Path
10
Network
1.1.0.0/20
AS-20
md1302201755
AS-30
10.1.1.2
10.1.1.3
Network
1.1.0.0/20
AS-Path
10, 20
Next-Hop
10.1.1.1
25
26
Routing Essentials
Routing
Information
(RIB)
Base
Routing Information
base is the data
base where all
information about IP
routes are stored.
Each protocol has its
RIB
27
Routing Essentials
Routes Processing
28
Routing Essentials
Forwarding
Information
Base (FIB)
FIB contains
information of
prefixes related to
the network
interfaces that
could be used to
forward packets.
29
Is Next-Hop
reachable?
Yes
No
No
Yes
No
Yes
Discard Information
Copyright
MD1303091345
30
Copyright
MD1303091345
Is there an identical
prefix?
Yes
No
31
9) Prefers the path with shortest route reflection cluster list (default = 0);
10)Prefers the path that comes from the lowest neighbor address.
32
Routing Filters
33
Input Filters
Route Updates
Output Filters
BGP Routes
advertisements
md1303082332
Routes processing
Route Updates
Forwarding
Information Base
(FIB)
Routes Exchanges
With Neighbor
Nodes
34
Matchers
Actions
Matchers by BGP
attributes inside the
UPDATE message.
Actions intended to
modify BGP attributes on
a specific route.
35
Agenda
1) BGP essentials and basics of BGP
filtering;
2) Case Studies:
2.1) Overview
2.2) Single-Homed Provider
2.3) Single-Homed + IXP
2.4) Multi-Homed + IXP
2.5) Multi-Homed + IXP +
Providing transit services
Copyright md brasil - direitos reservados
36
Scenario I
Single Homed ISP
Internet
Transit
Operator
md1302192043
Your AS
37
Scenario II
Single-Homed + IXP
Internet
IXP
Transit
Operator
AS1
md1302192044
AS1
Your AS
38
Scenario III
Dual-Homed + IXP
Internet
IXP
Transit
Operator
AS2
md1302192045
Transit
Operator 2
AS1
Your AS
39
Scenario IV
Dual-Homed + IXP
Providing Transit services
Internet
IXP
Transit
Operator
AS2
md1302192045
Transit
Operator 2
AS1
Your AS
Transit
Client
Copyright md brasil - direitos reservados
40
Scenario V Multi-Homed +
IXP + iBGP + Confederation
Internet
TR2
PTT
AS2
TR1
md1302192258
AS1
41
Agenda
1) BGP essentials and basics of BGP
filtering;
2) Case Studies:
2.1) Overview
2.2) Single-Homed Provider
2.3) Single-Homed + IXP
2.4) Multi-Homed + IXP
2.5) Multi-Homed + IXP +
Providing transit services
Copyright md brasil - direitos reservados
42
Scenario I
Single-Homed ISP
Internet
Transit
Operator
md1302192043
Your AS
43
44
with
direct
45
BGP Configuration
ASN=65000
172.16.21.1/30
ASN=65021
172.16.21.2/30
46
BGP Configuration
ASN=65000
ASN=65021
172.16.21.1/30
172.16.21.2/30
47
BGP Configuration
ASN=65000
ASN=65021
172.16.21.1/30
172.16.21.2/30
Checking results
48
49
Prefixes Control
Transit
Operator
Your AS
md1302192046
50
Internet
Transit
Operator
md1302192043
Setup
route
static
default
Filter
Peer
51
52
53
Bogons treatment
54
Understanding Communities
A Community is a 32 bit number you can attach to a route with
the purpose to signalize something to other ASs. A community
can be viewed like a flag in the route.
There are well known communities, like no-export, no-advertise
etc. but any AS can set this own set of communities. The usual
format of a community is to split the 32 bit in 2 numbers: AS
number:some_number
Communities are widely used to implement routing policies, like:
Allowing a remote AS to set some Local Preference when
sending the announcements;
Putting a IP address or network in black hole.
Etc.
Copyright md brasil - direitos reservados
55
Understanding Communities
Cymru
Your AS
Announcements
with community
65332:888
56
57
Avoiding other
routes IN and OUT
58
59
BGP configuration
60
61
Agenda
1) BGP essentials and basics of BGP
filtering;
2) Case Studies:
2.1) Overview
2.2) Single-Homed Provider
2.3) Single-Homed + IXP
2.4) Multi-Homed + IXP
2.5) Multi-Homed + IXP +
Providing transit services
Copyright md brasil - direitos reservados
62
What is an IXP?
IXP Internet Exchange Point
(Or NAP Network Exchange Point or MAE Metropolitan Area
Exchange)
63
Internet
IP transit provider
ISP X
IXP
ISP Y
64
Scenario II
Single Homed + IXP
AS1
Internet
IXP
Transit
Operator
md1302192044
AS1
Your AS
65
Why?
Copyright md brasil - direitos reservados
66
67
68
Scenario II
Single Homed + IXP
AS1
Internet
Transit Effect
(undesired)
Without filtering AS-1
could decide that the
best path to go to the
Internet is via Your AS
IXP
Transit
Operator
md1302192044
AS1
Your AS
Copyright md brasil - direitos reservados
69
70
QUIZZ
Is necessary to discard routes that contain
own AS number in the AS-Path?
Copyright md brasil - direitos reservados
71
Present Use
Reference
------------------------------------------------------------------------0.0.0.0/8
"This" Network
RFC 1122
10.0.0.0/8
Private-Use Networks
RFC 1918
127.0.0.0/8
Loopback
RFC 1122
169.254.0.0/16
Link Local
RFC 3927
172.16.0.0/12
Private-Use Networks
RFC 1918
192.0.0.0/24
RFC 5736
192.0.2.0/24
TEST-NET-1
RFC 5737
192.88.99.0/24
RFC 3068
72
Address Block
Present Use
Reference
-------------------------------------------------------------------------
192.168.0.0/16
Private-Use Networks
RFC 1918
198.18.0.0/15
RFC 2544
198.51.100.0/24
TEST-NET-2
RFC 5737
203.0.113.0/24
TEST-NET-3
RFC 5737
224.0.0.0/4
Multicast
RFC 3171
240.0.0.0/4
RFC 1112
255.255.255.255/32
Limited Broadcast
RFC 919
RFC 922
73
74
75
Agenda
1) BGP essentials and basics of BGP
filtering;
2) Case Studies:
2.1) Overview
2.2) Single-Homed Provider
2.3) Single-Homed + IXP
2.4) Multi-Homed + IXP
2.5) Multi-Homed + IXP +
Providing transit services
Copyright md brasil - direitos reservados
76
Scenario III
Multi-Homed + IXP
77
Scenario III
Multi-Homed + IXP
Internet
IXP
Transit
Operator
AS2
md1302192045
Your AS
AS1
Transit
Operator 2
78
Scenario III
Multi-Homed + IXP
Internet
IXP
Transit
Operator
AS2
md1302192045
Your AS
AS1
Transit
Operator 2
79
Scenario III
without filtering
12.12.0.0/20, 13.13.0.0/20, , 19.19.0.0/20 are networks
belonging to TR-2 and announced to IXP and TR-1
80
81
Traffic Manipulation
82
Routing Filters
83
Traffic Manipulation
84
Upload Control
85
Upload Manipulation
86
Upload Manipulation
Weight
Weight
md130230052
TR1
1.1.0.0/20
Weight=10
PTT
1.1.0.0/20
Weight=0
87
Upload Manipulation
Local-Preference
Local-Preference
md130230108
TR1
PTT
1.1.0.0/20
LP =150
1.1.0.0/20
LP = 100
88
Upload Manipulation
Weight or Local preference
or
Copyright md brasil - direitos reservados
89
90
Download Control
91
Download Manipulation
92
Download Manipulation
with MED attribute
md1302230153
TR1
MED=10
MED=30
PTT
MED=20
AS-X
93
Download Manipulation
by more specific announcements
e.g.:
AS-x announces half of its
addresses for each link and
the whole IP range for both
links. The goal is to
guarantee the balance and
redundancy.
md130230052
TR1
TR2
1.1.8.0/21
1.1.0.0/20
1.1.0.0/21
1.1.0.0/20
AS-X
94
Download Manipulation
AS-Path prepend technique
AS-10
1.1.0.0/20
1 Gbps
100 Mbps
AS-30
Traffic Flow
95
Download Manipulation
AS-Path prepend technique
Prepending 3 times self AS
Direo do trfego
AS-20
1 Gbps
AS-10
100 Mbps
1.1.0.0/20
AS-30
md1302230258
96
Download Manipulation
Comparing the methods:
MED:
Efficient, but limited when having 2 or more connections
to the same AS;
More specific announcements:
Aggressive resource. Will work regardless the number of
hops. Can choose sub-optimal paths. Use in extreme
cases.
AS-Path prepend:
Soft resource. Also has limitations due to number of
AS-Paths and topology changes.
Copyright md brasil - direitos reservados
97
Download Manipulation
with AS-Path prepend
TR1 Routing table (looking glass) before ASPath prepend
Filters:
98
Download Manipulation
with AS-Path prepend
99
100
Agenda
1) BGP essentials and basics of BGP
filtering;
2) Case Studies:
2.1) Overview
2.2) Single-Homed Provider
2.3) Single-Homed + IXP
2.4) Multi-Homed + IXP
2.5) Multi-Homed + IXP +
Providing transit services
Copyright md brasil - direitos reservados
101
Scenario IV
Dual Homed + IXP
providing transit services
Internet
IXP
Transit
Operator
AS2
md1302192045
Transit
Operator 2
AS1
Your AS
Last Scenario
Copyright md brasil - direitos reservados
Transit
Client
102
Becoming a Transit AS
103
104
105
106
107
Agenda
1) BGP essentials and basics of BGP
filtering;
2) Case Studies:
2.1) Overview
2.2) Single-Homed Provider
2.3) Single-Homed + IXP
2.4) Multi-Homed + IXP
2.5) Multi-Homed + IXP +
Providing transit services
Copyright md brasil - direitos reservados
108
Final Considerations
109
Thank you
Hvala!
Wardner Maia maia@mdbrasil.com.br
110
Download this
presentation
www.mikrotikbrasil.com.br/artigos
111