2.BGP 2
2.BGP 2
Part 1
IP routing
table
Peers
Routes Export
RIB-OUT Routes sent to
used policy BGP peers
IP routing
table
Peers
Routes Export
RIB-OUT Routes sent to
used policy BGP peers
IP routing
table
0.0.0.0/0 :AS3 AS 2
172.31.10.0/20
172.31.10.0/20 :Local Aggregate
192.168.14.0/24
192.168.14.0/24 :AS1
(metric = 10)
192.168.27.0/24 :AS3
192.168.27.0/24
© 2013 Juniper Networks, Inc. All rights reserved. www.juniper.net | 6
How BGP Uses Next Hop
user@R1>
AS 1 AS 2
R1 .1 10.10.1/24 .2 R2
192.168.10.1/32 172.16.20.1/32
10.100.100.0/24
172.16.30.1 2 I
10.101.101.0/24
172.16.30.1 2 I
10.102.102.0/24
172.16.30.1 2 I
[edit]
user@R1# show policy-options
policy-statement next-hop-to-peer-address {
term all-bgp-routes {
then {
next-hop peer-address;
}
}
}
[edit]
user@R1# show protocols
bgp {
group ext {
type external;
multihop {
ttl 2;
}
local-address 192.168.10.1;
import next-hop-to-peer-address;
peer-as 2;
neighbor 172.16.20.1;
}
}
© 2013 Juniper Networks, Inc. All rights reserved. www.juniper.net | 17
Peer Address Next-Hop Policy (3 of 3)
user@R1> show route protocol bgp extensive
Export Direct:
192.168.14.0/24
Export Statics:
10.0.0.0/8
172.16.0.0/16 EBGP
192.168.27.0/24 Export IGP: To other AS:
10.20.0.0/16 10.0.0.0/8 : Origin IGP
10.20.0.0/16 : Origin IGP
172.16.0.0/16 : Origin IGP
172.31.0.0/24 : Origin ?
192.168.14.0/24 : Origin IGP
From other AS
192.168.27.0/24 : Origin IGP
172.31.0.0/24 : Origin ?
© 2013 Juniper Networks, Inc. All rights reserved. www.juniper.net | 20
Origin Example (1 of 2)
AS 30 AS 3
AS 1
AS 20 AS 2
AS 30 AS 3
AS 1
AS 20 AS 2 ?
© 2013 Juniper Networks, Inc. All rights reserved. www.juniper.net | 22
Changing the Origin Code
[edit protocols]
bgp {
export change-all-igps;
}
© 2013 Juniper Networks, Inc. All rights reserved. www.juniper.net | 23
Multiple Exit Discriminator
AS 1
(10.10.0.0/16 nearby) (10.20.0.0/16 nearby)
R1 R2
R3 Acme R4
MED=200
192.168.13.0/24 advertised
MED=120
from all three routers
AS 3 R3
R1
10.10.10.1
10.10.10.2
172.17.63/24 MED=100
172.17.4/24 MED=160
192.168.16.0/20 MED=0
192.168.17.0/24 MED=10
192.168.17.0/24 MED=10
user@router> show route protocol bgp
AS 30 AS 3
1I
AS 1
AS 20 AS 2 11111I
[edit protocols]
bgp {
group peer-AS2 {
type external;
export longer-as-path;
peer-as 2;
neighbor 10.10.10.2;
}
}
[edit policy-options]
policy-statement longer-as-path {
then as-path-prepend “1 1 1 1”;
}
policy-statement from-not-a-good-route {
term not-good {
from as-path not-a-good-route;
then reject;
}
}
[edit protocols]
bgp {
import from-not-a-good-route;
}
10.200.0.0/16
172.31.0.0/16: 1 172.31.0.0/16: 1
AS 2 192.168.14/24: 1
192.168.14/24: 1 10.200.0.0/16: 2
AS 1
AS 4
172.31.0.0/16: 1
10.100.0.0/16: 3
192.168.14/24: 1
10.100.0.0/16 172.31.0.0/16: 3 1
192.168.14/24: 3 1
AS 3 172.31.0.0/16: 1
192.168.14/24: 1
AS 1
192.168.48.0/24
192.168.17.0/24 192.168.49.0/24 IBGP
192.168.50.0/24
EBGP 192.168.51.0/24
R1 R2
EBGP
policy-options {
policy-statement not-a-transit {
term accept-my-as {
from { 10.222.11.1
protocol bgp;
as-path my-own-as;
}
then accept;
}
term reject-all-else {
then reject;
}
}
}
as-path my-own-as "()";
bgp {
export not-a-transit;
}
AS 1
192.168.48.0/24
192.168.17.0/24 192.168.49.0/24 IBGP
192.168.50.0/24
EBGP 192.168.51.0/24
R1 R2
EBGP
user@R2> show route protocol bgp terse
inet.0: 43 destinations, 43 routes (43 active, 0 holddown, 0 hidden) 10.222.11.1
A Destination P Prf Metric 1 Metric 2 Next hop AS path
* 192.168.17.0/24 B 170 100 5 >10.40.40.1 1 I
* 192.168.48.0/24 B 170 100 5 >10.40.40.1 I
* 192.168.49.0/24 B 170 100 5 >10.40.40.1 I
* 192.168.50.0/24 B 170 100 5 >10.40.40.1 I
* 192.168.51.0/24 B 170 100 10 >10.40.40.1 I
user@R2> show route advertising-protocol bgp 10.222.11.1
inet.0: 43 destinations, 43 routes (43 active, 0 holddown, 0 hidden)
Prefix Nexthop MED Lclpref AS path
192.168.48.0/24 192.168.48.1 5 100 I
192.168.49.0/24 192.168.48.1 5 100 I
192.168.50.0/24 192.168.48.1 5 100 I
192.168.51.0/24 192.168.48.1 10 100 I