Introduction To Border Gateway Protocol (BGP 4)
Introduction To Border Gateway Protocol (BGP 4)
Introduction To Border Gateway Protocol (BGP 4)
Border Gateway
Protocol (BGP 4)
Version 1.2
Summary
BGP Concept
BGP Operation
Route
Control
Configuration
Trouble-shooting
Juniper
Updated
vs. Cisco
Juniper Networks, Inc. Copyright
Summary
BGP Concept
BGP Operation
Route
Control
Configuration
Trouble-shooting
Juniper
Updated
vs. Cisco
Concepts
BGP-4 supports
the path vector concept to avoid the potential routing loop introduced by
complicated (I.e., full-meshed) Internet topology
Updated
Updated
Concepts
Updated
Concepts
BGP routers only use those routes whose next-hop can be reached
BGP routers advertise only those routes that they use
BGP runs over a reliable transport protocol.
BGP MIB consists of the BGP Peer Table, The BGP Path Attribute
Table and a Global Table.
Updated
Concepts
Autonomous System (AS)
The use of the term Autonomous System here stresses the fact that,
even when multiple IGPs and metrics are used, the administration
of an AS appears to other ASs to have a single coherent interior
routing plan and presents a consistent picture of what
destinations are reachable through it.
Updated
Concepts
Autonomous System Type
Stub AS
Single Exit Point
Local Traffic
Multi-Homed AS
Multiple Exit Points
Local Traffic
Transit AS
Local and Transit Traffic
BGP Peers
Provider "B"
Provider "A"
Transit AS
AS 60
Transit AS
AS 50
Customer #1
AS 100
TCP Connections
Stub As
Stub As
Customer #n
AS 120
EBGP
IBGP
Updated
Multi-Homed
Customer #2
AS 110
BGP AS
What is an AS?
-16 bit integer (1-65535)
-64512-65535 private.
Updated
10
Concepts
CIDR = Classless Inter Domain Routing
Address Assignment
A mechanism
Reduces
Conserves
Resources
Updated
11
Concepts
Supernet
Organizations
These
The
IP addresses
Can
192.24.0.0
Updated
12
Concepts
Exterior Routes
Routes
Updated
13
Concepts
External Neighbor
AS 100
A
.1
1.1.1.0
AS 200
.2
Router B
bgp {
group EXTERNAL {
neighbor 1.1.1.1;
type external;
peer-as 100 ;
}
{
Updated
14
Concepts
Internal Neighbor
Neighbor in same AS
May be several hop away
Configuration
Router A
bgp {
group INTERNAL {
type internal;
neighbor 1.1.1.1;
}
}
AS 100
A
B
Router B
bgp {
group INTERNAL {
neighbor 2.2.2.2;
type internal;
}
{
Updated
15
Concepts
Internal vs. External BGP
EBGP Update
Local Preference
Removed
MED
Removed the MED from
previous AS
Unchanged
Cluster list
Prepend the Cluster ID
by RR
Changed to the local address
Next-hop address
Preserved
Prepend the local AS
AS Path
Unchanged
Updated
IBGP Update
Preserved
Preserved
16
BGP Attribute
Well-known mandatory Always present in a BGP
update. All BGP implementations recognize these
attributes. An example is the BGP next hop attribute.
(Origin, AsPath)
Well-known discretionary - Might be present in a BGP
update. All BGP implementations recognize these
attributes. An example is the local preference
attribute.
Optional transitive - Must be passed to other BGP peers
even if the local peer does not understand or process
the attribute. An example is the community attribute.
Optional non-transitive - Must not be passed to other
BGP peers. An example is the MED attribute
Updated
17
Concepts
AS path Attributes
1, ORIGIN
2, AS_PATH
3, NEXT_HOP
4, MULTI_EXIT_DISC
5, LOCAL_PREF
6, ATOMIC_AGGREGATE
7, AGGREGATOR
(well-known mandatory)
(well-known mandatory)
(well-known mandatory)
(optional non-transitive)
(well-known discretionary)
(well-known discretionary)
(optional transitive)
8, Community
9, Originator Id
10, Cluster list
11, Destination Path Attribute
Updated
(optional transitive)
(optional non-transitive)
(optional non-transitive)
(optional transitive)
18
Concepts
AS-Path
100
143.89.14.0/24
206.161.46.0/24
200
206.161.47.0/24
Updated
19
Concepts
Next-hop
set by EBGP speaker or policy
AS 109
150.10.0.0/16
100.100.100.0
.1
.2
AS 173
B
Updated
20
Concepts
Next-hop Issue
.3
AS 173
Router B
Updated
Router C
21
Concepts
Next-hop Issue
.3
AS 173
Router B
Updated
Router C
22
Concepts
Next-hop Issue
Router B:
protocol bgp {
group BGP-to-router-A {
export chg-nexthop;
}
EBGP
}
policy-options policy-statement chg-nexthop {
from protocol bgp;
then next-hop self;
AS 173
}
AS 109
.1
100.100.100.0/24
.2
Router B
Updated
.3
Router C
23
Concepts
Local Preference
AS 200
AS 666
AS 180
Where to 200 ??
AS 173
Updated
24
Concepts
Local Preference
AS 200
AS 666
AS 180
bgp {
group EXTERNAL {
type external;
peer-as 666
local-preference 100;
neighbor 1.1.1.1;
}
}
Updated
AS 173
25
Concepts
Multi-Exit Discriminator (MED)
32-bit, non-negative
Affects
Advertised
Lower
Updated
to external neighbors
26
Concepts
Multi-Exit Discriminator (MED)
AS 666
AS 200
AS 1800
AS 1988
AS 2000
AS 173
Updated
27
Concepts
Multi-Exit Discriminator (MED)
Router A:
bgp {
group EXTERNAL {
type external;
neighbor 1.1.1.1 {
export MED;
peer-as 666;
}
}
}
Updated
policy-statement MED {
from as-path via-200;
then {
metric 200;
accept;
}
}
as-path via-200 ".* 200";
28
Concepts
Multi-Exit Discriminator (MED)
AS 666
AS 200
AS 1800
AS 1988
AS 2000
AS 173
Updated
29
Concepts
Origin
Updated
30
Concepts
Atomic Aggregate
Used
More
BGP speaker
Updated
31
Concepts
Aggregator (6-bytes)
Last AS
IP address
Updated
32
Concepts
Route Reflector and Confederation
Scaling
Updated
33
Concepts
Route Reflector RFC 1966
Acting
Updated
34
Concepts
Route Reflector
IBGP
AS300
EBGP
EBGP
IBGP
IBGP
AS100
IBGP
IBGP
IBGP
AS200
IBGP
IBGP
EBGP
AS300
RR
EBGP
non-client
AS100
IBGP
client
Updated
AS200
IBGP
client
35
Concepts
Route Reflector
Loop
Prevention
Originator
ID
If the attribute originator ID has not been created in the
attribute of the route, the RR will create this attribute
The content of originator ID is the router ID of the IBGP peer
that pass this route to the RR
Updated
36
Concepts
Route Reflector
Loop
Prevention
Cluster
list
When the RR reflect the route to other peers, it will prepend its
cluster ID within the cluster list
Updated
37
Concepts
Confederation RFC 1965
Scale
Updated
38
Concepts
Confederation
IBGP
IBGP
EBGP
IBGP
IBGP
IBGP
AS100
IBGP
IBGP
IBGP
EBGP
IBGP
EBGP
AS200
AS65500
IBGP
IBGP
AS100
IBGP
IBGP
IBGP
AS65501
AS200
Updated
39
Summary
BGP Concept
BGP Operation
Route
Control
Configuration
Trouble-shooting
Juniper
Updated
vs. Cisco
40
Updated
41
BGP Header
0
1
2
3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
+
+
|
|
+
+
|
Marker
|
+
+
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
Length
|
Type
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Updated
42
Updated
43
Optional Parameters
Authentication
Information (type 1)
0 1 2 3 4 5 6 7 8
+-+-+-+-+-+-+-+-+
| Auth. Code
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
Authentication Data
|
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Updated
44
NOTIFICATION Message
0
1
2
3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Error code
| Error subcode |
Data
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
|
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1 = HRD Error
2 = OPEN Error
3= UPDATE Error
4 = Hold Time Expired
5 = FSM Error
6 = Cease(for fatal errors
listed)
Updated
45
UPDATE Message
+-----------------------------------------------------+
|
Unfeasible Routes Length (2 octets)
|
+-----------------------------------------------------+
| Withdrawn Routes (variable)
|
+-----------------------------------------------------+
|
Total Path Attribute Length (2 octets)
|
+-----------------------------------------------------+
|
Path Attributes (variable)
|
+-----------------------------------------------------+
|
Network Layer Reachability Information (variable) |
+-----------------------------------------------------+
0
1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Attr. Flags |Attr. Type Code|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Updated
+---------------------------+
|
Length (1 octet)
|
+---------------------------+
|
Prefix (variable)
|
+---------------------------+
46
BGP Operation
BGP-4 Message Exchange
BGPPeers
TCP
BGP
Idle
Connect
Initializing
OpenSent
OpenConfirm
Established
Updated
SynSent
Established
Open
KeepAlive
Update
TCP
syn
Syn +Ack
Ack
BGP
Listen
SynReceived
Established
Open
KeepAlive
Update
Idle
Connect
Initializing
OpenSent
OpenConfirm
Established
47
BGP Operation
BGP-4 FSM
Idle
1
2
3
4
Connect
6
12
5
11
OpenSent
9
10
Active
13
OpenConfirm
14
15
Established
Updated
16
48
BGP Operation
Current
State
New
State
Event
Idle
Idle
Connect
1). Error
2). Start
Connect
Idle
Connect
Open Sent
3).
4).
5).
6).
Active
Updated
Idle
Open Confirm
Active
8). No Errors
9). Disconnect Notification
49
BGP Operation
Current
State
New
State
Event
Active
Open Sent
Connect
Active
Idle
Established
Updated
Idle
Established
15). Keepalive
Idle
50
Summary
BGP Concept
BGP Operation
Route
Control
Configuration
Trouble-shooting
Juniper
Updated
vs. Cisco
51
Route Control
Route Selection
Updated
52
Route Control
Policy Control
Import
/ Export Policy
Communities
AS path
Route filtering
Updated
53
Route Control
Used
Used
Global
Updated
54
Route Control
policies:
bgp {
import global-import-policy-here;
export global-export-policy-here;
group testing-policy {
import group-import-policy-here;
export group-export-policy-here;
neighbor 1.1.1.1 {
import neighbor-import-policy-here;
export neighbor-export-policy-here;
}
}
}
Updated
55
Route Control
Check
Updated
56
Route Control
Community
Well-known
community
no-advertise
Do not advertise to neighbors
no-export
Do not advertise outside your confederation/AS
no-export-subconfed Do not advertise outside your subconfederation
Define
Community
Updated
57
Route Control
AS Path
AS
{m,n}
{m}
{m,}
*
+
?
|
Updated
58
Route Control
Route filtering
Filtering
Updated
59
Route Control
Route filtering
Matching
criteria
+ as-path
+ community
local-preference
+ neighbor
Origin
> prefix-list
> route-filter
Updated
60
Route Control
Route filtering
Matching AS
Path
policy-statement filtering {
from as-path testing-as-path;
then accept;
}
as-path testing-as-path ".* 200";
Updated
61
Route Control
Route filtering
Matching
Community string
policy-statement filtering {
from community testing-community;
then accept;
}
community testing-community members 100:200;
Updated
62
Route Control
Route filtering
Matching
route entry
policy-statement filtering {
from route-filter 100.100.0.0/16 orlonger;
then accept;
}
Updated
63
Route Control
Route filtering
Matching
prefix-list route-list {
100.100.0.0/16;
100.110.0.0/16;
100.120.0.0/16;
}
policy-statement filtering {
from prefix-list route-list;
then accept;
}
Updated
64
Summary
BGP Concept
BGP Operation
Route
Control
Configuration
Trouble-shooting
Juniper
Updated
vs. Cisco
65
Configuration
BGP minimum
configuration
[routing-options]
autonomous-system <your own AS>;
[protocol bgp]
group BGP-setup {
type [external | internal];
peer-as <peers AS>;
neighbor <peer IP address>;
}
Updated
66
Configuration
Example
[protocol bgp]
group BGP-setup {
type external;
peer-as 100;
neighbor 100.1.1.2;
}
[routing-options]
autonomous-system 200;
Updated
67
Configuration
Set
the local-preference
[protocol bgp]
group BGP-setup {
type external;
local-preference 100;
peer-as 100;
neighbor 100.1.1.2;
}
Set
the MED
[protocol bgp]
group BGP-setup {
type external;
metric-out 200;
local-preference 100;
peer-as 100;
neighbor 100.1.1.2;
}
Updated
68
Configuration
Change
the origin
[protocol policy-options]
policy-statement change-origin {
from protocol aggregate;
then {
origin incomplete;
accept;
}
}
[protocol bgp]
group BGP-setup {
type external;
export change-origin;
peer-as 100;
neighbor 100.1.1.2;
}
Updated
69
Configuration
AS-prepend
[policy-options]
policy-statement as-prepend {
from protocol aggregate;
then {
as-path-prepend 300 300 300";
accept;
}
}
[protocol bgp]
group BGP-setup {
type external;
export as-prepend;
peer-as 100;
neighbor 100.1.1.2;
}
Updated
70
Configuration
Attach
community
[protocol bgp]
group BGP-setup {
type external;
export att-community;
peer-as 100;
neighbor 100.1.1.2;
}
[policy-options]
policy-statement att-community {
then {
community set send-community;
}
}
community send-community members [ 100:10 200:10 ];
Updated
71
Configuration
Route
Reflector
[protocol bgp]
group RR-client {
type internal;
cluster 100.1.1.1;
neighbor 100.1.1.2;
neighbor 100.1.1.3;
}
group non-client {
type internal;
neighbor 10.1.1.2;
}
group EBGP {
type external;
peer-as 100;
neighbor 192.168.1.2;
}
Updated
72
Configuration
Confederation
[routing-options]
autonomous-system 65000;
confederation 200 members [ 65000 65001 ];
[protocol bgp]
group confe {
type external;
peer-as 65001;
neighbor 100.1.1.2;
}
Updated
73
Configuration
Advertise
summary network
[routing-options]
aggregate {
route 202.168.0.0/17 discard;
}
[policy-options]
policy-statement adv-summary {
from protocol aggregate;
then accept;
}
[protocol bgp]
group BGP-setup {
type external;
export adv-summary;
peer-as 100;
neighbor 100.1.1.2;
}
Updated
74
Configuration
Advertise
[policy-options]
policy-statement adv-ospf {
from protocol ospf;
then accept;
}
[protocol bgp]
group BGP-setup {
type external;
export adv-ospf;
peer-as 100;
neighbor 100.1.1.2;
}
Updated
75
Summary
BGP concepts
BGP Operation
Route
Control
Configuration
Trouble-shooting
Juniper
Updated
vs. Cisco
76
Trouble-shooting
Checking
Updated
77
Trouble-shooting
Enable traceoption
[protocol bgp]
traceoptions {
file bgp-trace;
flag packets detail;
flag open detail;
}
Updated
78
Trouble-shooting
Monitoring
root@router> monitor start bgp-trace
*** bgp-trace ***
Nov 10 14:53:50
Nov 10 14:53:50 BGP RECV 100.1.1.2+1113 -> 100.1.1.1+179
Nov 10 14:53:50 BGP RECV message type 1 (Open) length 45
Nov 10 14:53:50 BGP RECV version 4 as 65001 holdtime 90 id 192.168.1.2 parmlen 16
Nov 10 14:53:50 MP capability AFI=1, SAFI=1
Nov 10 14:53:50 Refresh capability, code=128
Nov 10 14:53:50 Refresh capability, code=2
Nov 10 14:53:50 bgp_pp_recv: dropping 100.1.1.2 (External AS 65001), connection collision prefers
100.1.1.2+1113 (proto)
Nov 10 14:53:50 bgp_send: sending 45 bytes to 100.1.1.2 (External AS 65001)
Nov 10 14:53:50
Nov 10 14:53:50 BGP SEND 100.1.1.1+179 -> 100.1.1.2+1113
Nov 10 14:53:50 BGP SEND message type 1 (Open) length 45
Updated
79
Trouble-shooting
Monitoring
Nov 10 14:53:50 BGP SEND version 4 as 65000 holdtime 90 id 192.168.1.1 parmlen 16
Nov 10 14:53:50 MP capability AFI=1, SAFI=1
Nov 10 14:53:50 Refresh capability, code=128
Nov 10 14:53:50 Refresh capability, code=2
Nov 10 14:53:50 bgp_send: sending 19 bytes to 100.1.1.2 (External AS 65001)
Nov 10 14:53:50
Nov 10 14:53:50 BGP SEND 100.1.1.1+179 -> 100.1.1.2+1113
Nov 10 14:53:50 BGP SEND message type 4 (KeepAlive) length 19
Nov 10 14:53:50
Nov 10 14:53:50 BGP RECV 100.1.1.2+1113 -> 100.1.1.1+179
Nov 10 14:53:50 BGP RECV message type 3 (Notification) length 21
Nov 10 14:53:50 BGP RECV Notification code 2 (Open Message Error) subcode 2 (bad peer AS
number)
Updated
80
Trouble-shooting
Configuration
Near end
[routing-options]
autonomous-system 65000;
confederation 200 members [ 65000 65001 65002 ];
[protocol bgp]
Far End
group bgp-demo {
[routing-options]
type external;
autonomous-system 65001;
peer-as 65001;
confederation 200 members [ 65000 65001 65002 ];
neighbor 100.1.1.2;
[protocol bgp]
}
admin@Jessie# show protocols bgp
group testing {
type external;
peer-as 65002;
neighbor 100.1.1.1;
}
Updated
81
Trouble-shooting
Logged
result:
Stop
logging:
Updated
82
Trouble-shooting
Other
problem
Peer AS mis-configured
Updated
83
Trouble-shooting
Problem
Report
show
bgp summary
show bgp neighbor
show bgp group
show version
show configuration
Updated
84
Summary
BGP concepts
BGP Operation
Route
Control
Configuration
Trouble-shooting
Juniper
Updated
vs. Cisco
85
Updated
Cisco:
interface Loopback0
ip address 192.168.1.254 255.255.255.255
!
interface Ethernet0
ip address 172.27.4.173 255.255.255.0
!
router bgp 200
neighbor 192.168.1.3 remote-as 100
neighbor 192.168.1.3 ebgp-multihop 255
neighbor 192.168.1.3 update-source Loopback0
!
Juniper
Cisco
86
Updated
87
Updated
88
Updated
89
Updated
90
Updated
91
Cisco
no synchronization
bgp damping
bgp confederation
bgp cluster-id
Updated
92
Thank you!
http://www.juniper.net