BGP-4 Case Studies: Nenad Krajnovic
BGP-4 Case Studies: Nenad Krajnovic
Case Studies
Nenad Krajnovic
e-mail: [email protected]
Today topics
2
Load balancing over multiple links
3
load balancing over multiple links
Loopback Interface 0
172.16.50.1
Loopback Interface 0
1.1.1.1 172.16.1.1
1.1.1.2
192.168.4.0/24
1.1.2.1 1.1.2.2 172.16.4.0/24
1.1.3.1 1.1.3.2
AS 65100 AS 65300
4
load balancing over multiple links
7
multihomed to a single provider - default only, one primary and one backup link
AS 10
192.168.4.0/24 E0
192.168.1.1 E0 IBGP
192.168.1.4 E0
1.1.2.1 S0 1.1.1.1 S0
X2
X1
ÑAS30 is not learning any BGP routes from
1.1.2.2 S1 AS10 and is sending its own routes via BGP.
1.1.1.2 S0 ÑOutbound traffic from AS30 should always
go on the X1 link unless that link fails, in
which case it should switch to the other link.
172.18.23.0/24 E0
ÑInbound traffic toward AS30 should always
come on the X1 link unless that link fails, in
AS 30 which case is should switch to the other link.
ÑPrevent any BGP updates from coming into
AS3.
8
multihomed to a single provider - default only, one primary and one backup link
AS 10
192.168.4.0/24 E0
192.168.1.1 E0 IBGP
192.168.1.4 E0
1.1.2.1 S0 1.1.1.1 S0
X2 router bgp 30
X1
network 172.18.23.0 mask 255.255.255.0
neighbor 1.1.2.1 remote-as 10
1.1.2.2 S1
1.1.1.2 S0 neighbor 1.1.2.1 route-map BLOCK in
neighbor 1.1.2.1 route-map SETMETRIC1 out
neighbor 1.1.1.1 remote-as 10
172.18.23.0/24 E0
neighbor 1.1.1.1 route-map BLOCK in
neighbor 1.1.1.1 route-map SETMETRIC2 out
AS 30 no auto-summary
!
ip route 0.0.0.0 0.0.0.0 1.1.1.1 40
ip route 0.0.0.0 0.0.0.0 1.1.2.1 60
!
route-map SETMETRIC1 permit 10
set metric 100
!
route-map SETMETRIC2 permit 10
set metric 50
!
route-map BLOCK deny 10
9
multihomed to a single provider - default only, one primary and one backup link
AS 10
192.168.4.0/24 E0
192.168.1.1 E0 IBGP
192.168.1.4 E0
1.1.2.1 S0 1.1.1.1 S0
X2
X1
router# show ip bgp
1.1.2.2 S1
BGP table version 11, local router ID is 192.168.1.4
1.1.1.2 S0 Status codes: s suppressed, d damped, h history, * valid, > best,
i - internal Origin codes: i - IGP, e - EGP, ? - incomplete
172.18.23.0/24 E0
Network Next Hop Metric LocPrf Weight
Path
AS 30
*>i 172.18.23.0/24 192.168.1.4 50 100 0 3i
* 1.1.2.1 100 0 3i
*> 192.168.4.0/24 0.0.0.0 0 32768 i
router# show ip route
192.68.40.1 193.78.0.0/16
AS 6 NAP
192.68.11.2
AS 7
AS 1
192.68.11.1 192.68.10.1
192.68.6.2 IBGP
192.68.6.1
172.16.20.1 192.68.5.2
X2 X1
172.16.20.2 S0 192.68.5.1
172.16.1.1 E1 IBGP
172.16.1.2 E1
172.16.220.1 E0
172.16.10.1
172.16.2.254 L0
172.16.65.1
AS 3
11
192.68.40.1 193.78.0.0/16
X2
X1
172.16.20.2 S0 192.68.5.1
172.16.1.1 E1 IBGP
172.16.1.2 E1
172.16.220.1 E0
172.16.10.1
172.16.2.254 L0
172.16.65.1
AS 3
Routing policies
AS3 will only accept AS1’s local routes and its customers’ routes
such as AS6. AS3 will also accept one route from the Internet to set
its default toward the provider AS1.
For all outbound traffic toward AS1 and AS6 (the partial routes),
AS3 should use the X2 link. In case of failure, the other link is used.
!For all other outbound traffic toward the Internet, AS3 should use
the X1 link as the primary link by following a default route. In case
of failure, the default via other link should be used.
"For inbound traffic, AS3 will instruct AS1 to use the X2 link for
172.16.220.0/24.
#For all other inbound traffic, the X1 link is the primary. 12
multihomed to a single provider - default, primary and backup plus partial routing
router bgp 3
192.68.40.1 193.78.0.0/16 no sunchronization
network 172.16.1.0 mask 255.255.255.0
AS 6
192.68.11.2
NAP network 172.16.10.0 mask 255.255.255.0
AS 7 network 172.16.65.0 mask 255.255.255.192
AS 1
192.68.11.1 192.68.10.1 network 172.16.220.0 mask 255.255.255.0
192.68.6.2 IBGP neighbor 172.16.1.2 remote-as 3
192.68.6.1
192.68.5.2
neighbor 172.16.1.2 update-source loopback0
172.16.20.1
neighbor 172.16.1.2 next-hop-self
X2 neighbor 172.16.20.1 remote-as 1
X1
172.16.20.2 S0 192.68.5.1
neighbor 172.16.20.1 route-map SET_OUTBOUND_TRAFFIC in
172.16.1.1 E1 IBGP neighbor 172.16.20.1 route-map SET_INBOUND_TRAFFIC out
172.16.1.2 E1
172.16.220.1 E0 neighbor 172.16.20.1 filter-list 10 out
172.16.10.1
172.16.2.254 L0
172.16.65.1
no auto-summary
AS 3 !
ip route 0.0.0.0 0.0.0.0 193.78.0.0
ip as-path access-list 10 permit ^$
ip as-path access-list 4 permit ^1 6$
ip as-path access-list 4 permit ^1$
access-list 2 permit 172.16.220.0 0.0.0.255
access-list 101 permit ip 193.78.0.0 0.0.255.255 255.255.0.0 0.0.0.0
!
route-map SET_OUTBOUND_TRAFFIC permit 10
match ip address 101
set local-preference 200
route-map SET_OUTBOUND_TRAFFIC permit 20
match as-path 4
set local-preference 300
!
route-map SET_INBOUND_TRAFFIC permit 10
match ip address 2
set local-preference 200
route-map SET_INBOUND_TRAFFIC permit 20
set metric 300
13
multihomed to a single provider - default, primary and backup plus partial routing
192.68.40.1 193.78.0.0/16 router bgp 3
no sunchronization
AS 6 NAP network 172.16.1.0 mask 255.255.255.0
192.68.11.2
AS 7 network 172.16.10.0 mask 255.255.255.0
AS 1 network 172.16.65.0 mask 255.255.255.192
192.68.11.1 192.68.10.1
192.68.6.2 IBGP network 172.16.220.0 mask 255.255.255.0
192.68.6.1 neighbor 172.16.2.254 remote-as 3
172.16.20.1 192.68.5.2
neighbor 172.16.2.254 next-hop-self
X2 neighbor 192.68.5.2 remote-as 1
X1
neighbor 192.68.5.2 route-map SET_OUTBOUND_TRAFFIC in
172.16.20.2 S0 192.68.5.1
172.16.1.1 E1 IBGP neighbor 192.68.5.2 route-map SET_INBOUND_TRAFFIC out
172.16.220.1 E0
172.16.1.2 E1 neighbor 192.68.5.2 filter-list 10 out
172.16.10.1 no auto-summary
172.16.2.254 L0
172.16.65.1
AS 3 !
ip route 0.0.0.0 0.0.0.0 193.78.0.0
!
ip as-path access-list 10 permit ^$
ip as-path access-list 4 permit ^1 6$
! ip as-path access-list ^1 ?[0-9]*$
ip as_path access-list 4 permit ^1$
!
access-list 101 permit ip 193.78.0.0 0.0.255.255 255.255.0.0 0.0.0.0
!
route-map SET_OUTBOUND_TRAFFIC permit 10
match ip address 101
set local-preference 250
!
route-map SET_OUTBOUND_TRAFFIC permit 20
match as-path 4
set local-preference 250
!
route-map SET_INBOUND_TRAFFIC permit 10
set metric 250
14
multihomed to a single provider - automatic load balancing
AS 1
192.68.11.1
192.68.6.2 IBGP
192.68.6.1
172.16.20.1 172.16.60.1
X2 X1
172.16.20.2 S0
172.16.60.2 IBGP
RTA 172.16.1.1 E1
172.16.1.2
172.16.10.1
172.16.2.254 L0
AS 3
15
multihomed to a single provider - automatic load balancing
192.68.40.1
router bgp 3
no sunchronization AS 6
192.68.11.2
neighbor 172.16.1.2 remote-as 3
neighbor 172.16.1.2 update-source AS 1
192.68.11.1
loopback0 192.68.6.2 IBGP
neighbor 172.16.20.1 remote-as 1 192.68.6.1
172.16.20.1
neighbor 172.16.20.1 filter-list 10 out 172.16.60.1
17
multihomed to different provider
193.78.0.0/16
192.68.40.1
Route
192.68.10.2 Server
AS 6 AS 7 NAP
192.68.10.4
192.68.11.1 192.68.10.1
AS 1 192.68.10.3
192.68.6.1 AS 2
172.16.20.1 192.68.5.2
X2 X1
172.16.20.2 S0 192.68.5.1
172.16.1.1 E1 IBGP
172.16.1.2 E1
172.16.220.1 E0
172.16.10.1
172.16.2.254 L0
255.255.255.255 172.16.65.1
AS 3
18
193.78.0.0/16
multihomed to different provider 192.68.40.1
Route
192.68.10.2 Server
AS 6 AS 7 NAP
192.68.10.4
192.68.11.1 192.68.10.1
AS 1 192.68.10.3
192.68.6.1 AS 2
172.16.20.1 192.68.5.2
X2 X1
172.16.20.2 S0 192.68.5.1
172.16.1.1 E1 IBGP
172.16.1.2 E1
172.16.220.1 E0
172.16.10.1
172.16.2.254 L0
255.255.255.255 172.16.65.1
AS 3
Routing policies
AS3 will be accepting AS1’s local and customer routes only via
the X2 link. All other Internet routes will be accepted via the X1 link
(primary).
AS3 will accept a default route from AS1 just in case there is a
failure in the X1 link.
!AS3 prefers that the network 172.16.220.0/24 be reachable by the
outside world via the X2 link, and networks 172.16.10.0/24 and
172.16.65.0/26 be reachable via the X1 link.
"AS3 cannot be a transit network for A1 and AS2, which means
that under no circumstances will AS1 use AS3 to reach AS2. 19
multihomed to different provider
193.78.0.0/16
router bgp 3 192.68.40.1
Route
192.68.10.2 Server
no sunchronization AS 6
network 172.16.1.0 mask 255.255.255.0 AS 7 NAP
192.68.10.4
network 172.16.10.0 mask 255.255.255.0
network 172.16.65.0 mask 255.255.255.192
192.68.11.1 192.68.10.1
network 172.16.220.0 mask 255.255.255.0
neighbor 172.16.1.2 remote-as 3 192.68.10.3 AS 2
neighbor 172.16.1.2 update-source Loopback0
AS 1 192.68.6.1
172.16.20.1 192.68.5.2
neighbor 172.16.1.2 next-hop-self
neighbor 172.16.20.1 remote-as 1 X1
neighbor 172.16.20.1 route-map ACCEPT_ALL in X2
neighbor 172.16.20.1 route-map PREPEND_PATH out 172.16.20.2 S0 192.68.5.1
172.16.1.1 E1 IBGP
no auto-summary
172.16.1.2 E1
! 172.16.220.1 E0
172.16.10.1
ip as-path access-list 1 permit ^1 ?[0-9]*$ 172.16.2.254 L0
172.16.65.1
255.255.255.255 AS 3
ip as-path access-list 2 permit ^$
!
access-list 1 permit 172.16.65.0 0.0.0.63
access-list 1 permit 172.16.10.0 0.0.0.255
access-list 10 permit 0.0.0.0
!
route-map PREPEND_PATH permit 10
match ip address 1
set as-path prepend 3 3 3
!
route-map PREPEND_PATH permit 20
match as-path 2
!
route-map ACCEPT_LOCAL permit 10
match ip address 10
set local-preference 50
!
route-map ACCEPT_LOCAL permit 20
match as-path 1 20
multihomed to different provider
193.78.0.0/16
192.68.40.1
Route router bgp 3
192.68.10.2 Server no sunchronization
AS 6 network 172.16.1.0 mask 255.255.255.0
AS 7 NAP
192.68.10.4
network 172.16.10.0 mask 255.255.255.0
network 172.16.65.0 mask 255.255.255.192
192.68.11.1 192.68.10.1
network 172.16.220.0 mask 255.255.255.0
AS 1 192.68.10.3
192.68.6.1 AS 2 neighbor 172.16.2.254 remote-as 3
172.16.20.1 192.68.5.2 neighbor 172.16.2.254 next-hop-self
neighbor 192.68.5.2 remote-as 1
X2 X1
neighbor 192.68.5.2 route-map PREPEND_PATH out
172.16.20.2 S0 192.68.5.1
172.16.1.1 E1 IBGP no auto-summary
172.16.220.1 E0
172.16.1.2 E1 !
172.16.2.254 L0
172.16.10.1 ip as-path access-list 2 permit ^$
172.16.65.1
255.255.255.255 AS 3 !
access-list 1 permit 172.16.220.0 0.0.0.255
!
route-map PREPEND_PATH permit 10
match ip address 1
set as-path prepend 3 3 3
!
route-map PREPEND_PATH permit 20
match as-path 2
21
multihomed to different provider - customers of the same provider with a backup link
192.68.40.1
AS 6 AS 7 NAP
172.16.10.4
172.16.10.1
172.16.1.1
IBGP
172.16.1.2
172.16.220.1 192.68.5.1
172.16.2.254 L0
172.16.20.2 255.255.255.255 172.16.65.1
AS 3
X2 X1
172.16.20.1 192.68.5.2
AS 1 192.68.6.1
AS 2
192.68.6.2
192.68.11.1 192.68.6.1
22
multihomed to different provider - customers of the same provider with a backup link
192.68.40.1
AS 6 AS 7 NAP
172.16.10.4
172.16.10.1
172.16.1.1
IBGP
172.16.1.2
172.16.220.1 192.68.5.1
172.16.2.254 L0
172.16.20.2 255.255.255.255 172.16.65.1
AS 3
X2
X1
172.16.20.1 192.68.5.2
AS 1 192.68.6.1
AS 2
192.68.6.2
192.68.11.1 192.68.6.1
Routing policies
In normal condition, AS1 and AS2 will use the private link only
for traffic between AS1 and AS2; for all other Internet traffic, the
direct link to the provider AS3 is used.
AS1 and AS2 agree to use each other as backup in case their links
to AS3 fail. 23
multihomed to different provider - customers of the same provider with a backup link
192.68.40.1
AS 6 AS 7 NAP
172.16.10.4
router bgp 1
network 192.168.11.0 mask 255.255.255.0 172.16.10.1
IBGP
neighbor 172.16.20.2 remote-as 3 172.16.1.1
172.16.1.2
neighbor 172.16.20.2 route-map PREF_FROM_AS3 in 172.16.220.1
172.16.2.254 L0
192.68.5.1
24
multihomed to different provider - customers of the same provider with a backup link
192.68.40.1
AS 6
AS 7 NAP
172.16.10.4
172.16.10.1
172.16.1.1
IBGP
172.16.1.2
172.16.220.1 192.68.5.1
172.16.2.254 L0
172.16.20.2 255.255.255.255 172.16.65.1
AS 3
X2
X1
172.16.20.1 192.68.5.2
AS 1 192.68.6.1
router# show ip bgp 192.68.6.2
AS 2
172.16.2.254 L0 172.16.65.1
255.255.255.255 172.16.10.1
172.16.1.1
AS 4 172.16.1.2
172.16.220.1 AS 3
192.68.5.1
172.16.20.2
X2 X1
172.16.20.1 192.68.5.2
AS 1 192.68.6.1
AS 2
192.68.6.2
192.68.11.1 192.68.10.1
26
multihomed to different provider - customers of different providers with a backup link
172.16.2.254 L0 172.16.65.1
255.255.255.255 172.16.10.1
172.16.1.1
AS 4 172.16.1.2
172.16.220.1 AS 3
192.68.5.1
172.16.20.2
X2 X1
172.16.20.1 192.68.5.2
AS 1 192.68.6.1
AS 2
192.68.6.2
192.68.11.1 192.68.10.1
Routing policies
In normal condition, AS1 and AS2 will use the private link only
for traffic between AS1 and AS2; for all other Internet traffic, both
customers would like to go out via their direct providers, AS1 via
AS4 and AS2 via AS3
In case the private link goes down, the customers should be able to
talk to one another via the providers. If a link to the provider fails,
the other customer should be used to reach the Internet. 27
multihomed to different provider - customers of different providers with a backup link
router bgp 4
network 172.16.220.0 mask 255.255.255.0
neighbor 172.16.1.2 remote-as 3
neighbor 172.16.1.2 route-map CHECK_COMMUNITY in
neighbor 172.16.20.1 remote-as 1
neighbor 172.16.20.1 route-map CHECK_COMMUNITY in
no auto-summary
!
ip community-list 2 permit 4:40
ip community-list 3 permit 4:60
! 172.16.2.254 L0 172.16.65.1
route-map CHECK_COMMUNITY permit 10 255.255.255.255 172.16.10.1
172.16.1.1
match community 2 AS 4 172.16.1.2
set local-preference 40
172.16.220.1 AS 3
192.68.5.1
172.16.20.2
!
route-map CHECK_COMMUNITY permit 20
X2
match community 3 X1
set local-preference 60
! 172.16.20.1 192.68.5.2
route-map CHECK_COMMUNITY permit 30 AS 1 192.68.6.1
AS 2
set local-preference 100 192.68.6.2
192.68.11.1 192.68.10.1
router bgp 1
network 192.68.11.0 mask 255.255.255.0
neighbor 172.16.20.2 remote-as 4
neighbor 172.16.20.2 send-community
neighbor 172.16.20.2 route-map SETCOMMUNITY out
neighbor 172.16.20.2 filter-list 10 out
neighbor 192.68.6.1 remote-as 2
no auto-summary 172.16.2.254 L0 172.16.65.1
255.255.255.255 172.16.10.1
! 172.16.1.1
ip as-path access-list 2 permit _2_ AS 4 172.16.1.2
ip as-path access-list 10 permit ^$
172.16.220.1 AS 3
192.68.5.1
172.16.20.2
ip as-path access-list 10 permit ^2$
! X2
route-map SETCOMMUNITY permit 10 X1
match as-path 2
set community 4:40 172.16.20.1 192.68.5.2
AS 1 192.68.6.1
! AS 2
route-map SETCOMMUNITY permit 20 192.68.6.2
192.68.11.1 192.68.10.1
router bgp 3
network 172.16.10.0 mask 255.255.255.0
network 172.16.65.0 mask 255.255.255.192
neighbor 172.16.1.1 remote-as 4
neighbor 172.16.1.1 send-community
neighbor 172.16.1.1 route-map setcommunity out
neighbor 192.68.5.2 remote-as 2
no auto-summary
!
route-map setcommunity permit 10
set community 4:60
172.16.2.254 L0 172.16.65.1
255.255.255.255 172.16.10.1
172.16.1.1
AS 4 172.16.1.2
172.16.220.1 AS 3
192.68.5.1
172.16.20.2
X2
X1
172.16.20.1 192.68.5.2
AS 1 192.68.6.1
AS 2
192.68.6.2
192.68.11.1 192.68.10.1
172.16.2.254 L0 172.16.65.1
255.255.255.255 172.16.10.1
172.16.1.1
AS 4 172.16.1.2
172.16.220.1 AS 3
192.68.5.1
172.16.20.2
X2
X1
172.16.20.1 192.68.5.2
AS 1 192.68.6.1
AS 2
192.68.6.2
192.68.11.1 192.68.10.1
router bgp 1
network 192.68.11.0 mask 255.255.255.0
neighbor 172.16.20.2 remote-as 4
neighbor 172.16.20.2 route-map setpath out
neighbor 172.16.20.2 filter-list 10 out
neighbor 192.68.6.1 remote-as 2
no auto-summary
! 172.16.2.254 L0 172.16.65.1
255.255.255.255 172.16.10.1
ip as-path access-list 2 permit _2_ 172.16.1.1
ip as-path access-list 10 permit ^$ AS 4 172.16.1.2
ip as-path access-list 10 permit ^2$
172.16.220.1 AS 3
192.68.5.1
172.16.20.2
!
route-map setpath permit 10 X2
match as-path 2 X1
set as-path prepend 1
! 172.16.20.1 192.68.5.2
AS 1 192.68.6.1
route-map setpath permit 20 AS 2
192.68.6.2
192.68.11.1 192.68.10.1
172.16.2.254 L0 172.16.65.1
255.255.255.255 172.16.10.1
172.16.1.1
AS 4 172.16.1.2
172.16.220.1 AS 3
192.68.5.1
172.16.20.2
X2
X1
172.16.20.1 192.68.5.2
AS 1 192.68.6.1
AS 2
192.68.6.2
192.68.11.1 192.68.10.1
34
following defaults inside an AS
AS 7
192.68.11.1 192.68.10.1
AS 1 192.68.10.3 AS 2
172.16.20.1 192.68.5.2
X2 X1
172.16.20.2
172.16.1.1 IBGP AS 3 192.68.5.1
172.16.1.2
172.16.220.1 172.16.50.1
172.16.70.1
IGP RTG IGP
172.16.70.2 172.16.50.2
35
following defaults inside an AS 192.68.10.2
NAP 193.78.0.0/16
AS 7
192.68.11.1 192.68.10.1
AS 1 192.68.10.3 AS 2
172.16.20.1 192.68.5.2
X2 X1
172.16.20.2
172.16.1.1 IBGP AS 3 192.68.5.1
172.16.1.2
172.16.220.1 172.16.50.1
172.16.70.1
IGP RTG IGP
172.16.70.2 172.16.50.2
Routing policies
RTG is an interior router in AS3 that is running an OSPF; RTG is
following the default route 0/0 to reach networks outside AS3
AS3 is multihomed to two different providers.
36
following defaults inside an AS
router ospf 16
passive-interface Serial0
network 172.16.0.0 0.0.255.255 area 0
default-information originate always
!
router bgp 3
192.68.10.2
no synchronization
network 172.16.1.0 mask 255.255.255.0 NAP
network 172.16.70.0 mask 255.255.255.0 193.78.0.0/16
network 172.16.220.0 mask 255.255.255.0
neighbor 172.16.20.1 remote-as 1 AS 7
neighbor 172.16.20.1 filter-list 10 out
192.68.11.1 192.68.10.1
neighbor 172.16.1.2 remote-as 3
no auto-summary
! AS 1 192.68.10.3 AS 2
ip as-path access-list 10 permit ^$ 172.16.20.1 192.68.5.2
X2 X1
172.16.20.2
172.16.1.1 IBGP AS 3 192.68.5.1
172.16.1.2
172.16.220.1 172.16.50.1
172.16.70.1
IGP RTG IGP
172.16.70.2 172.16.50.2
37
following defaults inside an AS
192.68.10.2
router ospf 16
NAP 193.78.0.0/16 passive-interface Serial0
network 172.16.0.0 0.0.255.255 area 0
AS 7 default-information originate always
192.68.11.1 192.68.10.1 !
router bgp 3
AS 1 192.68.10.3 AS 2 no synchronization
172.16.20.1 192.68.5.2 network 172.16.1.0 mask 255.255.255.0
network 172.16.50.0 mask 255.255.255.0
X2 X1 neighbor 172.16.1.1 remote-as 1
neighbor 172.16.1.1 next-hop-self
172.16.20.2
172.16.1.1 IBGP AS 3 192.68.5.1
neighbor 172.16.5.2 remote-as 2
172.16.220.1
172.16.1.2
172.16.50.1 neighbor 172.16.5.2 filter-list 10 out
172.16.70.1 no auto-summary
IGP RTG IGP
172.16.70.2 !
172.16.50.2
ip as-path access-list 10 permit ^$
router ospf 16
network 172.16.0.0 0.0.255.255 area 0
38
following defaults inside an AS
NAP 193.78.0.0/16
AS 7
192.68.11.1 192.68.10.1
AS 1 192.68.10.3 AS 2
172.16.20.1 192.68.5.2
X2 X1
172.16.20.2
IBGP AS 3 192.68.5.1
172.16.220.1 172.16.50.1
172.16.70.1
IGP RTG IGP
172.16.70.2 172.16.50.2
39
following defaults inside an AS
router ospf 16
passive-interface Serial0
network 172.16.0.0 0.0.255.255 area 0
default-information originate route-map send_default
!
router bgp 3
no synchronization
network 172.16.70.0 mask 255.255.255.0
network 172.16.220.0 mask 255.255.255.0 192.68.10.2
neighbor 172.16.20.1 remote-as 1
neighbor 172.16.20.1 filter-list 10 out
NAP 193.78.0.0/16
neighbor 172.16.50.1 remote-as 3
neighbor 172.16.50.1 route-map setlocalpref in AS 7
no auto-summary
! 192.68.11.1 192.68.10.1
ip as-path access-list 10 permit ^$
! AS 1 192.68.10.3 AS 2
access-list 1 permit 0.0.0.0 172.16.20.1 192.68.5.2
access-list 2 permit 172.16.20.1
!
route-map setlocalpref permit 10 X2 X1
set local-preference 300
!
172.16.20.2
IBGP AS 3 192.68.5.1
40
following defaults inside an AS
192.68.10.2
router ospf 16
network 172.16.0.0 0.0.255.255 area 0
41
Policy routing
42
policy routing
192.68.11.1 192.68.10.1
192.68.6.2 192.68.6.1
AS 1 AS 2
172.16.20.1
172.16.80.2
X2 X1
172.16.20.2 172.16.80.1 172.16.10.1
172.16.220.1 172.16.50.1
172.16.70.1 172.16.112.1
IGP IGP AS 3
172.16.70.2 172.16.50.2
Routing policies
Traffic from network 172.16.10.0/24 is directed toward AS2, over
X1 link.
Traffic from network 172.16.112.0/24 is directed toward AS1 over
X2 link; in case of a link failure to AS1, the traffic will go to AS2.
!For all other source IP address, follow normal routing.
43
policy routing 192.68.11.1 192.68.10.1
192.68.6.2 192.68.6.1
AS 1 AS 2
172.16.20.1
172.16.80.2
X2 X1
172.16.20.2 172.16.80.1 172.16.10.1
172.16.220.1 172.16.50.1
172.16.70.1 172.16.112.1
IGP IGP AS 3
172.16.70.2 172.16.50.2
Equipment:
45
lab example 1
AS 10
192.168.4.0/24 E0
192.168.1.1 S1 IBGP
192.168.1.2 S1
1.1.2.1 S0 1.1.1.1 S0
X2
X1
ÑAS30 is not learning any BGP routes from
1.1.2.2 S1 AS10 and is sending its own routes via BGP.
1.1.1.2 S0 ÑOutbound traffic from AS30 should always
go on the X1 link unless that link fails, in
which case it should switch to the other link.
172.18.23.0/24 E0
ÑInbound traffic toward AS30 should always
come on the X1 link unless that link fails, in
AS 30 which case is should switch to the other link.
ÑPrevent any BGP updates from coming into
AS3.
46
lab example 1 AS 10
192.168.4.0/24 E0
192.168.1.1 S1 IBGP
192.168.1.2 S1
1.1.2.1 S0 1.1.1.1 S0
X2
X1
1.1.2.2 S1
1.1.1.2 S0
172.18.23.0/24 E0
AS 30
1.1.2.2 S1
1.1.1.2 S0
interface ethernet 0
172.18.23.0/24 E0
ip address 192.168.4.1 255.255.255.0
!
interface serial 0
AS 30 ip address 1.1.2.1 255.255.255.0
!
interface serial 1
ip address 192.168.1.1 255.255.255.0
!
router bgp 10
network 192.168.0.0 mask 255.255.0.0
neighbor 1.1.2.2 remote-as 30
neighbor 192.168.1.2 remote-as 10
no auto-summary
48
lab example 1
AS 10
192.168.4.0/24 E0
192.168.1.1 S1 IBGP
192.168.1.2 S1
1.1.2.1 S0 1.1.1.1 S0
X2
X1
1.1.2.2 S1
1.1.1.2 S0
interface serial 0
172.18.23.0/24 E0
ip address 1.1.1.1 255.255.255.0
!
interface serial 1
AS 30 ip address 192.168.1.2 255.255.255.0
!
router bgp 10
network 192.168.0.0 mask 255.255.0.0
network 1.1.1.0 mask 255.255.255.0
neighbor 1.1.1.2 remote-as 30
neighbor 192.168.1.1 remote-as 10
no auto-summary
49
lab example 2-a
172.18.3.1 E0
RTA
192.168.1.1 S1 IBGP RTB
192.168.1.2 S1
1.1.2.1 S0 1.1.1.1 S0
172.18.2.1 E0
X1
X2
RTC AS 10
1.1.2.2 S1
1.1.1.2 S0
172.18.23.1 E0
Routing policies
Traffic to the Internet should go toward 172.18.2.10.
IBGP is running between RTA and RTB; IGP is running between
RTB and RTC. 50
lab example 2-a
interface ethernet 0 172.18.3.1 E0
ip address 172.18.2.1 255.255.255.0 RTA
192.168.1.1 S1 IBGP RTB
! 192.168.1.2 S1
interface serial 0 1.1.2.1 S0 1.1.1.1 S0
172.18.2.1 E0
ip address 1.1.2.1 255.255.255.0
X1
clockrate 64000 X2
interface serial 1 RTC AS 10
1.1.2.2 S1
ip address 192.168.1.1 255.255.255.0 1.1.1.2 S0
clockrate 6400
172.18.23.1 E0
!
router bgp 10
no synchronization
network 172.18.2.0 mask 255.255.255.0
network 1.1.0.0 mask 255.255.252.0
neighbor 192.168.1.2 remote-as 10
neighbor 192.168.1.2 next-hop-self
redistribute static route-map default_only
no auto-summary
!
ip route 0.0.0.0 0.0.0.0 172.18.2.1 40
access-list 1 permit 0.0.0.0
!
route-map default_only permit 10
match ip address 1
set local-preference 300
route-map default_only deny 20 51
lab example 2-a interface ethernet 0
ip address 172.18.3.1 255.255.255.0
!
172.18.3.1 E0 interface serial 0
RTA
192.168.1.1 S1 IBGP RTB ip address 1.1.1.1 255.255.255.0
192.168.1.2 S1
!
1.1.2.1 S0 1.1.1.1 S0
172.18.2.1 E0 interface serial 1
X1 ip address 192.168.1.2 255.255.255.0
X2 !
RTC AS 10
1.1.2.2 S1 router bgp 10
1.1.1.2 S0
no synchronization
172.18.23.1 E0 network 172.18.3.0 mask 255.255.255.0
network 1.1.0.0 mask 255.255.252.0
neighbor 192.168.1.1 remote-as 10
neighbor 192.168.1.1 next-hop-self
no auto-summary
!
router ospf 16
network 1.1.0.0 0.0.3.255 area 0
default-originate route-map def-only
!
access-list 1 permit 0.0.0.0
!
route-map def_only permit 10
match ip address 1
52
lab example 2-a
172.18.3.1 E0
RTA
192.168.1.1 S1 IBGP RTB
192.168.1.2 S1
1.1.2.1 S0 1.1.1.1 S0
172.18.2.1 E0
X1
X2
RTC AS 10
1.1.2.2 S1
1.1.1.2 S0
172.18.23.1 E0
interface ethernet 0
ip address 172.18.23.1 255.255.255.0
!
interface serial 0
ip address 1.1.1.2 255.255.255.0
!
interface serial 1
ip address 1.1.2.2 255.255.255.0
!
router ospf 16
network 1.1.0.0 0.0.3.255 area 0 53
lab example 2-b
172.18.3.1 E0
RTA
IBGP RTB
1.1.2.1 S0 1.1.1.1 S0
172.18.2.1 E0
X1
X2
RTC AS 10
1.1.2.2 S1
1.1.1.2 S0
172.18.23.1 E0
Routing policies
Traffic to the Internet should go toward 172.18.2.10.
IBGP is running between RTA and RTB; IGP is running between
RTB and RTC. 54
lab example 2-b
interface ethernet 0
ip address 172.18.2.1 255.255.255.0 172.18.3.1 E0
RTA
! IBGP RTB
interface serial 0
1.1.2.1 S0 1.1.1.1 S0
ip address 1.1.2.1 255.255.255.0 172.18.2.1 E0
clockrate 64000 X1
! X2
router bgp 10 RTC AS 10
1.1.2.2 S1
no synchronization 1.1.1.2 S0
network 172.18.2.0 mask 255.255.255.0
network 1.1.0.0 mask 255.255.252.0 172.18.23.1 E0
55
lab example 2-b interface ethernet 0
ip address 172.18.3.1 255.255.255.0
!
interface serial 0
ip address 1.1.1.1 255.255.255.0
!
172.18.3.1 E0
RTA router bgp 10
IBGP RTB
no synchronization
1.1.2.1 S0 1.1.1.1 S0 network 172.18.3.0 mask 255.255.255.0
172.18.2.1 E0
network 1.1.0.0 mask 255.255.252.0
X1 neighbor 1.1.2.1 remote-as 10
X2
RTC AS 10 neighbor 1.1.2.1 next-hop-self
1.1.2.2 S1
1.1.1.2 S0 no auto-summary
!
172.18.23.1 E0 router ospf 16
network 1.1.0.0 0.0.3.255 area 0
default-originate route-map def-only
!
access-list 1 permit 0.0.0.0
!
route-map def_only permit 10
match ip address 1
56
lab example 2-b
172.18.3.1 E0
RTA RTB
IBGP
1.1.2.1 S0 1.1.1.1 S0
172.18.2.1 E0
X1
X2
RTC AS 10
1.1.2.2 S1
1.1.1.2 S0
172.18.23.1 E0
interface ethernet 0
ip address 172.18.23.1 255.255.255.0
!
interface serial 0
ip address 1.1.1.2 255.255.255.0
!
interface serial 1
ip address 1.1.2.2 255.255.255.0
!
router ospf 16
network 1.1.0.0 0.0.3.255 area 0 57
lab example 3
Loopback Interface 0
172.16.50.1
Loopback Interface 0
1.1.1.1 S0 1.1.1.2 S0 172.16.1.1
192.168.4.1 E0
1.1.2.2 S1
172.16.4.1 E0
1.1.2.1 S1
AS 65100 AS 65300
58
lab example 3
interface ethernet 0
ip address 192.168.4.1 255.255.255.0
!
interface serial 0
ip address 1.1.1.1 255.255.255.0
Loopback Interface 0
clockrate 64000
172.16.50.1
Loopback Interface 0 !
172.16.1.1
192.168.4.1 E0
1.1.1.1 S0 1.1.1.2 S0
interface serial 1
1.1.2.2 S1
1.1.2.1 S1
172.16.4.1 E0 ip address 1.1.2.1 255.255.255.0
AS 65100 AS 65300
clockrate 64000
!
Interface loopback 0
ip address 172.16.50.1 255.255.255.0
!
router bgp 65100
network 192.168.4.0 mask 255.255.255.0
network 172.16.50.0 mask 255.255.255.0
neighbor 172.16.1.1 remote-as 65300
neighbor 172.16.1.1 ebgp-multihop
neighbor 172.16.1.1 update-source loopback 0
no auto-summary
!
ip route 172.16.1.1 255.255.255.255 1.1.1.2 3
ip route 172.16.1.1 255.255.255.255 1.1.2.2 3
59
lab example 3
interface ethernet 0
ip address 172.16.4.1 255.255.255.0
!
interface serial 0
ip address 1.1.1.2 255.255.255.0
Loopback Interface 0
!
172.16.50.1
Loopback Interface 0 interface serial 1
172.16.1.1
192.168.4.1 E0
1.1.1.1 S0 1.1.1.2 S0
ip address 1.1.2.2 255.255.255.0
1.1.2.2 S1
1.1.2.1 S1
172.16.4.1 E0 !
AS 65100 AS 65300
Interface loopback 0
ip address 172.16.1.1 255.255.255.0
!
router bgp 65300
network 172.16.4.0 mask 255.255.255.0
network 172.16.1.0 mask 255.255.255.0
neighbor 172.16.50.1 remote-as 65100
neighbor 172.16.50.1 ebgp-multihop
neighbor 172.16.50.1 update-source loopback 0
no auto-summary
!
ip route 172.16.50.1 255.255.255.255 1.1.1.1 3
ip route 172.16.50.1 255.255.255.255 1.1.2.1 3
60