Presentation is loading. Please wait.

Presentation is loading. Please wait.

Border Gateway Protocol (BGP4)

Similar presentations


Presentation on theme: "Border Gateway Protocol (BGP4)"— Presentation transcript:

1 Border Gateway Protocol (BGP4)

2 Border Gateway Protocol (BGP)
Routing/Forwarding basics Building blocks Exercises BGP protocol basics BGP path attributes Best path computation

3 Border Gateway Protocol (BGP)...
Typical BGP topologies Routing Policy Exercises Redundancy/Load sharing Best current practices

4 Routing/Forwarding Basics

5 IP route lookup:Longest match routing
All 10/8 except 10.1/16 Packet: Destination IP address: R1 R4 R2 10/8 -> R3 10.1/16 -> R4 20/8 -> R5 30/8 -> R6 ….. R2’s IP routing table 10.1/16

6 IP route lookup: Longest match routing
All 10/8 except 10.1/16 Packet: Destination IP address: R1 R4 R2 10.1/16 10/8 -> R3 10.1/16 -> R4 20/8 -> R5 ….. R2’s IP routing table & FF.0.0.0 is equal to & FF.0.0.0 Match!

7 IP route lookup: Longest match routing
All 10/8 except 10.1/16 Packet: Destination IP address: R1 R4 R2 10.1/16 10/8 -> R3 10.1/16 -> R4 20/8 -> R5 ….. R2’s IP routing table & FF.FF.0.0 is equal to & FF.FF.0.0 Match as well!

8 IP route lookup: Longest match routing
All 10/8 except 10.1/16 Packet: Destination IP address: R1 R4 R2 10.1/16 10/8 -> R3 10.1/16 -> R4 20/8 -> R5 ….. R2’s IP routing table & FF.0.0.0 is equal to & FF.0.0.0 Does not match!

9 IP route lookup: Longest match routing
All 10/8 except 10.1/16 Packet: Destination IP address: R1 R4 R2 10.1/16 10/8 -> R3 10.1/16 -> R4 20/8 -> R5 ….. R2’s IP routing table Longest match, 16 bit netmask

10 IP route lookup: Longest match routing
default is /0 can handle it using the normal longest match algorithm matches everything. Always the shortest match.

11 Forwarding Uses the routing table built by routing protocols
Performs the lookup to find next-hop and outgoing interface Switches the packet with new encapsulation as per the outgoing interface

12 Building Blocks Autonomous System (AS) Types of Routes IGP/EGP DMZ
Policy Egress Ingress

13 Autonomous System (AS)
Collection of networks with same policy Single routing protocol Usually under single administrative control IGP to provide internal connectivity

14 Autonomous System(AS)...
Identified by ‘AS number’ Public & Private AS numbers Examples: Service provider Multi-homed customers Anyone needing policy discrimination

15 Routing flow and packet flow
egress announce accept AS2 AS 1 Routing flow announce accept For networks in AS1 and AS2 to communicate: AS1 must announce routes to AS2 AS2 must accept routes from AS1 AS2 must announce routes to AS1 AS1 must accept routes from AS2 ingress packet flow

16 Egress Traffic Packets exiting the network Based on
Route availability (what others send you) Route acceptance (what you accept from others) Policy and tuning (what you do with routes from others) Peering and transit agreements

17 Ingress Traffic Packets entering your network
Ingress traffic depends on: What information you send and to who Based on your addressing and ASes Based on others’ policy (what they accept from you and what they do with it)

18 Types of Routes Static Routes Connected Routes Interior Routes
configured manually Connected Routes created automatically when an interface is ‘up’ Interior Routes Routes within an AS Exterior Routes Routes exterior to AS

19 What Is an IGP? Interior Gateway Protocol Within an Autonomous System
Carries information about internal prefixes Examples—OSPF, ISIS, EIGRP…

20 What Is an EGP? Exterior Gateway Protocol
Used to convey routing information between ASes De-coupled from the IGP Current EGP is BGP4

21 Why Do We Need an EGP? Scaling to large network
Hierarchy Limit scope of failure Define administrative boundary Policy Control reachability to prefixes

22 Interior vs. Exterior Routing Protocols
Automatic discovery Generally trust your IGP routers Routes go to all IGP routers Exterior Specifically configured peers Connecting with outside networks Set administrative boundaries

23 Hierarchy of Routing Protocols
Local NAP FDDI Other ISP’s BGP4 BGP4/Static BGP4 / OSPF Customers BGP4

24 Demilitarized Zone (DMZ)
C DMZ Network AS 100 AS 101 B D E AS 102 Shared network between ASes

25 Addressing - ISP Need to reserve address space for its network.
Need to allocate address blocks to its customers. Need to take “growth” into consideration Upstream link address is allocated by upstream provider

26 BGP Basics Terminology Protocol Basics Messages General Operation
Peering relationships (EBGP/IBGP) Originating routes

27 Terminology Neighbor NLRI/Prefix Router-ID Route/Path
Configured BGP peer NLRI/Prefix NLRI - network layer reachability information Reachability information for a IP address & mask Router-ID Highest IP address configured on the router Route/Path NLRI advertised by a neighbor

28 Protocol Basics Routing protocol used between ASes Runs over TCP
Peering A C AS 100 AS 101 B D E Routing protocol used between ASes if you aren’t connected to multiple ASes, you don’t need BGP :) Runs over TCP Path vector protocol Incremental update AS 102

29 BGP Basics ... Each AS originates a set of NLRI
NLRI is exchanged between BGP peers Can have multiple paths for a given prefix Picks the best path and installs in the IP forwarding table Policies applied (through attributes) influences BGP path selection

30 BGP Peers AS 100 AS 101 AS 102 BGP speakers are called peers
/24 /24 B D E BGP speakers are called peers AS 102 Peers in different AS’s are called External Peers /24 eBGP TCP/IP Peer Connection Note: eBGP Peers normally should be directly connected.

31 BGP Peers AS 100 AS 101 AS 102 BGP speakers are called peers
/24 /24 B D E BGP speakers are called peers AS 102 Peers in the same AS are called Internal Peers /24 iBGP TCP/IP Peer Connection Note: iBGP Peers don’t have to be directly connected.

32 BGP Peers A C AS 100 AS 101 /24 /24 B D E BGP Peers exchange Update messages containing Network Layer Reachability Information (NLRI) AS 102 /24 BGP Update Messages

33 Configuring BGP Peers AS 101 AS 100 A B C D
eBGP TCP Connection A B /30 C D interface Serial 0 ip address router bgp 100 network mask neighbor remote-as 101 .2 /24 .1 .2 interface Serial 0 ip address router bgp 101 network mask neighbor remote-as 100 .1 .2 /24 .1 BGP Peering sessions are established using the BGP “neighbor” configuration command External (eBGP) is configured when AS numbers are different

34 Configuring BGP Peers AS 101 AS 100 A B C D
iBGP TCP Connection A B /30 C D interface Serial 1 ip address router bgp 101 network mask neighbor remote-as 101 interface Serial 1 ip address router bgp 101 network mask neighbor remote-as 101 .2 /24 .1 .2 .1 .2 /24 .1 BGP Peering sessions are established using the BGP “neighbor” configuration command External (eBGP) is configured when AS numbers are different Internal (iBGP) is configured when AS numbers are same

35 Configuring BGP Peers AS 100
iBGP TCP/IP Peer Connection C Each iBGP speaker must peer with every other iBGP speaker in the AS

36 Configuring BGP Peers AS 100
B A iBGP TCP/IP Peer Connection C Loopback interface are normally used as peer connection end-points

37 Configuring BGP Peers AS 100 B A A C iBGP TCP/IP Peer Connection
B A A interface loopback 0 ip address router bgp 100 network neighbor remote-as 100 neighbor update-source loopback0 neighbor remote-as 100 neighbor update-source loopback0 iBGP TCP/IP Peer Connection C

38 Configuring BGP Peers AS 100 B A A C iBGP TCP/IP Peer Connection
B A interface loopback 0 ip address router bgp 100 network neighbor remote-as 100 neighbor update-source loopback0 neighbor remote-as 100 neighbor update-source loopback0 A iBGP TCP/IP Peer Connection C

39 Configuring BGP Peers AS 100 B A A C iBGP TCP/IP Peer Connection
B A A iBGP TCP/IP Peer Connection C interface loopback 0 ip address router bgp 100 network neighbor remote-as 100 neighbor update-source loopback0 neighbor remote-as 100 neighbor update-source loopback0

40 BGP Updates — NLRI Network Layer Reachability Information
Used to advertise feasible routes Composed of: Network Prefix Mask Length

41 BGP Updates — Attributes
Used to convey information associated with NLRI AS path Next hop Local preference Multi-Exit Discriminator (MED) Community Origin Aggregator

42 AS-Path Attribute Sequence of ASes a route has traversed
Loop detection Apply policy AS 200 AS 100 /16 /16 Network Path / / AS 300 AS 400 /16 Network Path / / / AS 500

43 Next Hop Attribute Next hop to reach a network
AS 300 AS 200 /16 C /30 D /16 .1 .2 E B .2 Network Next-Hop Path / /30 .1 Next hop to reach a network Usually a local network is the next hop in eBGP session A AS 100 /16 BGP Update Messages

44 Next Hop Attribute Next hop to reach a network
AS 300 AS 200 /16 C /30 D /16 .1 .2 E Network Next-Hop Path / / B .2 Next hop to reach a network Usually a local network is the next hop in eBGP session /30 .1 A AS 100 /16 Next Hop updated between eBGP Peers BGP Update Messages

45 Next Hop Attribute Next hop not changed between iBGP peers AS 300
/16 C /30 D /16 .1 .2 E Network Next-Hop Path / / B .2 /30 Next hop not changed between iBGP peers .1 A AS 100 /16 BGP Update Messages

46 Next Hop Attribute (more)
IGP should carry route to next hops Recursive route look-up Unlinks BGP from actual physical topology Allows IGP to make intelligent forwarding decision

47 BGP Updates — Withdrawn Routes
Used to “withdraw” network reachability Each Withdrawn Route is composed of: Network Prefix Mask Length

48 BGP Updates — Withdrawn Routes
AS 321 AS 123 .1 /24 .2 BGP Update Message Withdraw Routes /24 x Connectivity lost /24 Network Next-Hop Path / /

49 BGP Routing Information Base
BGP RIB Network Next-Hop Path *>i / i *>i / i router bgp 100 network no auto-summary D /24 D /24 D /24 R /16 S /24 BGP ‘network’ commands are normally used to populate the BGP RIB with routes from the Route Table Route Table

50 BGP Routing Information Base
BGP RIB Network Next-Hop Path *> / i * i i s> / i s> / i router bgp 100 network aggregate-address summary-only no auto-summary D /24 D /24 D /24 R /16 S /24 BGP ‘aggregate-address’ commands may be used to install summary routes in the BGP RIB Route Table

51 BGP Routing Information Base
BGP RIB Network Next-Hop Path *> / i * i i s> / i s> / i *> / ? router bgp 100 network redistribute static route-map foo no auto-summary access-list 1 permit route-map foo permit 10 match ip address 1 D /24 D /24 D /24 R /16 S /24 BGP ‘redistribute’ commands can also be used to populate the BGP RIB with routes from the Route Table Route Table

52 BGP Routing Information Base
IN Process OUT Process BGP RIB Network Next-Hop Path *>i / i *>i / i Update Update * / > Network Next-Hop Path / BGP “in” process receives path information from peers results of BGP path selection placed in the BGP table “best path” flagged (denoted by “>”)

53 BGP Routing Information Base
IN Process OUT Process BGP RIB Network Next-Hop Path *>i / i *>i / i Update Update * > / Network Next-Hop Path / / / Next-Hop changed BGP “out” process builds update using info from RIB may modify update based on config Sends update to peers

54 BGP Routing Information Base
BGP RIB Network Next-Hop Path *>i / i *>i / i *> / D /24 D /24 D /24 R /16 S /24 Best paths installed in routing table if: prefix and prefix length are unique lowest “protocol distance” B /16 Route Table

55 The ‘Bible’ & other resources
Route-views.oregon-ix.net Internet Routing Architectures Bassam Halabi pg. 168 BGP Decision Process Summary

56 Types of BGP Messages OPEN UPDATE KEEPALIVE NOTIFICATION
To negotiate and establish peering UPDATE To exchange routing information KEEPALIVE To maintain peering session NOTIFICATION To report errors (results in session reset)

57 Internal BGP Peering (IBGP)
AS 100 A E B D BGP peer within the same AS Not required to be directly connected Maintain full IBGP mesh or use Route Reflection

58 External BGP Peering (EBGP)
AS 100 AS 101 C B Between BGP speakers in different AS Directly connected or peering address is reachable

59 An Example… 35.0.0.0/8 AS3561 A AS200 F B AS21 C D AS101 AS675 E
Learns about /8 from F & D

60 Basic BGP commands Configuration commands Show commands
router bgp <AS-number> neighbor <ip address> remote-as <as-number> Show commands show ip bgp summary show ip bgp neighbors

61 Originating routes... Using network command or redistribution
network <ipaddress> redistribute <protocol name> Requires the route to be present in the routing table

62 Originating routes/Inserting prefixes into BGP
network command network mask ip route serial 0 matching route must exist in the routing table before network is announced! Origin: IGP

63 Update message Withdrawn routes Path Attributes Advertised routes

64 Stable IBGP peering Unlinks IBGP peering from physical topology.
Carry loopback address in IGP router ospf <ID> passive-interface loopback0 Unlink peering from physical topology router bgp <AS1> neighbor <x.x.x.x> remote-as <AS1> neighbor <x.x.x.x> update-source loopback0

65 BGP4 continued...

66 BGP Path Attributes: Why ?
Encoded as Type, Length & Value (TLV) Transitive/Non-Transitive attributes Some are mandatory Used in path selection To apply policy for steering traffic

67 BGP Path Attributes... Origin AS-path Next-hop
Multi-Exit Discriminator (MED) Local preference BGP Community Others...

68 AS-PATH Updated by the sending router with its AS number
Contains the list of AS numbers the update traverses. Used to detect routing loops Each time the router receives an update, if it finds its AS number, it discards the update

69 AS-Path Sequence of ASes a route has traversed Loop detection AS 200
/16 /16 /16 dropped AS 300 AS 400 /16 / / / AS 500

70 Cisco Systems Confidential
Next-Hop AS 200 AS 300 /16 A B / / AS 100 Next hop router to reach a network Advertising router/Third party in EBGP Unmodified in IBGP /16 Cisco Systems Confidential 0799_04F7_c2 20

71 Third Party Next Hop More efficient, but bad idea! AS 200 AS 201 C A B
/ C peering A B /24 AS 201 More efficient, but bad idea!

72 Next Hop... IGP should carry route to next hops
Recursive route look-up Unlinks BGP from actual physical topology Allows IGP to make intelligent forwarding decision

73 Local Preference Not for EBGP, mandatory for IBGP
Default value is 100 on Ciscos Local to an AS Used to prefer one exit over another Path with highest local preference wins

74 Local Preference AS 100 AS 200 AS 300 AS 400 160.10.0.0/16 D E A B C
500 800 E A B AS 400 / > / C

75 Multi-Exit Discriminator
Non-transitive Represented as a numeric value (0-0xffffffff) Used to convey the relative preference of entry points Comparable if paths are from the same AS Path with lower MED wins IGP metric can be conveyed as MED

76 Multi-Exit Discriminator (MED)
AS 200 C preferred / / A B /24 AS 201

77 Origin Conveys the origin of the prefix Three values:
IGP - Generated using “network” statement ex: network EGP - Redistributed from EGP Incomplete - Redistribute IGP ex: redistribute ospf IGP < EGP < INCOMPLETE

78 Communities Transitive, Non-mandatory
Represented as a numeric value (0-0xffffffff) Used to group destinations Each destination could be member of multiple communities Flexibility to scope a set of prefixes within or across AS for applying policy

79 Community... Service Provider AS 200 Customer AS 201 C D A B
/24 Customer AS 201

80 Synchronization C D OSPF C not running BGP (non-pervasive BGP)
1880 C A D OSPF 690 35/8 209 C not running BGP (non-pervasive BGP) A won’t advertise 35/8 to D until the IGP is in sync Turn synchronization off! Run pervasive BGP router bgp 1880 no sync B

81 BGP Route Selection (bestpath) Only one path as the bestpath !
Route has to be synchronized Prefix in forwarding table Next-hop has to be accessible Next-hop in forwarding table Largest weight Local to the router Largest local preference Spread within AS Locally sourced Via redistribute or network statement

82 BGP Route Selection ... Shortest AS-path length Lowest origin
number of ASes in the AS-path attribute Lowest origin IGP < EGP < INCOMPLETE Lowest MED between paths from same AS External over internal closest exit from a router Closest next-hop Lower IGP metric, closer exit from as AS Lowest router-id Lowest IP address of neighbor

83 BGP Route Selection... AS 100 AS 200 AS 300 AS 400 D A B
Increase AS path attribute length by at least 1 A B AS 400’s Policy to reach AS100 AS 200 preferred path AS 300 backup AS 400

84 Stub AS Typically no need for BGP Point default towards the ISP
ISP advertises the stub network to Internet Policy confined within ISP policy

85 Stub AS AS 101 B Provider A AS 100 Customer

86 Multi-homed AS Only border routers speak BGP
IBGP only between border routers Exterior routes must be redistributed in a controlled fashion into IGP or use defaults

87 Multi-homed AS AS 100 AS 200 AS 300 D C B A provider provider customer

88 Service Provider Network
IBGP used to carry exterior routes IGP keeps track of topology Full IBGP mesh is required

89 Common Service Provider Network
AS 100 AS 200 A H B C AS 300 provider D F E G AS 400

90 Routing Policy Why? How ? To steer traffic through preferred paths
Inbound/Outbound prefix filtering To enforce Customer-ISP agreements How ? AS based route filtering - filter list Prefix based route filtering - distribute list BGP attribute modification - route maps

91 Distribute list - using IP access lists
access-list 1 deny access-list 1 permit any access-list 2 permit … more access-lists as prefixes are added ... router bgp 100 neighbor remote-as 33 neighbor distribute-list 1 in neighbor distribute-list 2 out

92 Filter list rules Regular Expressions
RE is a pattern to match against an input string Used to match against AS-path attribute ex: ^3561.*100.*1$ Flexible enough to generate complex filter list rules

93 Filter list - using as-path access list
ip as-path access-list 1 permit 3561 ip as-path access-list 2 deny 35 ip as-path access-list 2 permit .* router bgp 100 neighbor remote-as 33 neighbor filter-list 1 in neighbor filter-list 2 out

94 Route Maps router bgp 300 neighbor 2.2.2.2 remote-as 100
neighbor route-map SETCOMMUNITY out ! route-map SETCOMMUNITY permit 10 match ip address 1 match community 1 set community 300:100 access-list 1 permit ip community-list 1 permit 100:200

95 Route-map match & set clauses Match Clauses Set Clauses
AS-path Community IP address AS-path prepend Community Local-Preference MED Origin Weight Others...

96 Route-map Configuration Example
neighbor <y.y.y.y> route-map AS200_IN in ! route-map AS200_IN permit 10 match community 1 set local-preference 200 ip community-list 1 permit 100:200 ISP2 H eth C21 C22 ISP3 neighbor <x.x.x.x> route-map AS100_IN in ! route-map AS100_IN permit 10 set community 100:200 Inbound route-map to set community H eth C32 C31

97 Load Sharing & Redundancy using BGP

98 Load-sharing - single path
Router A: interface loopback 0 ip address ! router bgp 100 neighbor remote-as 200 neighbor update-source loopback0 neighbor ebgp-multi-hop 2 ip route <DMZ-link1, link2> Loopback 0 A AS100 AS200 Loopback 0

99 Load Sharing - Multiple paths from the same AS
Router A: router bgp 100 neighbor remote-as 200 neighbor remote-as 200 maximum-paths 2 A 100 200 Note:A still only advertises one “best” path to ibgp peers

100 Redundancy - Multi-homing
Reliable connection to Internet 3 common cases of multi-homing: - default from all providers - customer + default routes from all - full routes from all

101 Default from all providers
Low memory/CPU solution Provider sends BGP default provider is selected based on IGP metric Inbound traffic decided by providers’ policy Can influence using outbound policy, example: AS-path prepend

102 Default from all providers
AS 200 Provider AS 300 D E A B AS 400 C

103 Customer + default from all providers
Medium memory and CPU solution Granular routing for customer routes and default for the rest Inbound traffic decided by providers’ policy Can influence using outbound policy

104 Customer routes from all providers
AS /16 Provider AS 200 Provider AS 300 D E A B C chooses shortest AS path AS 400 C

105 Full routes from all providers
More memory/CPU Full granular routing Usually transit ASes take full routes Usually pervasive BGP

106 Full routes from all providers
AS 100 AS 500 AS 200 AS 300 D E A B C chooses shortest AS path AS 400 C

107 Best Practices IGP in Backbone
IGP connects your backbone together, not your client’s routes IGP must converge quickly IGP should carry netmask information - OSPF, IS-IS, EIGRP

108 Best Practices... Connecting to a customer
Static routes You control directly No route flaps Shared routing protocol or leaking You must filter your customers info Route flaps BGP for multi-homed customers

109 Best Practices... Connecting to other ISPs
Use BGP4 Advertise only what you serve Take back as little as you can Take the shortest exit

110 Best Practices... The Internet Exchange
Long distance connectivity is expensive Connect to several providers at a single point

111 Q & A


Download ppt "Border Gateway Protocol (BGP4)"

Similar presentations


Ads by Google