Bigbgp

1,351 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,351
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
144
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Bigbgp

  1. 1. Intro to BGP All-Day Tutorial Avi Freedman [email_address]
  2. 2. Index <ul><li>Internet Connectivity Overview </li></ul><ul><li>Multihoming Concepts </li></ul><ul><li>Multihoming Without BGP </li></ul><ul><li>Multihoming - Address Space Complications </li></ul>
  3. 3. Index <ul><li>Basic BGP - The BGP Route </li></ul><ul><li>Basic BGP - Inserting Routes into BGP </li></ul><ul><li>Basic BGP - Advertising Routes </li></ul><ul><li>Basic BGP - Other BGP Route Attributes </li></ul><ul><li>Basic BGP - Selecting Routes </li></ul>
  4. 4. Index <ul><li>Multihoming with BGP - an Introduction </li></ul><ul><li>Interlude - Hardware for BGP </li></ul><ul><li>Multihoming with BGP with a Cheap Router </li></ul><ul><li>Multihoming with BGP - Taking Just Customer Routes </li></ul><ul><li>Multihoming with BGP - Taking Full Routes </li></ul><ul><li>Default Routing in BGP </li></ul>
  5. 5. Internet Connectivity Overview
  6. 6. Having Internet Connectivity <ul><li>To have complete Internet connectivity you must be able to reach all destinations on the net. </li></ul><ul><li>Your packets have to get delivered to every destination. This is easy (default routes). </li></ul><ul><li>Packets from everywhere else have to “find you”. This is done by having your ISP(s) advertise routes for you. </li></ul>
  7. 7. Multihoming Without BGP
  8. 8. Multihoming Without BGP <ul><li>To get Internet connectivity, you can just default route your traffic to your upstream providers. </li></ul><ul><li>To get traffic back from the Internet, you need to have your providers tell all of the rest of the Internet “where you are”. </li></ul>
  9. 9. BGP Route Advertisement (1) <ul><li>Think of a BGP route as a “promise”. </li></ul><ul><li>If I advertise 207.8.128.0/17, I promise that if you deliver traffic to me for anywhere in 207.8.128.0/17, I know how to deliver it at least as well as anyone else. </li></ul><ul><li>If my customer has 207.8.140.0/24, I generally will not announce that route separately since it is covered by my 207.8.128.0/17 aggregate route. </li></ul>
  10. 10. BGP Route Advertisement (2) <ul><li>By making sure these routes, or “promises”, are heard by ALL providers on the ‘net, your provider ensures a return path for all of your packets. </li></ul><ul><li>Remember, sending packets OUT is easier than getting them back. </li></ul><ul><li>Also, remember - sending routes OUT causes IP traffic to come IN. </li></ul>
  11. 11. BGP Route Advertisement (3) <ul><li>But the most specific route wins, so if one of my customers’ ISPs is advertising 207.8.240.0/24, all incoming traffic from other networks will start flowing in that pipe. </li></ul><ul><li>So I must “punch a hole” in my aggregate announcement and advertise 207.8.128.0/17 and 207.8.240.0/24. </li></ul>
  12. 12. BGP Route Advertisement (4) <ul><li>The complete set of routes advertised by all BGP speakers on the net is about 55,000 routes as of 10/98. </li></ul><ul><li>If your route is missing in the “view” of any major provider, you will not have connectivity to them. </li></ul>
  13. 13. Multihoming Without BGP - How it Works
  14. 14. Customer Side - Outbound <ul><li>All you need to do is to put in static default route(s). To prefer two upstreams equally: </li></ul><ul><ul><li>ip route 0.0.0.0 0.0.0.0 s4/0 </li></ul></ul><ul><ul><li>ip route 0.0.0.0 0.0.0.0 s4/1 </li></ul></ul><ul><li>To use one link as a backup only for outbound packtes: </li></ul><ul><ul><li>ip route 0.0.0.0 0.0.0.0 s4/0 </li></ul></ul><ul><ul><li>ip route 0.0.0.0 0.0.0.0 s4/1 10 </li></ul></ul><ul><ul><li>why? S4/1 could be a 56k or backup link </li></ul></ul>
  15. 15. Cisco Load Balancing <ul><li>The way Ciscos (except for big new ones running “CEF”) work if there are two “equal-cost” routes to the same place is - </li></ul><ul><ul><li>Option 1 - Round-robin the packets without “route caching”. This goes through the slowest sections of the router’s OS. Bad. Also, if you are connected to different ISPs, packets can arrive out of order, etc… </li></ul></ul><ul><ul><li>Option 2 - Use route caching (default). Traffic to the same dest IP will always use the same interface, until the cache entry expires. </li></ul></ul>
  16. 16. Customer Side - Inbound <ul><li>Just tell your ISP what address space you are bringing, if any. </li></ul><ul><li>Your ISP may allocate you space out of their larger address blocks. </li></ul><ul><li>If so, they need to announce your space “more specifically”. </li></ul><ul><li>But you do no work other than tell your ISP what to do. </li></ul>
  17. 17. Provider Side (1) <ul><li>If both providers don’t advertise your routes with the same specificity, you might have - </li></ul><ul><ul><li>netaxs saying “4969 sez 207.8.128.0/17” </li></ul></ul><ul><ul><li>uunet saying “701 sez 207.8.195.0/24” </li></ul></ul><ul><li>Bad, because almost all traffic on the ‘net will come into you via UUNET. </li></ul><ul><li>{note} - talk about address filters </li></ul>
  18. 18. Provider Side (2) <ul><li>What you need is - </li></ul><ul><ul><li>netaxs saying “4969 sez 207.8.128.0/17” </li></ul></ul><ul><ul><li>netaxs saying “4969 sez 207.8.195.0/24” </li></ul></ul><ul><ul><li>uunet saying “701 sez 207.8.195.0/24” </li></ul></ul><ul><li>Good, because - </li></ul><ul><ul><li>1) Because the two 207.8.195.0/24 routes are of the same specificity, providers CAN choose btwn netaxs and uunet to get to you; and </li></ul></ul><ul><ul><li>2) For some people who don’t listen to /24s and such in new address space, they still have the 207.8.128.0/17 route to use to get to you. </li></ul></ul>
  19. 19. Address Space Complications <ul><li>So, in the case of - </li></ul><ul><ul><li>netaxs saying “4969 sez 207.8.128.0/17” </li></ul></ul><ul><ul><li>netaxs saying “4969 sez 207.8.195.0/24” </li></ul></ul><ul><ul><li>uunet saying “701 sez 207.8.195.0/24” </li></ul></ul><ul><li>“ Some people won’t listen to the /24, so what happens if my netaxs connection goes down?” </li></ul><ul><li>Not a problem!!! Because netaxs will hear the UUNET /24. Sprint send traffic to netaxs; netaxs to uunet; and uunet to you. </li></ul>
  20. 20. Disadvantages of not using BGP <ul><li>You gain a bit more control of your destiny when you speak BGP yourself. You can break up your routes in an emergency, or to tune traffic. You can “pad” your announcements to de-prefer one or more upstreams. </li></ul><ul><li>Also, you lose the ability to fine-tune outbound traffic flow to the “best” upstream. </li></ul>
  21. 21. Why BGP? <ul><li>BGP is a multi-vendor “open” protocol with multiple implementations, all mostly interoperable. It is the only actively used EGP on the Internet. </li></ul><ul><li>The main design feature of BGP was to allow ISPs to richly express their routing policy, both in selecting outbound paths and in announcing internal routes. Keep this in mind as we progress. </li></ul>
  22. 22. What is BGP?
  23. 23. BGP is … (1) <ul><li>An Exterior Gateway Protocol (EGP), used to propagate tens or hundreds of thousands of routes between networks (ASs). </li></ul><ul><li>The only protocol used to do this on the Internet today. </li></ul>
  24. 24. BGP is … (2) <ul><li>The Border Gateway Protocol, currently Version 4 - defined in RFC 1771, and extended (with additional optional attributes) in other RFCs. </li></ul><ul><li>A “distance-vector” routing protocol, running over TCP port 179. </li></ul><ul><li>Supports modern “classless” routing. BGP3, RIPv1, and some others do NOT. </li></ul>
  25. 25. Purpose of BGP
  26. 26. Purpose of BGP <ul><li>To allow networks to tell other networks about routes (parts of the IP address space) that they are “responsible” for. </li></ul><ul><li>Using “route advertisements”, or “promises” - also called “NLRI” or “network-layer reachability information”. </li></ul><ul><li>Networks are “Autonomous Systems”. </li></ul><ul><li>Identified in BGP by a number, called the ASN (“Autonomous System Number”) </li></ul>
  27. 27. Basic BGP Concepts
  28. 28. Basic BGP Concepts (1) <ul><li>BGP exchanges routes between ASs. </li></ul><ul><li>When routes are exchanged, ASNs are stamped on the routes *on the way out* - adding one “AS hop” per network traversed. (0-65535) </li></ul><ul><li>No concept of pipe size, internal router hop-count, congestion - in some sense BGP treats all ASs the same. </li></ul><ul><li>ASs allow administrative debugging, “policy” routing, and *loop detection*. </li></ul>
  29. 29. BGP AND ASNs AS 4969 AS 5000 AS 6461 AS 701 AS 12001
  30. 30. Basic BGP Concepts (2) <ul><li>Routes are exchanged over “peering sessions”, which run on top of TCP. </li></ul><ul><li>Keepalives are used to avoid needed to re-send the whole table periodically. </li></ul><ul><li>The routes are “objects”, or “bags” of “attributes” - really mini-databases. </li></ul><ul><li>BGP is actually two protocols - iBGP, designed for internal routing, and eBGP, designed for external routing. </li></ul>
  31. 31. Basic BGP Concepts (3) <ul><li>There is only one “best” BGP route for any given IP block at one time. </li></ul><ul><li>This “best” BGP route is not always the route that gets “installed” into the router’s RIB/FIB. </li></ul><ul><li>Once a session comes up, all best-routes are exchanged. Then over time, just “topology updates” are exchanged. </li></ul><ul><li>You can ONLY exchange “best” routes. </li></ul>
  32. 32. Basic BGP Concepts (4) <ul><li>Policy </li></ul><ul><ul><li>The Internet was a strange place before the modern commercial Internet evolved in 1992-1993. </li></ul></ul><ul><ul><li>Some networks had policies about what kind of traffic they would carry. </li></ul></ul><ul><ul><li>BGP was designed to allow network operators to make routing decisions based on whatever “policy” they wanted (or HAD) to use. </li></ul></ul>
  33. 33. CISCO DIAGRAM - RIB FIB ETC
  34. 34. Basic BGP Concepts - The BGP Route and Route Attributes
  35. 35. The BGP Route <ul><li>A BGP “route” is a “bag” of objects, or “attributes”. </li></ul><ul><li>The “prefix” is the section of address space being advertised. A prefix consists of: </li></ul><ul><ul><li>A starting point (i.e. 207.8.128.0) </li></ul></ul><ul><ul><li>A netmask (i.e. /24, aka 255.255.255.0) </li></ul></ul>
  36. 36. What Is an Attribute? <ul><li>A BGP message consists of a prefix and information about that prefix (i.e., local-pref, med, next-hop, originator, etc...). Each piece of information is encoded as an attribute in a TLV (type-length-value) format. The attribute length is 4 bytes long, and new attributes can be added by simply appending a new attribute. </li></ul><ul><li>Attributes can be transitive or non-transitive, some are mandatory. </li></ul>Next Hop AS Path ... ... MED ...
  37. 37. Next Hop Attribute <ul><li>Next-hop IP address to </li></ul><ul><li>reach a network. </li></ul><ul><li>Router A will advertise 198.3.97.0/24 to router B with a next-hop of 207.240.24.202. </li></ul><ul><li>With IBGP, the next-hop does not change. </li></ul><ul><li>IGPs should carry route to next-hops, using intelligent forwarding decision. </li></ul>AS 6201 AS 3847 198.3.97.0/24 A B 207.240.24.200/30 .201 A B .202 C
  38. 38. Next Hop Self AS701 AS3561 AS3847 A B C D AS1 198.32.184.19 198.32.184.116 198.32.184.42 198.32.184.56
  39. 39. <ul><li>Sequence of AS(s) a route has traversed. </li></ul><ul><li>Provides a mechanism for loop detection. </li></ul><ul><li>Policies may be applied </li></ul><ul><li>based on AS path. </li></ul><ul><li>Local AS added only when </li></ul><ul><li>send to external peer. </li></ul><ul><li>Shortest AS path preferred </li></ul>AS Path Attribute (1) AS3847 207.240.0.0/16 AS1673 140.222.0.0/16 AS701 192.67.95.0/24 AS3561 204.70.0.0/15 192.67.95.0/24 3847 701 i 140.222.0.0 3847 1673 i 204.70.0.0/15 3847 3561 i 207.240.0.0/16 3847 i AS6201 E C F G D B A
  40. 40. <ul><li>Sprint is 1239; UUNET is 701; Net Access is 4969. </li></ul><ul><li>When pattern-matching, or regexping, AS_PATHS, ^ means “match beginning”, and $ means “match end”. </li></ul><ul><li>The null AS-Path is ^$ - if the AS-Path is null, the BGP route originated inside the same AS. </li></ul>AS Path Attribute (2)
  41. 41. <ul><li>^1239 4969$ is how a Sprint customer would see a Net Access route. </li></ul><ul><li>^1239 4969 11023$ is how a Sprint customer would see a Net Access BGP customer’s route. </li></ul><ul><li>^4969 11023$ is how Sprint itself sees that same route. </li></ul>AS Path Attribute (3)
  42. 42. <ul><li>Indication to external peers of the preferred path into an AS. </li></ul><ul><li>Affects routes with same AS path. </li></ul><ul><li>Advertised to external neighbors </li></ul><ul><li>Usually based on IGP metric </li></ul><ul><li>Lowest MED preferred </li></ul>Multi-Exit Discriminator (MED )
  43. 43. MED Attribute (2) <ul><li>The MED (multi-exit discriminator) is a commonly used attribute. It comes after the AS_PATH in evaluation, and thus isn’t quite as much of a “hammer” as local-pref. </li></ul><ul><li>Commonly, MED is used to tack a distance on BGP routes as they move within your network. </li></ul><ul><li>NSPs advertise MEDs to each other to let it be known which POP the route is “closest” to. </li></ul>
  44. 44. <ul><li>Applies on a AS path basis </li></ul><ul><li>Current aggregation schemes significantly lessen value. </li></ul>MED Attribute (3) +40 +20 +5
  45. 45. Origin Attribute <ul><li>One of the mandatory, but minor, attributes of a BGP route is the origin. It is one of (in order of preference): </li></ul><ul><ul><li>IGP (i) (from a network statement) </li></ul></ul><ul><ul><li>EGP (e) (from an external peer) </li></ul></ul><ul><ul><li>Unknown (?) (from IGP redistribution) </li></ul></ul><ul><li>It can be re-set, but that is not often done. </li></ul><ul><li>It is almost-last in the selection algorithm. </li></ul>
  46. 46. Weight Attribute <ul><li>Cisco proprietary, not part of any spec. </li></ul><ul><li>Local to router. </li></ul><ul><li>Value 0-65535 (default if originated by </li></ul><ul><li>router - 32768, other - 0) </li></ul><ul><li>Highest weight preferred </li></ul>
  47. 47. Weight Attribute (ctd) <ul><li>Weight is rarely used. It overrides almost all other attributes in the decision path, and is local to a specific router - it is never sent to other routers, even ones inside your ASN. </li></ul><ul><li>Usually used for temporary “I-don’t-have-time-to-think-about-it” fixes. </li></ul>
  48. 48. Local Preference Attribute <ul><li>Local to AS </li></ul><ul><li>Used to influence BGP </li></ul><ul><li>path selection </li></ul><ul><li>Default 100 </li></ul><ul><li>Highest local-pref preferred </li></ul>AS 6201 208.1.1.0/24 A B 208.1.1.0/24 100 Preferred by all AS3847 routers 208.1.1.0/24 80 AS 3847 G F E C D
  49. 49. Local-Pref Attribute (2) <ul><li>An often-used attribute, local-pref (normally 100) overrides AS_PATH, and is transitive throughout your network. It is never advertised to an eBGP peer. </li></ul><ul><li>For example, you can express the policy “prefer private interconnects” by making the local_pref be 150 and leaving all other peers at 100. </li></ul><ul><li>Best used as an intermediate-level knob. </li></ul>
  50. 50. iBGP vs. eBGP
  51. 51. iBGP vs. eBGP <ul><li>BGP is very strange. It is promiscuous with external routes, making it very easy for you to become “MAE-Clueless”, yet it makes it very hard to advertise routes thoroughly inside your network. </li></ul><ul><li>iBGP sessions are established when peering with the same AS; eBGP otherwise. </li></ul><ul><li>Same protocols; different route install rules. </li></ul><ul><li>YOU MUST STRONGLY FILTER ALL eBGP SESSIONS! </li></ul>
  52. 52. iBGP AS 3847 When BGP speakers in the same AS form a BGP connection for the purpose of exchanging routing information, they are said to be running IBGP or internal BGP. IBGP speakers are usually fully-meshed. B A c
  53. 53. eBGP (1) AS 3561 AS 3847 When BGP speakers in different ASs form a BGP connection for the purpose of exchanging routing information, they are said to be running EBGP or external BGP. EBGP peers are usually directly connected. B A
  54. 54. eBGP (2) AS 2033 AS 4200 AS 7007 AS 2041
  55. 55. iBGP and eBGP Diagram AS 7007 XP AS 1239 AS 6079 AS 701 AS 4006
  56. 56. eBGP Rules <ul><li>By default, only talks to directly-connected router. </li></ul><ul><li>Sends the one best BGP route for each destination. </li></ul><ul><li>Sends all of the important “attributes”; omits the “local preference” attribute. </li></ul><ul><li>Adds (prepends) the speaker’s ASN to the “as-path” attribute. </li></ul><ul><li>Usually rewrites the “next-hop” attribute. </li></ul>
  57. 57. iBGP Rules <ul><li>Can talk to routers many hops away by default. </li></ul><ul><li>Can only send routes it “injects”, or routes heard DIRECTLY from an external peer. </li></ul><ul><li>Thus, requires a FULL mesh. </li></ul><ul><li>Sends all attributes. </li></ul><ul><li>Leaves the as-path attribute alone. </li></ul><ul><li>Doesn’t touch the “next hop” attribute. </li></ul>
  58. 58. Logical view of 16 routers, fully meshed
  59. 59. iBGP Restriction (1) <ul><li>Assume AS1239 sends route 10.0.0.0/8 to AS2828. Router A will send that route to Routers B and C. </li></ul>AS 2828 AS 1239 A B C
  60. 60. iBGP Restriction (2) <ul><li>When Router B receives 10.0.0.0/8, it will not propagate that route to Router C because it was learned from an iBGP neighbor. Router C will behave similarly. </li></ul>AS 2828 AS 1239 A B C
  61. 61. iBGP and next-hop (1) <ul><li>Furthermore, the Next Hop for 10.0.0.0/8 will be the serial interface on the AS1239 router, even in Router B’s and Router C’s forwarding table. </li></ul>AS 2828 AS 1239 A B C
  62. 62. iBGP and next-hop (2) <ul><li>With iBGP, next-hop is not a router directly connected. </li></ul><ul><li>So a “recursive lookup” is needed. </li></ul><ul><li>After the next-hop is found, a second lookup is made to figure out how to send the packet “in the direction” of the next-hop. </li></ul>
  63. 63. Basic BGP Concepts Inserting Routes into BGP
  64. 64. Inserting Routes into BGP (1) <ul><li>How do routes get into BGP? They have to come from somewhere. You have to insert routes into BGP, and someone had to insert external routes that you get into BGP somewhere else in the first place. </li></ul><ul><li>Two main ways: </li></ul><ul><ul><li>network statements (like static BGP routes) </li></ul></ul><ul><ul><li>redistributing from OSPF, static, etc... </li></ul></ul>
  65. 65. Inserting Routes into BGP (2) <ul><li>network statements </li></ul><ul><ul><li>“network x.y.z.q [mask a.b.c.d]” </li></ul></ul><ul><ul><li>MUST have an EXACTLY-matching IGP route - specificity must be an exact match </li></ul></ul><ul><ul><li>Doesn’t scale beyond 200 or so network statements per routers; not a problem, though. </li></ul></ul><ul><ul><li>Makes scaling easier when you have to support multi-homed customers </li></ul></ul>
  66. 66. Inserting Routes into BGP (3) <ul><li>aggregate-address statements </li></ul><ul><ul><li>“aggregate-address x.y.z.q a.b.c.d [aggregate-only] [suppress-map XXX]” </li></ul></ul><ul><ul><li>(Really a relative of the network statement) </li></ul></ul><ul><ul><li>Brings up the given network if there are any more specific BGP routes for the prefix specified. </li></ul></ul><ul><ul><li>Usually used with aggregate-only to suppress more specifics. </li></ul></ul><ul><ul><li>Usually used in conjunction with redistribution. </li></ul></ul>
  67. 67. Inserting Routes into BGP (4) <ul><li>Redistribution </li></ul><ul><ul><li>ALWAYS redistribute through an address filter! Otherwise you will have crud in your BGP! </li></ul></ul><ul><ul><li>Examples later on... </li></ul></ul><ul><li>Default route is a special case. More soon. </li></ul>
  68. 68. Basic BGP Advertising Routes
  69. 69. BGP Peering Sessions (1) <ul><li>BGP Routes are exchanged inside of BGP peering sessions. </li></ul><ul><li>BGP uses TCP to ensure reliable delivery of routing updates. </li></ul><ul><li>If a TCP session dies, all associated routes must be withdrawn. </li></ul><ul><li>BGP peers, or neighbors, must be specified explicitly. This is a good thing. </li></ul>
  70. 70. BGP Peering Sessions (2) <ul><li>Once a peering session is set up: </li></ul><ul><ul><li>Both sides flood the other end with all of their best BGP routes. VERY IMPORTANT - there is one best route per prefix, and that is the route that is advertised. BGP can only advertise routes that are eligible for use or routing loops can occur. </li></ul></ul><ul><ul><li>Then, periodic updates send new routes and/or withdraw old ones, and keepalives are sent every N seconds. </li></ul></ul><ul><ul><li>On a very stable network,very little or no traffic should flow besides keepalives. </li></ul></ul>
  71. 71. Peering - BGP State Machine <ul><li>There is a state machine that describes the setting up, use, and tearing down of BGP sessions. It’s useful to know the states because Cisco uses them to describe session state. </li></ul><ul><li>Idle -> Connect -> Active {send “startup” packet} -> OpenSent -> OpenConfirm {wait for ack} -> Established [ … -> Idle] </li></ul><ul><li>In “sho ip bgp summ”, “Active” does NOT mean Active, it means “waiting” - FYI. </li></ul>
  72. 72. Peering - Processing Routes <ul><li>For each route received: </li></ul><ul><ul><li>If it’s a valid route AND passes any filters, it must be put into the BGP routing table. </li></ul></ul><ul><ul><li>Then, unless it is replacing a duplicate, a best-path computation must be run on all candidate BGP routes of the same prefix. </li></ul></ul><ul><ul><li>Then, if the best route changed, the RIB and/or FIB must be updated. </li></ul></ul><ul><ul><li>This process is done for ALL incoming BGP routes. </li></ul></ul>
  73. 73. Filtering BGP Routes - BGP Policy Control
  74. 74. BGP Policy Control <ul><li>To decide what routes can and can’t go to various other routers, you can “filter” using: </li></ul><ul><ul><li>“distribute lists” (“prefix filters”) - lists of routes </li></ul></ul><ul><ul><li>“filter lists” (“as-path filters”) - lists of regular expressions matching or denying ASs </li></ul></ul><ul><ul><li>“route maps” (“BGP Basic programs”) that allow you to match and change most BGP attributes </li></ul></ul>
  75. 75. <ul><li>Per neighbor access list applied to BGP routes </li></ul><ul><li>Inbound or outbound </li></ul><ul><li>Based upon network numbers </li></ul>Distribute List (1)
  76. 76. Distribute List (2) router bgp 3847 neighbor 207.240.8.246 remote-as 8130 neighbor 207.240.8.246 distribute-list 127 in neighbor 207.240.8.246 distribute-list 101 out access-list 127 permit ip host 207.19.74.0 host 255.255.255.0 access-list 127 permit ip host 208.198.100.0 host 255.255.252.0 access-list 127 permit ip host 208.204.80.0 host 255.255.252.0 access-list 127 permit ip host 208.212.249.0 host 255.255.255.0 access-list 127 permit ip host 207.240.120.0 host 255.255.255.0 access-list 127 permit ip host 208.220.144.0 host 255.255.248.0 access-list 127 permit ip host 208.225.192.0 host 255.255.240.0 access-list 127 deny ip any any ! explicit deny if not specified
  77. 77. Distribute List (3) access-list 10 deny ip 10.0.0.0 0.255.255.255 access-list 10 deny ip 127.0.0.0 0.255.255.255 access-list 10 deny ip 128.0.0.0 0.0.255.255 access-list 10 deny ip 172.16.0.0 0.15.255.255 access-list 10 deny ip 191.255.0.0 0.0.255.255 access-list 10 deny ip 192.0.2.0 0.0.0.255 access-list 10 deny ip 192.168.0.0 0.0.255.255 access-list 10 deny ip 223.255.255.0 0.0.0.255 access-list 10 deny ip 224.0.0.0 31.255.255.255 access-list 10 deny ip 207.240.0.0 0.0.3.255 access-list 10 permit ip any A sanity filter like this keeps your table neat and prevents you from advertising crud to your peers.
  78. 78. <ul><li>Filter routes both inbound and outbound based on value of AS path attribute. </li></ul><ul><li>Called “as-path” access, or filter, lists. </li></ul><ul><li>Configuration </li></ul><ul><li>router bgp 3847 </li></ul><ul><li>neighbor 207.240.10.100 remote-as 2900 </li></ul><ul><li>neighbor 207.240.10.100 distribute-list 100 in </li></ul><ul><li>neighbor 207.240.10.100 distribute-list 101 out </li></ul><ul><li>neighbor 207.240.10.100 filter-list 10 in </li></ul><ul><li>ip as-path access-list 10 permit ^2900$ </li></ul><ul><li>ip as-path access-list 10 deny .* </li></ul>Filter List (1)
  79. 79. Cisco Regular Expressions (1) <ul><li>. Period matches any single character, including white space. </li></ul><ul><li>* Asterisk matches 0 or more sequences of the pattern. </li></ul><ul><li>+ Plus sign matches 1 or more sequences of the pattern. </li></ul><ul><li>? Question mark matches 0 or 1 occurrences of the pattern </li></ul>
  80. 80. Cisco Regular Expressions (2) <ul><li>^ Caret matches the beginning of the input string. </li></ul><ul><li>$ Dollar sign matches the end of the input string. </li></ul><ul><li>_ Underscore matches a comma (,), left brace ({), right brace (}) left parenthesis, right parenthesis, the beginning or end of the input string, or a space. </li></ul>
  81. 81. Cisco Regular Expressions (3) <ul><li>[] Square brackets designate a range of single character patterns. </li></ul><ul><li>- Hyphen separates the endpoints of a range. </li></ul><ul><li>As you may have noticed, these are much like standard vi regular expressions. </li></ul>
  82. 82. Applying AS Path Filtering 3847 6201 D A C B E 701 F 6202 G The following configuration could be used on router B to accept routes from AS6201 & 6202 and deny all others. ip as-path access-list 10 permit ^6201$ ip as-path access-list 10 permit ^6201_6202$ ip as-path access-list 10 deny .*
  83. 83. <ul><li>3 default lists </li></ul><ul><li>(Permit all; Deny all; Permit only our routes) </li></ul><ul><li>ip as-path access-list 1 permit .* </li></ul><ul><li>ip as-path access-list 2 deny .* </li></ul><ul><li>ip as-path access-list 3 permit ^$ </li></ul>netaxs AS-Path ACLs
  84. 84. Route Maps (1) <ul><li>Route-maps are cisco’s mechanism to select and modify routes with if/then style algorithms. </li></ul><ul><li>Route-maps are used for more than just BGP in a cisco router, such as traffic shaping and policy routing. </li></ul>
  85. 85. Route Maps (2) <ul><li>Route-maps follow this format: </li></ul><ul><li>route-map <name> <per|deny> <#> </li></ul><ul><li>[match statements] </li></ul><ul><li>[set satements] </li></ul><ul><li>[repeat with unique sequence numbers as needed] </li></ul>
  86. 86. Route Maps (3) <ul><li>Route-maps follow this format: </li></ul><ul><li>route-map <name> <per|deny> <#> </li></ul><ul><li>[match statements] </li></ul><ul><li>[set satements] </li></ul><ul><li>[repeat with unique sequence numbers as needed] </li></ul>
  87. 87. Route Maps (4) <ul><li>For route-maps with the keyword “permit”, if the prefix being examined passes the match statement, the set commands are executed and the route-map is exited. </li></ul><ul><li>If the match statement is not passed, the next sequence number is executed. </li></ul><ul><li>If there are no more sequence numbers, the prefix is filtered/dropped. </li></ul>
  88. 88. Route Maps (5) <ul><li>For route-maps with the keyword “deny”, if the prefix being examined passes the match statement, the prefix in question is filtered and no more sequence numbers are executed. </li></ul><ul><li>If the prefix does not pass the match statements, the next sequence number is executed. </li></ul>
  89. 89. Basic BGP Selecting Routes
  90. 90. Selecting BGP Routes <ul><li>Usually there will be 2, 3, 4, etc… ways to get to a given destination, all of which are represented by BGP routes. </li></ul><ul><li>There is a way of picking the “best” one. </li></ul><ul><li>Most important note - </li></ul><ul><ul><li>Selection is NOT random between “similar” routes. </li></ul></ul><ul><ul><li>You can ALWAYS figure out why something is happening if you understand the rules. </li></ul></ul>
  91. 91. Selecting BGP Routes - Basic <ul><li>ALWAYS find the most specific route. </li></ul><ul><li>ONLY consider paths w/ reachable NEXT_HOPs. </li></ul><ul><li>Prefer a route originated on the local rtr. </li></ul><ul><li>Then, unless tuning has been done, pick the route with the shortest AS-PATH; then origin code; select on MED; then router ID. </li></ul><ul><li>Or, if weight, LOCAL_PREF is set, or padding done to AS_PATH, look at those. </li></ul>
  92. 93. Hardware for BGP
  93. 94. Router Vendors (1) <ul><li>cisco (affectionately called Crisco) </li></ul><ul><li>Bay Networks (called Bad Networks) </li></ul><ul><li>Livingston (called Lucington) </li></ul><ul><li>Ascend (pronounced ASS-END) </li></ul><ul><li>PC router w/ unix and gated </li></ul>
  94. 95. Router Vendors (2) <ul><li>Cisco rules the backbone router market. Everyone runs Cisco code, so everyone hits the same bugs. </li></ul><ul><li>Bay is next-biggest, but not really catching up. Have their own working BGP implementation, but takes them a while to add new features. Major disadvantage - GUI interface. Command-line is coming but not yet. </li></ul>
  95. 96. Router Vendors (3) <ul><li>Livingston has a BGP implementation, and though it isn’t feature-ful, it basically works and is efficient (but only supports t1-speed routing). </li></ul><ul><li>Ascend runs gated and is nasty. They barely understand bridging. You have to reboot their routers to reload a config. </li></ul>
  96. 97. Router Vendors (4) <ul><li>The gated consortium, run by merit, puts out a program capable of running OSPF and BGP (among other protocols). Put on a Unix box, it turns it into a router of sorts. </li></ul><ul><ul><li>Disadvantages - </li></ul></ul><ul><ul><ul><li>spinning hard disk </li></ul></ul></ul><ul><ul><ul><li>“ bgp assembly language” </li></ul></ul></ul><ul><ul><ul><li>poor documentation/support </li></ul></ul></ul>
  97. 98. Cisco Products <ul><li>Can’t run full BGP - </li></ul><ul><ul><li>2501 - 68030, 25mhz, 16mb ram max </li></ul></ul><ul><ul><li>4000/4000M/4500, 16-32mb max </li></ul></ul><ul><li>Can run full BGP - </li></ul><ul><ul><li>2600 - risc,64mb max - < 3k </li></ul></ul><ul><ul><li>3620/3640 - risc, 64/128mb max 3-10k </li></ul></ul><ul><ul><li>4500M/4700 - risc, 64/128mb max 5-10k </li></ul></ul><ul><ul><li>7206 - risc, 128mb max 12-30k </li></ul></ul><ul><ul><li>7000 - motorola, 64mb max 4-30k </li></ul></ul><ul><ul><li>7500 - risc, dist switch, 128mb max 15-70k </li></ul></ul><ul><ul><li>GSR/BFR - “anything you want” 30-120k </li></ul></ul>
  98. 99. Multihoming with BGP An Introduction
  99. 100. Step 1 - Determine Policy <ul><li>“ You go find out what they want; we’ll start programming the routers” doesn’t work well. </li></ul><ul><li>Before you step up to the router, determine what routing policy you want to express with your configuration. </li></ul><ul><li>Plan your configuration, and ask how it could put you (in an unwelcome light) on the nanog mailing list. </li></ul>
  100. 101. Policy for Basic Multi-Homing <ul><li>We want to advertise our routes - all of them, but only OUR routes. So, assemble a list of our routes and masks. </li></ul><ul><li>We want to accept all routes and let the router sort them out, initially based on AS-PATH length. If we don’t have enough memory to take full routes, we’ll start off taking none and then play later. </li></ul>
  101. 102. Warning - I am Blackholio (1) <ul><li>Never blackhole someone. </li></ul><ul><li>Say www.uu.net is 137.239.5.24, and the best match for that IP is the prefix 137.239.0.0/16. </li></ul><ul><li>What happens if you announce 137.239.5.0/24, by accident or on purpose? </li></ul><ul><li>Worldcom’s lawyers show up at your doors and you look like an idiot. </li></ul>
  102. 103. Warning - I am Blackholio (2) <ul><li>What happens if you have a T1 to Sprint and a T1 to UUNET, and you announce Sprint routes to UUNET? (Assume no sanity filters at the upstream, which is always a good assumption). </li></ul><ul><li>Answer - you have become MAE-Clueless, and all of UUNET tries to get to Sprint through your T1. </li></ul><ul><li>Why? </li></ul>
  103. 104. Warning - I am Blackholio (3) <ul><li>As your provider, I have to believe that your route is the best way to get to a given prefix. </li></ul><ul><li>Why? Because otherwise I can’t transit you - I can only send routes to the other providers on the Internet if I believe they are the best ones. </li></ul>
  104. 105. Multihoming - Minimal BGP (for cheap routers)
  105. 106. Insert Static Default Routes <ul><li>Insert static default routes, either load-balanced or with primary/backup, as per non-BGP multihoming. </li></ul><ul><li>Either </li></ul><ul><ul><li>ip route 0.0.0.0 0.0.0.0 s4/0 </li></ul></ul><ul><ul><li>ip route 0.0.0.0 0.0.0.0 s4/1 </li></ul></ul><ul><li>Or </li></ul><ul><ul><li>ip route 0.0.0.0 0.0.0.0 s4/0 </li></ul></ul><ul><ul><li>ip route 0.0.0.0 0.0.0.0 s4/1 250 </li></ul></ul>
  106. 107. Gather Networks <ul><li>Routes </li></ul><ul><ul><li>207.8.200.0/22 </li></ul></ul><ul><ul><li>198.69.44.0/24 </li></ul></ul><ul><li>Holdup routes keep the routes in BGP so they don’t “flap”. “Flapping” can blackhole you. </li></ul><ul><li>Then, build access-list and holdup routes </li></ul><ul><ul><li>access 55 permit 207.8.200.0 0.0.3.255 </li></ul></ul><ul><ul><li>access 55 permit 198.69.44.0 0.0.0.255 </li></ul></ul><ul><ul><li>ip route 207.8.200.0 255.255.252.0 null0 250 </li></ul></ul><ul><ul><li>ip route 198.69.44.0 255.255.255.0 null0 250 </li></ul></ul>
  107. 108. Set up BGP Base Config <ul><li>ip as access 1 permit .* </li></ul><ul><li>ip as access 2 deny .* </li></ul><ul><li>ip as access 3 permit ^$ </li></ul><ul><li>router bgp 22222 </li></ul><ul><li>no sync </li></ul><ul><li>net 207.8.200.0 mask 255.255.252.0 </li></ul><ul><li>net 198.69.44.0 mask 255.255.255.0 </li></ul>
  108. 109. Configuring Neighbors - Note <ul><li>The best way to configure a neighbor is to use cut-and-paste, or to tftpboot a snippet or whole config. </li></ul><ul><li>You have 30-60 seconds to type in the whole neighbor clause before the session could come up and start receiving and sending routes - WITHOUT FILTERS if you didn’t type fast enough... </li></ul>
  109. 110. Neighbor Configuration (1) <ul><li>router bgp 22222 </li></ul><ul><li>neigh 207.106.2.45 descr transit to netaxs </li></ul><ul><li>neigh 207.106.2.45 remote-as 4969 </li></ul><ul><li>neigh 207.106.2.45 next-hop-self </li></ul><ul><li>neigh 207.106.2.45 version 4 </li></ul><ul><li>neigh 207.106.2.45 dist 55 out </li></ul><ul><li>neigh 207.106.2.45 filter 3 out </li></ul><ul><li>neigh 207.106.2.45 filter 2 in </li></ul>
  110. 111. Neighbor Configuration (2) <ul><li>router bgp 22222 </li></ul><ul><li>neigh 10.40.4.81 descr transit to UUNET </li></ul><ul><li>neigh 10.40.4.81 remote-as 701 </li></ul><ul><li>neigh 10.40.4.81 next-hop-self </li></ul><ul><li>neigh 10.40.4.81 version 4 </li></ul><ul><li>neigh 10.40.4.81 dist 55 out </li></ul><ul><li>neigh 10.40.4.81 filter 3 out </li></ul><ul><li>neigh 10.40.4.81 filter 2 in </li></ul>
  111. 112. Test it <ul><li>Do a “sho ip bgp”. Only your 2 routes should show. </li></ul><ul><li>Do a “show ip bgp neigh <neighip> adv”. You should show that you are advertising those 2 routes to your 2 neighbors. </li></ul><ul><li>Go to nitrous.digex.net or another BGP looking glass, to see that the routes are being advertised under your AS, not the provider’s, and that both paths are there. </li></ul>
  112. 113. Multihoming with BGP - Taking Customer Routes (an intermediate solution)
  113. 114. Taking Just Customer Routes <ul><li>One option in-between default routing and taking full BGP is to at least take customer routes from each provider. </li></ul><ul><li>This way, you’ll be able to make some intelligent decisions, which can be especially important for news feeding and dns and mail exchange optimization. </li></ul><ul><li>If your provider isn’t Sprint or CW, you can probably fit “customer” routes in 16mb. </li></ul>
  114. 115. Taking Just Customer Routes (2) <ul><li>The best plan is to get your provider to advertise their customer routes ONLY to you. Still, use the KGB motto - “Trust, but verify”. </li></ul><ul><li>Doesn’t work on small routers if your upstream is MCI or UU. </li></ul><ul><li>Or, community-based filtering (more later). </li></ul>
  115. 116. Taking Just Customer Routes (3) <ul><li>So, a sanity filter: </li></ul><ul><ul><li>ip as acc 10 deny _701_ </li></ul></ul><ul><ul><li>ip as acc 10 deny _1239_ </li></ul></ul><ul><ul><li>ip as acc 10 deny _3561_ </li></ul></ul><ul><ul><li>ip as acc 10 deny _1673_ </li></ul></ul><ul><ul><li>ip as acc 10 deny _1_ </li></ul></ul><ul><ul><li>ip as acc 10 permit .* </li></ul></ul><ul><li>(Prevent hearing routes from the big boys - eve) </li></ul>
  116. 117. Taking Just Customer Routes (4) <ul><li>router bgp 22222 </li></ul><ul><li>neigh 207.106.2.45 descr transit to netaxs </li></ul><ul><li>neigh 207.106.2.45 remote-as 4969 </li></ul><ul><li>neigh 207.106.2.45 next-hop-self </li></ul><ul><li>neigh 207.106.2.45 version 4 </li></ul><ul><li>neigh 207.106.2.45 distribute 55 out </li></ul><ul><li>neigh 207.106.2.45 filter 3 out </li></ul><ul><li>neigh 207.106.2.45 filter 10 in </li></ul>
  117. 118. Multihoming with BGP - Taking Full Routes
  118. 119. Policy <ul><li>Actually, very easy. </li></ul><ul><li>Continue to advertise your routes, as before. </li></ul><ul><li>Take full routing info. </li></ul><ul><li>Later on, you can tune if you find that as-path is not a good indicator to some sites. </li></ul>
  119. 120. So, what Policy? <ul><li>We’ll do the same thing on advertisement, but we’ll take all routes from both upstreams. </li></ul>
  120. 121. Configuring Full BGP <ul><li>Router bgp 22222 </li></ul><ul><ul><li>neigh 207.106.2.45 remote-as 4969 </li></ul></ul><ul><ul><li>neigh 207.106.2.45 next-hop-self </li></ul></ul><ul><ul><li>neigh 207.106.2.45 version 4 </li></ul></ul><ul><ul><li>neigh 207.106.2.45 distribute 55 out </li></ul></ul><ul><ul><li>neigh 207.106.2.45 filter 3 out </li></ul></ul><ul><ul><li>neigh 207.106.2.45 filter 1 in </li></ul></ul>
  121. 122. Logistics of becoming Multihomed
  122. 123. Multihoming Logistics <ul><li>Address space. </li></ul><ul><li>Redundant connectivity during switch. </li></ul><ul><li>Test configs. </li></ul><ul><li>Bring up outbound BGP first. </li></ul>
  123. 124. Multihoming to the same Provider
  124. 125. Multihoming to the same Provider <ul><li>Same configs as being multi-homed, except that as-paths will be the same from your upstream, and your routes will be the same in their network. </li></ul><ul><li>Need some way of preferring. Either: </li></ul><ul><ul><li>Send more specifics and MEDs, and take MEDs </li></ul></ul><ul><ul><li>Play w/ route-maps and set some set of routes higher through one POP than another </li></ul></ul>
  125. 126. The Network Grows - Supporting BGP Customers
  126. 127. Supporting BGP Customers (1) <ul><li>So you’ve built a fine, redundant network. And others are willing to buy from you. </li></ul><ul><li>Setting up neighbor sessions is the easy part. </li></ul><ul><li>Determine your policy. </li></ul><ul><li>Filter EVERY route you hear from a downstream customer, no matter how they bitch. Can you say “blackholio”? </li></ul>
  127. 128. Supporting BGP Customers (2) <ul><li>You’ll need to add all customer prefixes to that access-list 55 you use for controlling your own outbound. </li></ul><ul><li>You’ll need to keep modifying as-path access-list 3 to add the ASNs of your downstreams. </li></ul><ul><li>This gets tedious. </li></ul>
  128. 129. Supporting BGP Customers (3) <ul><li>ip as acc 3 permit ^$ </li></ul><ul><li>ip as acc 3 permit ^22111$ </li></ul><ul><li>ip as acc 3 permit ^22111 7007 30111$ </li></ul><ul><li>etc... </li></ul><ul><li>Doesn’t scale at some point. </li></ul><ul><li>Solution? Communities... </li></ul>
  129. 130. Hot Potato vs. Hop-by-Hop Routing
  130. 131. Hot Potato Routing <ul><li>Most providers try to hand off traffic destined to the outside as soon as possible. </li></ul><ul><li>Even if someone else’s network is bad. </li></ul><ul><li>This will typically be the default behavior - IF you re-set the MED on inbound routes. </li></ul><ul><li>If not, you will do “Cold Potato” routing - sending routes cross-country on your network for UUNET’s other-coastal custs. </li></ul>
  131. 132. Quickie on Route-Maps <ul><li>Route-maps are used to match and set attributes of routes. They are a little logic flow of ANDs and NOT ANDs. </li></ul><ul><li>Like a little basic program; evaluated in order of the sequence number. </li></ul><ul><li>At the end of evaluation, if a route has been permitted at some point, it passed. </li></ul><ul><li>A route-map is ADDITIVE to other filters. </li></ul>
  132. 133. Implementing Communities <ul><li>ip comm 4 permit 4969:123 </li></ul><ul><li>ip comm 4 permit 4959:1200 </li></ul><ul><li>ip comm 20 permit 4969:0 </li></ul><ul><li>ip comm 21 permit 1239:1 </li></ul><ul><li>ip comm 22 permit 1239:2 </li></ul><ul><li>route-map tosprint deny 20 </li></ul><ul><li>match comm 20 </li></ul><ul><li>route-map tosprint permit 21 </li></ul><ul><li>match comm 21 </li></ul><ul><li>set as pre 4969 </li></ul><ul><li>route-map tosprint permit 22 </li></ul><ul><li>match comm 22 </li></ul><ul><li>set as pre 4969 4969 </li></ul><ul><li>route-map tosprint permit 30 </li></ul><ul><li>match comm 4 </li></ul>
  133. 134. Implementing Communities <ul><li>route-map set-transit </li></ul><ul><li>match ip address 40 </li></ul><ul><li>set comm 4969:1200 4969:666 additive </li></ul><ul><li>router bgp 22222 </li></ul><ul><li>neigh <custip> route-map set-transit in </li></ul>
  134. 135. TUNING INBOUND BGP ANNOUNCEMENTS
  135. 136. Inbound BGP Routes <ul><li>Inbound BGP routes make traffic go out. Having a route means that an outbound packet can use it as the basis for a forwarding decision (well, the router can). </li></ul><ul><li>It is far easier to adjust outbound routing than inbound. </li></ul><ul><li>Goal is generally to provide fastest, lowest-loss, path for all destinations. </li></ul>
  136. 137. Tuning Inbound BGP Routes <ul><li>Policy </li></ul><ul><ul><li>Generally, to optimize throughput and latency. </li></ul></ul><ul><ul><li>Could be to squash traffic to certain providers, though, depending on the time of night and state of mind of the network engineer in question. </li></ul></ul><ul><ul><li>Or, to reduce transit cost. </li></ul></ul><ul><ul><li>Generally, though, it is to optimize connectivity “quality”, whatever that is. </li></ul></ul>
  137. 138. Tuning Inbound BGP Routes <ul><li>Many destinations that you tune make themselves known in the form of customer complaints. </li></ul><ul><li>Otherwise, start focusing on the biggest providers (Sprint, UU, MCI/SW, ANS, ATT, BBN, ...). </li></ul>
  138. 139. Tuning Inbound BGP Routes <ul><li>Use traceroutes to determine connectivity. </li></ul><ul><li>However, do the traceroute from the source IP of the provider you are testing. </li></ul><ul><li>No problem - do it from the border router and the source IP will be that of the serial interface. </li></ul><ul><li>So, just set a temporary static route to a given destination and trace away... </li></ul>
  139. 140. Tuning Inbound BGP Routes <ul><li>Once you identify better paths, use AS_PATH padding. </li></ul><ul><li>Identify the providers in question. </li></ul><ul><li>Pick out the relevant AS_PATH regexp. </li></ul><ul><li>Build a route-map to apply inbound. </li></ul>
  140. 141. Tuning Inbound BGP Routes <ul><li>Simple route-map </li></ul><ul><ul><li>ip as acc 20 permit ^701 1673_ </li></ul></ul><ul><ul><li>route-map inbound-uu permit 10 </li></ul></ul><ul><ul><li>match as 20 </li></ul></ul><ul><ul><li>set as pre 701 701 </li></ul></ul><ul><ul><li>route-map inbound-uu permit 20 </li></ul></ul><ul><ul><li>match as 1 </li></ul></ul><ul><li>Always best to leave a specific match all at the end. </li></ul>
  141. 142. Tuning Inbound BGP Routes <ul><li>Other methods: </li></ul><ul><li>We’ll talk about local_prefs later on... </li></ul>
  142. 143. TUNING OUTBOUND BGP ANNOUNCEMENTS
  143. 144. Tuning Outbound BGP <ul><li>This is harder, because all of the other networks implementing their own policies complicate your life. </li></ul><ul><li>Your two main tools are: </li></ul><ul><ul><li>Padding your outbound AS_PATHs </li></ul></ul><ul><ul><li>Deaggregating announcements </li></ul></ul><ul><li>And: </li></ul><ul><ul><li>With a cooperative provider, using communities </li></ul></ul>
  144. 145. Tuning Outbound - Padding <ul><li>When your router announces iBGP routes, it normally creates a 1-entry AS_PATH with your ASN. So, by adding one or more copy of your own ASN, you cause the providers who listen to that route to de-prefer it a bit (since the AS_PATH is now 1 longer, thus making it win less often). </li></ul>
  145. 146. Tuning Outbound - Padding <ul><li>route-map pad-me-once </li></ul><ul><li>match as 1 </li></ul><ul><li>set as prepend 22222 </li></ul><ul><li>router bgp 22222 </li></ul><ul><li>neigh 207.106.2.45 route-map pad-me-once out </li></ul>
  146. 147. Tuning Outbound - Communities <ul><li>If your providers are good (netaxs, above.net, some others), they’ll give you the ability to control your destiny with communities. </li></ul><ul><li>For example, netaxs honors the communities: </li></ul>
  147. 148. Tuning Outbound - deagg. <ul><li>I have 207.106.128.0/17. I want to advertise 207.106.128.0/17 to spr and uu, and 207.106.128.0/18 to spr alone. </li></ul><ul><li>access 56 deny 207.106.128.0 0.0.63.255 </li></ul><ul><li>access 56 <insert lines from access 55> </li></ul><ul><li>neigh <uunetip> dist 56 out </li></ul>
  148. 149. PEERING WITH OTHER ISPS
  149. 150. Peering <ul><li>Networks should peer as widely as possible, for better interconnectivity. The more wide the peering, the more traffic you will use. This is a GOOD thing. </li></ul><ul><li>Particularly, peering with local providers is a very good thing. </li></ul><ul><li>If you are both in a frame or SMDS cloud, or in a room, peering makes sense... </li></ul>
  150. 151. PEERING AND next-hop-self
  151. 152. BGP: Next-hop-self <ul><ul><ul><li>By default, our friend Mr. Promiscuous Q. eBGP will pass on next-hops as imported </li></ul></ul></ul><ul><ul><ul><li>So, if multiple routers are at a common XP, and one party is transitting another, you might accidentally send routes to a 3rd party which would cause them to send traffic to your transit customer instead of “bouncing” the packet off of you. </li></ul></ul></ul><ul><ul><ul><li>Some people think transit over XPs is bad, but many do it as a backup-of-last-resort. If you do, watch your next-hops. </li></ul></ul></ul>
  152. 153. Next-Hop-Self Issues: Bad XP AS 701 192.41.177.241 AS 4969 192.41.177.87 AS 6666 192.41.177.4 10.10.10.0/24 6666 192.41.177.4 Prefix AS-Path Next-hop AS 6666 says to AS 4969: AS 4969 says to AS 701: Prefix AS-Path Next-hop 10.10.10.0/24 4969 6666 192.41.177.4
  153. 154. Next-Hop-Self Issues: Better XP AS 701 192.41.177.241 AS 4969 192.41.177.87 AS 6666 192.41.177.4 10.10.10.0/24 6666 192.41.177.4 Prefix AS-Path Next-hop AS 6666 says to AS 4969: AS 4969 says to AS 701: Prefix AS-Path Next-hop 10.10.10.0/24 4969 6666 192.41.177.87
  154. 155. BACKUP TRANSIT
  155. 156. STABLE BGP
  156. 157. Stable BGP <ul><li>Nail routes to loopback. </li></ul><ul><li>Watch out for flapping routes. </li></ul><ul><li>Sites think that if a site shows instability, it is worth blackholing for some time (30-90 minutes) until it stabilizes. </li></ul><ul><li>Dampening hurts. </li></ul><ul><li>How to escape from being dampened once the underlying problem is fixed. </li></ul>
  157. 158. Stable BGP - Loopbacks <ul><li>Peering between loopbacks enhances stability, since loopbacks don’t go down. </li></ul><ul><li>Also, good for load-balancing. </li></ul><ul><li>Set up lo0, then </li></ul><ul><li>“ neigh x.y.z.q update-source looback0” </li></ul>
  158. 159. BGP Stability - soft-reconfig <ul><li>Instead of hammering a session to cause reevaluation (“clear ip bgp” drops the TCP session), “clear ip bgp soft” can be used. </li></ul><ul><li>“ clear ip bgp x.y.z.q soft out” is low cpu; it issues withdrawls for all currently-advertised routes and recomputes and re-sends roues. </li></ul><ul><li>“ clear ip bgp x.y.z.q soft in” is high memory, as it needs to keep copy of all routes received. </li></ul>
  159. 160. BGP Dampening BGP dampening is used to minimize instability caused by route flapping and oscillation over the network. To accomplish this, values are defined to identify badly behaved routes. Genuity currently uses Cisco's default values which basically say 'flap 3 times in 15 minutes and your damped': half-life 15 minutes penalty 1000 suppress-value 2000 reuse-value 750 But in time it can become a bit more complex. Each time a route flaps it gets a penalty (1000). If the cumulative penalty is greater than the suppress-value (2000, so 3 flaps), the advertisement of the route will be suppressed. The penalty will be exponentially decayed based on the half-life . Once the penalty decreases below the predefined reuse-value , the advertisement will be unsuppressed. The default maximum suppress time is 4 times the half-life . This ensures that if a route flaps a lot in a very short period but quickly becomes stable it's only suppressed for a maximum of 1 hour. Route flap dampening is not applied to routes originated from the AS in which the router resides.
  160. 161. eBGP Multihop
  161. 162. Why eBGP Multihop is BAD <ul><ul><ul><li>Why do it? </li></ul></ul></ul><ul><ul><ul><ul><li>“ I can’t afford a router to take full routes in the middle” </li></ul></ul></ul></ul><ul><ul><ul><ul><li>“ Tough luck. Find another job or get bought so you can” </li></ul></ul></ul></ul><ul><ul><ul><li>What are we talking about? </li></ul></ul></ul><ul><ul><ul><ul><li>[7010, 64mb] <-> [2501, 16mb] <-> [4700, 64mb] </li></ul></ul></ul></ul><ul><ul><ul><ul><li>2501 defaults to 7010 </li></ul></ul></ul></ul><ul><ul><ul><ul><li>7010 and 4700 speak eBGP multihop </li></ul></ul></ul></ul><ul><ul><ul><li>If you must: </li></ul></ul></ul><ul><ul><ul><ul><li>neigh <remoteip> ebgp 5 [# of hops] </li></ul></ul></ul></ul><ul><ul><ul><ul><li>REALIZE that you’re breaking one of the Fundamental Postulates of Active Routing - that every box in the middle knows (within a few seconds) how to get to a destination because it HAD to know in order to tell the box connected to it </li></ul></ul></ul></ul><ul><ul><ul><li>If someone puts a /24 route towards the 4700… Oh no.. </li></ul></ul></ul>
  162. 163. Blackhole w/ eBGP Multihop <ul><li>One use - getting the real-time spam blackhole feed from Vixie and company. </li></ul><ul><li>Take the routes from a remote site and set the next-hop on them to null0. </li></ul><ul><li>Or, take the routes and set next-hop to one of your upstreams to avoid the blackhole effect. </li></ul>
  163. 164. SUPPORTING MULTI-HOMED CUSTOMERS
  164. 165. Supporting Multi-Homed Custs <ul><li>What they need from you is routes to the ‘net, and some ability to be flexible in how they announce their routes. </li></ul><ul><li>Routes to the ‘net - give them your communities (“neighbor x.y.z.q send-communities”). Publish your communities so they know what they mean. WARN if you change community semantics. </li></ul>
  165. 166. Supporting Multi-Homed Custs <ul><li>Be prepared to punch holes in your aggregates. </li></ul><ul><ul><li>Using network statements, no problem. </li></ul></ul><ul><ul><li>Otherwise, be prepared to use aggregate-address. </li></ul></ul><ul><li>Set up communities they can use to control which pipes you advertise them to. </li></ul>
  166. 167. IGP REDISTRIBUTION
  167. 168. SCALING WITH CONFEDERATIONS
  168. 169. BGP Confederations <ul><ul><ul><li>Or “BGP done right” </li></ul></ul></ul><ul><ul><ul><li>Makes iBGP more promiscuous </li></ul></ul></ul><ul><ul><ul><li>How? </li></ul></ul></ul><ul><ul><ul><ul><li>Fully-mesh all BGP speakers at a POP </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Use fake ASNs at each POP </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Between POPs, use eBGP rules (send everything) </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Within POPs, use iBGP rules </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Preserve local_prefs between POPs </li></ul></ul></ul></ul><ul><ul><ul><li>‘bgp confed identifier 4969’ </li></ul></ul></ul><ul><ul><ul><li>‘bgp confed peers 64512 64513 64514 64515’ </li></ul></ul></ul><ul><ul><ul><li>put in extra confed peers up-front </li></ul></ul></ul>
  169. 170. Logical View of full 16-router Mesh (kudos to danny@genuity)
  170. 171. Confederations C C C C C C C C C C C C C AS 1239 AS 701 AS 4969 AS 64512 AS 64513 AS 64514
  171. 172. AS-Path filters for confederations <ul><ul><li>^$ Doesn’t work any more… </li></ul></ul><ul><ul><li>^$ matches internal routes, but with confederations your routes will look like: </li></ul></ul><ul><ul><li>^(64512 64513)$ as well as ^$ </li></ul></ul><ul><ul><li>ip as acc 55 deny ^(([0-9 ]*))*$ </li></ul></ul>
  172. 173. SCALING WITH ROUTE REFLECTORS
  173. 174. Route Reflector Terminology <ul><ul><li>Client is used to identify “client” of the RR(s). </li></ul></ul><ul><ul><li>Non-client identifies standard BGP peers. </li></ul></ul><ul><ul><li>Cluster is a group of clients under same RR(s). </li></ul></ul><ul><ul><li>Cluster-id unique identifier for a cluster. </li></ul></ul><ul><ul><li>Originator-id router-id of the originator of the route. </li></ul></ul>
  174. 175. Other Issues
  175. 176. Access-List 112: smd <ul><ul><li>Deny 10.0.0.0/8, 172.16.0.0/16, 192.168.0.0/24 </li></ul></ul><ul><ul><li>Permit <= /24s in 192/8-205/8. </li></ul></ul><ul><ul><li>Permit <= /19 in >= 206/8 </li></ul></ul><ul><ul><li>Permit /16 in the old B-space </li></ul></ul><ul><ul><li>Permit <= /8 in the old A-space </li></ul></ul><ul><ul><li>Deny everything else </li></ul></ul>
  176. 177. CISCO CONFIGURATION

×