BGP
BGP
BGP
4-1
Copyright 2005 Juniper Networks, Inc.
www.juniper.net
BGP Operation
BGP stores routes in three main routing information
base (RIB) memory tables
Local Preference
Often used to set the exit point from an autonomous
system
Only exchanged within the confines of a single AS
(1-byte) Attribute type
(Variable) Attribute length
(4-byte) Local preference value
AS Path
Collection of autonomous system numbers through
which the route has passed
Used to prevent routing loops
Used to select an active BGP path
(2-byte) Attribute type
(Variable) Attribute length
(Variable) AS path segments
Origin
Measure of believability set by the originating BGP
router
Internal (0) > External (1) > Incomplete (2)
JUNOS software sets all injected routes to Internal
(2-byte) Attribute type
(1-byte) Attribute length
(1-byte) Origin
10
AS Path Selection
user@host> show route 192.168.48/24 detail
inet.0: 52 destinations, 94 routes (52 active, 0 holddown, 0 hidden)
192.168.48.0/24 (3 entries, 1 announced)
*BGP
Preference: 170/-101
Source: 192.168.16.1
Next hop: 10.222.44.1 via fe-0/0/0.0, selected
Protocol next hop: 192.168.16.1 Indirect next hop: 85d8270 46
State: <Active Int Ext>
Local AS: 65432 Peer AS: 65432
Age: 3:41
Metric2: 3
Task: BGP_65432.192.168.16.1+179
AS path: 65000 I
Localpref: 100
Router ID: 192.168.16.1
BGP
Preference: 170/-101
Source: 10.222.45.1
Next hop: 10.222.45.1 via so-0/3/0.0, selected
State: <Ext>
Inactive reason: AS path
Local AS: 65432 Peer AS: 65000
Age: 25
Task: BGP_65000.10.222.45.1+1064
AS path: 65000 65000 65000 I
---(more)---
11
Origin Selection
user@host> show route 192.168.48/24 detail
inet.0: 52 destinations, 74 routes (52 active, 0 holddown, 0 hidden)
192.168.48.0/24 (2 entries, 1 announced)
*BGP
Preference: 170/-101
Source: 10.222.6.1
Next hop: 10.222.6.1 via fe-0/0/1.0, selected
State: <Active Ext>
Local AS: 65432 Peer AS: 65000
Age: 1:29
Metric: 20
Task: BGP_65000.10.222.6.1+1084
AS path: 65000 I
Localpref: 100
Router ID: 192.168.48.1
BGP
Preference: 170/-101
Source: 10.222.45.1
Next hop: 10.222.45.1 via so-0/3/0.0, selected
State: <Ext>
Inactive reason: Origin
Local AS: 65432 Peer AS: 65000
Age: 53
Task: BGP_65000.10.222.45.1+1064
AS path: 65000 ?
Localpref: 100
---(more)---
12
MED Selection
user@host> show route 192.168.48/24 detail
inet.0: 52 destinations, 94 routes (52 active, 0 holddown, 0 hidden)
192.168.48.0/24 (3 entries, 1 announced)
*BGP
Preference: 170/-101
Source: 192.168.16.1
Next hop: 10.222.44.1 via fe-0/0/0.0, selected
Protocol next hop: 192.168.16.1 Indirect next hop: 85d8270 46
State: <Active Int Ext>
Local AS: 65432 Peer AS: 65432
Age: 9:53
Metric: 5
Metric2: 3
Task: BGP_65432.192.168.16.1+179
AS path: 65000 I
Localpref: 100
Router ID: 192.168.16.1
BGP
Preference: 170/-101
Source: 10.222.45.1
Next hop: 10.222.45.1 via so-0/3/0.0, selected
State: <NotBest Ext>
Inactive reason: Not Best in its group
Local AS: 65432 Peer AS: 65000
Age: 2:21
Metric: 20
Task: BGP_65000.10.222.45.1+1064
AS path: 65000 I
---(more)---
13
14
15
16
Router ID Selection
user@host> show route 192.168.48/24 detail
inet.0: 52 destinations, 94 routes (52 active, 0 holddown, 0 hidden)
192.168.48.0/24 (3 entries, 1 announced)
*BGP
Preference: 170/-101
Source: 10.222.29.2
Next hop: 10.222.29.2 via ge-0/1/0.0, selected
State: <Active Ext>
Local AS: 65432 Peer AS: 65000
Age: 10
Task: BGP_65000.10.222.29.2+179
AS path: 65000 I
Localpref: 100
Router ID: 192.168.20.1
BGP
Preference: 170/-101
Source: 10.222.5.2
Next hop: 10.222.5.2 via fe-0/0/2.0, selected
State: <NotBest Ext>
Inactive reason: Router ID
Local AS: 65432 Peer AS: 65000
Task: BGP_65000.10.222.5.2+1067
AS path: 65000 I
Localpref: 100
Router ID: 192.168.52.1
---(more 66%)---
17
Peer ID Selection
user@host> show route 192.168.48/24 detail
inet.0: 64 destinations, 106 routes (64 active, 0 holddown, 0 hidden)
192.168.48.0/24 (3 entries, 1 announced)
*BGP
Preference: 170/-101
Source: 10.222.5.2
Next hop: 10.222.5.2 via fe-0/0/2.0, selected
State: <Active Ext>
Local AS: 65432 Peer AS: 65000
Age: 30
Task: BGP_65000.10.222.5.2+1073
AS path: 65000 I
Localpref: 100
Router ID: 192.168.52.1
BGP
Preference: 170/-101
Source: 10.222.15.2
Next hop: 10.222.15.2 via fe-0/0/2.1, selected
State: <NotBest Ext>
Inactive reason: Update source
Local AS: 65432 Peer AS: 65000
Task: BGP_65000.10.222.15.2+179
AS path: 65000 I
Localpref: 100
Router ID: 192.168.52.1
---(more 51%)---
18
10.10.1.2/24
10.10.1.1/24
(AS1)
10.10.2.2/24
10.10.2.1/24
Las Vegas
(AS2)
19
BGP Multipath (1 of 3)
BGP can ignore both router ID and peer ID
comparisons when multipath is configured within
BGP
Can use:
Los Angeles
(AS1)
10.222.28.1/24
10.222.29.1/24
10.222.28.2/24
Las Vegas
(AS2)
Reno
10.222.29.2/24
OutQ
0
0
(AS2)
BGP Multipath (2 of 3)
Routes from each peer contain a single next hop
user@host> show route protocol bgp terse
inet.0: 15 destinations, 19 routes (15 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
A Destination
P Prf
Metric 1
* 172.16.20.4/30
B 170
100
>10.222.28.2
2 I
B 170
100
>10.222.29.2
2 I
B 170
100
>10.222.28.2
2 I
B 170
100
>10.222.29.2
2 I
B 170
100
>10.222.28.2
2 I
B 170
100
>10.222.29.2
2 I
B 170
100
>10.222.28.2
2 I
B 170
100
>10.222.29.2
2 I
* 172.16.20.8/30
* 172.16.20.12/30
* 172.16.20.16/30
Metric 2
Next hop
AS path
21
BGP Multipath (3 of 3)
Peer group on Los Angeles configured with
multipath
Active route receives two next hops
Forwarding table still maintains a single next hop per route
user@host> show route protocol bgp terse
inet.0: 15 destinations, 19 routes (15 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
A Destination
* 172.16.20.4/30
P Prf
B 170
Metric 1
100
* 172.16.20.8/30
B 170
B 170
100
100
* 172.16.20.12/30
B 170
B 170
100
100
* 172.16.20.16/30
B 170
B 170
100
100
B 170
100
Metric 2
Next hop
>10.222.28.2
10.222.29.2
>10.222.29.2
>10.222.28.2
10.222.29.2
>10.222.29.2
>10.222.28.2
10.222.29.2
>10.222.29.2
10.222.28.2
>10.222.29.2
>10.222.29.2
AS path
2 I
2 I
2 I
2 I
2 I
2 I
2 I
2 I
22
Multihop Peering
EBGP sessions can peer with nonphysical addresses
lo0: 192.168.3.4
lo0: 172.16.128.1
Los Angeles
10.10.1.2/24
10.10.1.1/24
(AS1)
10.10.2.2/24
10.10.2.1/24
Las Vegas
(AS2)
23
P Prf
B 170
Metric 1
100
B 170
100
Metric 2
Next hop
>10.10.1.1
10.10.2.1
>10.10.2.1
AS path
2 I
2 I
172.16.20.4/30
24
Load Balancing
user@host> show configuration policy-options policy-statement load-balance
then {
load-balance per-packet;
}
user@host> show configuration routing-options forwarding-table
export load-balance;
user@host> show route 172.16.20.4/30 terse
inet.0: 15 destinations, 19 routes (15 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
A Destination
* 172.16.20.4/30
P Prf
B 170
Metric 1
100
B 170
100
Metric 2
Next hop
>10.10.1.1
10.10.2.1
>10.10.2.1
AS path
2 I
2 I
25
AS 65001
AS 65002
LSP
Hong Kong
192.168.16.1
San Jose
192.168.20.1
Montreal
192.168.40.1
Amsterdam
192.168.32.1
26
27
If you use multihop and the keyword, no-nexthopchange, you can change default
The next-hop value is the address of the IBGP peer that first
advertised the route
user@Montreal> show route advertising-protocol bgp 192.168.20.1
inet.0: 14 destinations, 16 routes (14 active, 0 holddown, 1 hidden)
Prefix
Nexthop
MED
Lclpref
AS path
* 172.16.1.0/24
Self
65003 I
[edit protocols bgp group ext-peers]
user@Montreal# set neighbor 192.168.20.1 multihop no-nexthop-change
user@Montreal> show route advertising-protocol bgp 192.168.20.1
inet.0: 14 destinations, 16 routes (14 active, 0 holddown, 1 hidden)
Prefix
Nexthop
MED
Lclpref
AS path
* 172.16.1.0/24
192.168.32.1
65003 I
2008 Juniper Networks, Inc. All rights reserved.
28
29
30
31
32
Graceful Restart
A BGP router can negotiate with peers to maintain its
announced routes during a restart
Neighbors continue forwarding traffic to the router
Neighbors do not withdraw the routes of the restarting router
33
AS 65003
192.168.19.0/24
local-preference
user@host> show route advertising-protocol bgp 192.168.40.1
inet.0: 14 destinations, 15 routes (14 active, 0 holddown, 0 hidden)
Restart Complete
Prefix
Nexthop
MED
Lclpref
AS path
* 192.168.19.0/24
Self
0
100
65003 I
[edit]
user@host# set protocols bgp group int-peers local-preference 300
34
192.168.19.0/24: 1000
remove-private
AS 1000
192.168.17.0/24: 65001
192.168.18.0/24: 65002
192.168.19.0/24: 65003
AS 65001
AS 65002
AS 65003
192.168.17.0/24
192.168.18.0/24
192.168.19.0/24
35
172.16.10.0/24: 1 222
Internet
172.16.12.0/24: 1 333
AS 1
172.16.10.0/24: 222
AS 222
172.16.10.0/24
172.16.12.0/24: 333
AS 333
172.16.12.0/24
36
172.16.10.0/24: 222
Internet
172.16.12.0/24: 333
AS 222
AS 333
172.16.10.0/24
172.16.12.0/24
37
local-as 1 private
172.16.10.0/24: 222
Internet
172.16.12.0/24: 333
AS 222
AS 333
172.16.10.0/24
172.16.12.0/24
38
AS 65022
AS 65022
10.222.4.1
172.16.10.0/24
AS 65432
as-override
user@AS65432> show route advertising-protocol bgp 10.222.4.2
inet.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden)
Prefix
Nexthop
MED
Lclpref
* 172.16.10.0/24
Self
AS path
65022 I
AS path
65022 I
AS path
65432 65432 I
39
AS 65022
172.16.10.0/24
AS 65432
AS 65022
[edit]
user@AS65022# set routing-options autonomous-system 65022 loops 2
AS path
65432 65022 I
40
metric-out
metric-out
metric-out
metric-out
10;
igp;
minimum-igp;
igp 5;
41
42