01 Implementing BGP Routing
01 Implementing BGP Routing
01 Implementing BGP Routing
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-1
• Describe BGP terminology
• Describe autonomous systems in BGP networks
• List the basic BGP configuration steps
• Explain how to enable the BGP routing process and enable the address
family under the BGP routing process
• Explain how to configure IBGP peering
• Explain how to configure EBGP peering
• Explain how to temporary disable a BGP peer
• Explain how to configure BGP authentication
• Explain the show command that is used to verify BGP peering
• Describe the network command that is used to announce local
networks to other BGP peers
• Describe the basic concepts of Cisco IOS XR routing policy language
(RPL)
• Explain the show commands that are used to verify BGP routes
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-2
• Autonomous system: A collection of networks under a single
administrative domain
• Interdomain routing: Routing between the customer and the service
provider
• Internal routing: Uses IGP protocol (RIP, OSPF, IS-IS, and so on) to
exchange routing information inside the autonomous system
• External routing: Uses EGP protocol (BGP) to exchange routes
between autonomous systems
• Two BGP implementations:
- Internal BGP (IBGP): When BGP is used inside an AS
- External BGP (EBGP): When BGP is used between autonomous systems
IBGP
AS 65001 EBGP 10.1.1.1 10.1.1.2
AS 65002
192.168.1.1 192.168.1.2
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-3
• An autonomous system (AS) is a collection of networks under a single
technical administration.
- 16-bit numbers (as of January 2009, 32-bit numbers are available)
- Ranging from 1 to 65535
- Private AS: 64512–65535
• The IANA allocates AS numbers.
• IGPs operate within an AS.
• BGP is used between autonomous systems.
• Access http://www.iana.org or http://bgp.he.net/ to check AS number
AS 65010 AS 65020
BGP
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-4
• BGP neighbors are not discovered; they must be configured manually.
• Configuration must be done on both sides of the connection.
• Both routers will attempt to connect to the other with a TCP session on
port number 179.
• EBGP peers are usually reachable through a directly connected link.
• IBGP peers are typically established between loopback interfaces.
- IGP ensures reachability of loopback addresses.
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-5
• A TCP-based session has no neighbor presence verification, except
when sending BGP traffic.
• An additional mechanism is needed.
- Keepalive BGP messages provide verification of neighbor existence.
- Keepalive messages are sent every 60 seconds (by default).
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-6
• IBGP session inside ASs
- Over IPv4
• IPv4 prefixes
- Over IPv6
• IPv6 prefixes
• EBGP session between ASs
- Over IPv4
• IPv4 prefixes
- Over IPv6
• IPv6 prefixes
AS 2 AS 3
IPv4
EBGP IBGP
IPv6
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-7
1. Enable the BGP process.
2. Enable address family for specific protocols.
3. Configure a BGP peer (internal or external).
4. Configure BGP peer authentication (optional).
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-8
router(config)#
router bgp as-number
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-9
• IOS/IOS XE
- address family IPv4 unicast – by default
- activate or deactivate peer under specific address family
• IOS XR
- address family must be enabled
- define address family per peer
AS 2 AS 3
IPv4
EBGP IBGP
IPv6
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-10
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2.0.0.1/32 3.0.0.2/32 3.0.0.1/32
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-11
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2.0.0.1/32 3.0.0.2/32 3.0.0.1/32
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-12
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2.0.0.1/32 3.0.0.2/32 3.0.0.1/32
RP/0/0/CPU0:ASBR2#
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-13
BGP neighbor states:
• Idle state
Established
- Start BGP process
- Initiates TCP connection with
configured peers
OpenConfirm
- Changes to Connected call state
• Active state OpenSent
- Router tries to establish another TCP
session
• If successful, changes to OpenSent
Connected Active
state
• If unsuccessful, changes to idle state
• Established state
- Peer sends update messages Idle
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-15
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2.0.0.1/32 3.0.0.2/32 3.0.0.1/32
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-16
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2.0.0.1/32 3.0.0.2/32 3.0.0.1/32
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-17
• IOS XR only
• Usually use for EBGP peer
• Powerful tool for route manipulation
- Prepend AS to AS path
- Set origin
- Set weight
- Set local-preference
- And so on…
• Easy to configure
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-18
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2.0.0.1/32 3.0.0.2/32 3.0.0.1/32
route-policy pass
pass
IOS XR
end-policy
!
router bgp 3
address-family ipv6 unicast
!
neighbor 202.0.23.1
remote-as 2
address-family ipv4 unicast
route-policy pass in
route-policy pass out
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-19
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2.0.0.1/32 3.0.0.2/32 3.0.0.1/32
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-20
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2000:2::1/128 2002:3::2/128 2002:3::1/128
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-21
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2000:2:0:0::1 2002:3:0:0::2 2002:3:0:0::1
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-22
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2.0.0.1/32 3.0.0.2/32 3.0.0.1/32
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-23
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2000:2:0:0::1 2002:3:0:0::2 2002:3:0:0::1
RP/0/0/CPU0:ASBR2#
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-24
1. Two Method to advertise local routes.
- Use the network command.
network and subnet mask must be exact same as local route
- Redistribute routes from other routing protocols.
2. Route policy for EBGP peers is mandatory.
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-25
AS 2 ASBR2 AS 3
ASBR1
2.2.2.2/32
EBGP
2001:2:2:2::2/128
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-26
AS 2 ASBR2 AS 3
ASBR1
2.2.2.2/32
EBGP
2001:2:2:2::2/128
RP/0/0/CPU0:ASBR2#
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-27
AS 2 ASBR2 AS 3
ASBR1
2.2.2.2/32
EBGP
2001:2:2:2::2/128
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-28
AS 2 ASBR2 AS 3
ASBR1
EBGP
22.22.22.22/32
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-29
AS 2 ASBR2 AS 3
ASBR1
EBGP
22.22.22.22/32
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-30
RP/0/0/CPU0:ASBR2#show route bgp
Tue May 9 05:19:09.743 UTC
B 2001:2:2:2::2/128
[20/0] via fe80::a8bb:ccff:fe00:1000, 00:09:28, GigabitEthernet0/0/0/0
RP/0/0/CPU0:ASBR2#
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-31
Summarization is called “aggregation” in BGP.
1. Aggregation creates summary routes (called “aggregates”) from
networks already in BGP table.
2. Individual networks can be announced or suppressed.
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-32
router(config-router)#
aggregate-address address-prefix mask
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-33
An alternative method to configure aggregation:
router(config-router)#
aggregate-address address-prefix mask summary-only
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-34
AS 2 ASBR2 AS 3
200.1.1.0/24 ASBR1
200.1.2.0/24 EBGP
200.1.3.0/24
200.1.4.0/24
200.1.0.0/16
interface Loopback200
ip address 200.1.1.1 255.255.255.0
ip address 200.1.2.1 255.255.255.0 secondary
ip address 200.1.3.1 255.255.255.0 secondary
ip address 200.1.4.1 255.255.255.0 secondary
!
router bgp 2
!
address-family ipv4
network 200.1.1.0 mask 255.255.255.0
network 200.1.2.0 mask 255.255.255.0
network 200.1.3.0 mask 255.255.255.0
network 200.1.4.0 mask 255.255.255.0
aggregate-address 200.1.0.0 255.255.0.0 summary-only
exit-address-family
!
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-35
RP/0/0/CPU0:ASBR2#show bgp ipv4 unicast
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 2.2.2.2/32 202.0.23.1 0 0 2 i
*> 22.22.22.22/32 202.0.23.1 0 0 2 ?
*> 200.1.0.0/16 202.0.23.1 0 0 2 i
*> 200.1.1.0/24 202.0.23.1 0 0 2 i
*> 200.1.2.0/24 202.0.23.1 0 0 2 i
*> 200.1.3.0/24 202.0.23.1 0 0 2 i
*> 200.1.4.0/24 202.0.23.1 0 0 2 i
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-36
• Neighbor authentication
- Using MD5 authentication (password)
- Using key chains
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-37
• BGP peers can be authenticated by using a password.
- MD5 hashing function is used on the password.
- Hash is sent to the BGP peer in open message.
- Password is not sent to peer.
• Both routers must be configured with the same password.
• Authenticating BGP peers prevents denial of service (DoS) attacks.
• MD5 authentication is used mostly for EBGP peers.
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-38
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2.0.0.1/32 3.0.0.2/32 3.0.0.1/32
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-39
AS 2 ASBR2 AS 3
P1
ASBR1
IPv4 EBGP IBGP
E0/0 Gi0/0/0/0 Gi0/0/0/1 E0/0
IPv6 Lo0 Lo0 Lo0
2.0.0.1/32 3.0.0.2/32 3.0.0.1/32
RP/0/0/CPU0:ASBR2#
RP/0/0/CPU0:ASBR2#
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-40
• To temporarily disable a BGP neighbor, use these commands:
router(config-router)#
router(config-router)# neighbor <ip-address> shutdown
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-41
• When policies change, the change takes effect immediately.
• The next time that a prefix or path is advertised or received,
the new policy is used. This can take a long time for all networks.
• You must trigger an update for immediate action.
Hard reset
clear bgp *
Soft reset
clear bgp ipv4 unicast 202.0.23.1 soft out
EBGP
© 2012 Cisco and/or its affiliates. All rights reserved. SPNGN2 v1.01—4-42