+ All Categories
Home > Documents > AARNet BGP multihoming

AARNet BGP multihoming

Date post: 03-Feb-2022
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
20
BGP multihoming Mike Groeneweg & Glen Turner, AARNet QUESTNet 2008 workshop 0900―1230 2008-07-08 1. Introduction 1.1 Motivation The AARNet3 network uses BGP to track the reachability of sites' networks. Sites can use BGP to implement connections to several AARNet3 POPs, resulting in a resilient connection to the Internet. Many people do not correctly design these connections. Especially where middleboxes such as firewalls are present, so the redundant links fail to provide resilience when needed. This workshop walks through the establishment of a correctly operating resilient BGP link. It shows the areas where care with design is needed. It shows the tricks of the trade used in BGP routing and in interior routing. 1.2 Today There is a collection of routers: a pair of AARNet routers, a pair of edge router, a pair of firewalls, and a pair of core routers. These replicate the common university network design of Figure 1. — 1 — aarnet Australia's Academic and Research Network Figure 1: Typical university network design Core routers Firewalls Edge routers AARNet routers Application firewalls Application firewalls Internet Building switches PCs
Transcript
Page 1: AARNet BGP multihoming

BGP multihoming

Mike Groeneweg & Glen Turner, AARNetQUESTNet 2008 workshop0900―1230 2008-07-08

1. Introduction

1.1 Motivation

The AARNet3 network uses BGP to track the reachability of sites' networks.Sites can use BGP to implement connections to several AARNet3 POPs, resulting 

in a resilient connection to the Internet. Many people do not correctly design these connections. Especially where middleboxes such as firewalls are present, so the redundant links fail to provide resilience when needed.

This workshop walks through the establishment of a correctly operating resilient BGP link. It shows the areas where care with design is needed. It shows the tricks of the trade used in BGP routing and in interior routing.

1.2 Today

There is a collection of routers: a pair of AARNet routers, a pair of edge router, a pair of firewalls, and a pair of core routers. These replicate the common university network design of Figure 1.

— 1 —

aarnetAustralia's Academicand Research Network

Figure 1: Typical university network design

Corerouters

Firewalls Edgerouters

AARNetrouters

Applicationfirewalls

Applicationfirewalls

Internet

BuildingswitchesPCs

Page 2: AARNet BGP multihoming

That design allows for the failure of any one component or link with the exception of PCs and the switch they are immediately connected to. Dual switch­stacks are typically only justified for computer rooms, and even there creating a clustered application bridging several computer rooms results in higher resilience to faults.

2. Topology basics

A typical campus network design will have three major zones: the core, an edge which faces PCs and servers, and a border which faces the Internet.

There are only two types of links in the network: those with routers connecting with routers, and those with routers serving hosts. There are no router­router links which also service hosts.

Subnets with hosts are not trusted: no interior routing is accepted from those subnets, no MPLS or VLAN tags are seen by those subnets, DSCP tags from those subnets are policed rather than trusted.

Internet border links have some trust in routing, but limited by filtering and limits.

Core router­router links trust routing information and DSCP markings.Subnets are allocated according to Layer 3 principles. In particular, we limit the 

push from accounting and security requirements from breaking the notion that subnets serve a geographic area, such as a building.

3. Routing and forwarding

Routing is the learning of topology and reachability information. This information is stored in a routing table (or routing information base). Forwarding is the movement of packets from a receive to a transmit interface. The specifications for this movement are stored in a forwarding table.

The tables are distinct. Each protocol runs its own routing table. The router runs one forwarding table. The route which is installed into the forwarding table is the one which is:

• the most specific (that is, the longest prefix length). 10.1.1.0/24 is preferred to 0.0.0.0/0.

• from the routing protocol with the lowest administrative distance. A static route is preferred to a OSPF-learned route.

• the best route, according to the rules of the particular routing protocol. A RIP or OSPF metric of 1 is preferred to a metric of 2.

It is strongly desirable that a route be learned through only one routing protocol. There is abundant potential for routing loops when learning the same route using multiple routing protocols. There is usually one protocol used for learning interior routes and one protocol used for learning exterior routes. The interaction between those protocols is held to a minimum.

— 2 —

Figure 2: Course topology, one per desk

core1 firewall1 edge1 cpe1 Internet

Desk switchYour laptops

core2 firewall2 edge2 cpe2

Page 3: AARNet BGP multihoming

3.1 Route administrative distance

Source protocol Distance1

Connected 0

Static 1

BGP 20

EIGRP 90

OSPF 110

IS­IS 115

RIP 120

iBGP 200

Discard 255

Table 1: Administrative distance of common routing protocols

A lower distance displaces a route from a higher distance. Note that a route learned via BGP will displace a route learned via an interior routing protocol such as OSPF.

The default administrative distance value generally for a protocol usually leads to correct operation. The administrative distance value for a prefix can be altered, but this can easily lead to routing loops. The usual reason for altering administrative distance is to migrate from one interior routing protocol to another; for example, the administrative dsitance of EIGRP would be set to >110 to migrate from EIGRP to OSPF.

4. OSPF design basics

The network runs OSPF as its interior routing protocol. Router­router links are in area 0. Links which are solely within a site (such as all router­host subnets) are contained within a stub area and are summarised into area 0. Using a summary route ensures that recurring faults (ie, expensive to process faults) stay local to a site rather than propagating through the entire network.

OSPF is not run on leaf interfaces. This will prevent some types of misconfiguration. This in turn means the topology must supply a non­leaf interconnection between core routers.

MD5 authentication is required on all interfaces running OSPF. This prevents the accidental injection of routes by users of the network.

5. BGP attributes

Each route in BGP has a prefix and prefix length, such as 10.1.1.0/24. There are attributes attached to each route.

5.1 AS path

The list of ASs this route was learned from. For example, a route originated from Internode (AS4739) and then passing through Telstra (AS1221),  Optus (AS7474) and AARNet (AS7575) would have AS path “7575 7474 1221 4739”.

1 Cisco, Juniper, Foundry and Force10 use the same administrative distance values, except for EIGRP which is a protocol unique to Cisco.

— 3 —

Page 4: AARNet BGP multihoming

Note the textual convention of separating each AS number with a space. Regular expressions applied to AS paths usually treat the AS path as a simple string.

Globally visible.

5.2 Next hop

The address which a packet is to be forwarded towards. The address is resolved recursively, so the Next hop does not need modification as it is transported in iBGP.

Globally visible.

5.3 Origin

The source of the prefix. “IGP” from a network statement. “EGP” from another exterior gateway protocol, “unknown” from a redistribute statement.

Globally visible.

5.4 Aggregator

Documentation field of the AS which last aggregated this route.Globally visible.

5.5 Local preference

A cardinal number containing a AS­wide route metric.Visible within an AS.

5.6 Multi-exit discriminator.

A cardinal number containing a AS­side metric which is shared with immediate neighbour networks. Also called MED or metric.

Visible within an AS and its immediate neighbours.

5.7 Weight

A cardinal number containing a router­specific metric.Visible with a router.

5.8 Community

Community. 32b cardinal of unknown meaning. Convention is that top 16b are the AS number which interprets the lower 16b, resulting in a textual convention of as:value, such as 65001:90. There are a number of well­known values and interpretations.

Globally visible.

6. BGP path selection

The bolded numbers are those likely to be seen in practice.1. Do not consider path if no route to Next hop.2. Do not consider iBGP is path not synchronised to IGP (we disable this)3. Highest Weight4. Highest Local preference5. Prefer locally­originated route6. Shortest AS path7. Origin. IGP beats EGP beats Incomplete8. Lowest MED.9. eBGP beats iBGP10. Path with lowest interior routing metric to Next hop11. For eBGP, if multipath enabled install parallel routes12. For eBGP, if no multipath and RouterID of Origin is the same then do 

nothing13. For eBGP if no mulitpath and RouterID differs, select oldest route

— 4 —

Page 5: AARNet BGP multihoming

14.Lowest RouterID15. Shortest Cluster list16. Lowest neighbour IP address

6.1 Influencing routing

Looking at the attributes, some stand out as being desirable for influencing routing.The AS Path length can be artificially increased by prepending your own AS 

number. For example, advertising a AS Paths 65001 65001 65001 to AS1221 and an AS path of 65001 to AS7575 will result in most of the traffic entering the network from AS7575.

Traffic originating from or close to AS1221 to AS65001 may not take the route AS1221­AS7575­AS65001: this will depend on the AS1221­AS65001 connectivity. This small amount of traffic may be problematic if AS1221 charges significantly more than AS7575.

The Multi­exit Discriminator is useful when there are multiple links between two ASs.

The Localpref would be useful, if only the Localpref of AS1221 could be set by AS65001. The BGP communitiy 1221:90 may trigger that action. This feature is not automatic and when considering an ISP for use as a backup service its support for BGP communities should be determined.

The final alternative is simply not to advertise routes into the backup AS1221 until some golden route is no longer seen from AS7575. This technique is called “triggered routing”. This radical change in routing policy may encounter more BGP dampening than other techniques if the route change is repeated within a short interval. It does have the advantage of there being no residual traffic.

6.2 Differences between manufacturers

MED. The RFC says that a missing MED beats a MED. Juniper implement this. Cisco's MED behaviour is all over the place, with bgp deterministic­med giving a useful interpretation: MED defaults to 100, lower values win.

Interoperable behaviour is achieved by this rule: if you advertise MED then set it on all advertisments of the prefix. Typically MED=100 is used on the main link and MED=101 is used on the backup link.Local preference. The RFC says that a present Local preference beats an absent Local preference. So if you set Local preference then set it on all occurances of the route. This is not Cisco's interpretation, they behave as if the LocalPref is always set, with a default value of 100. Typically LocalPref=100 is used on the main link and LocalPref=99 is used on the backup link.

7. BGP design

7.1 Filtering

An ISP will filter all prefixes advertised to it by a downstream network. An enterprise network cannot do similar filtering: that list would be so long as to be not worthwhile. Rather the filtering is based on reasonableness of presented routes.

7.2 Community design

BGP policy is mainly implemented using BGP community values. These values are applied when a route is learned. Actions based on those communities are triggered when a route is advertised.

There are two categories: communities which another network applies and communities which you apply. These should be given distinct patterns, so that a simple 

— 5 —

Page 6: AARNet BGP multihoming

regular expression can easily clear incoming routes of communities which only you should apply.

Community Purpose

:1 When exporting route, set “no­export” community

:2 No export

:3 When exporting route, prepend ASN once

:4 When exporting route, prepend ASN twice

:5 When exporting route, prepend ASN thrice

:6 Discard traffic for this prefix, no export

:70 Set localpref=70

:80 Set localpref=80

:90 Set localpref=90

:100 Set localpref to default

Table 2: A community design for incoming communities

Community values are also used to record information about the route. A enterprise network should consider:

Pricing. Is the route learned from a transit provider or from a free peer.Location. Which router learned the route.Region. Which city or town or campus was the router which learned the route.Router. Which router learned the route.

These communities should be easily manipulable using textual regular expressions. So a sample community design would be:

— 6 —

Page 7: AARNet BGP multihoming

Community Purpose

:1001 Originated

:1002 Learned from free peer

:1003 Learned from subscription transit

:1004 Learned from per­mb transit

:2001 City East campus

:2002 City West campus

:2003 Mawson Lakes campus

:2004 Magill campus

:2005 Mt Gambier campus

:2006 Whyalla campus

:2007 Port Lincoln campus

:3001 Adelaide region

:3002 Limestone Coast region

:3003 Yorke Peninsula region

:3004 Eyre Peninsula region

:4001 Learned by router 10.1.255.1 (edge1)

:4002 Learned by router 10.1.255.2 (edge2)

:400n Learned by router 10.1.255.n (edgen)

:5001 Learned route from main path

:5002 Learned route from backup path

Table 3: A community design for attached communities

Unlike an OSPF route tag, a BGP route can contain many community values. Note how we can delete all of the communities we control with a regular expression of “65001:....” and delete, say, all of the router communities with a regular expression of “65001:4...”.

You can see how comprehensive community tagging when learning a route helps with exporting the route. To export the university's routes from its Adelaide campuses would be to export routes marked with both of the communities :1001 and :2001.

Upstream community values can contain important information. For example, AARNet places a billing category community against each prefix. Thus we are careful not to delete incoming communities and to pass those communities through to other networks.

8. BGP neighbouring

We need some neighbour boilerplate in the router configuration. Most of it is obvious, once you know it is needed. The less obvious aspects are explored below.

8.1 iBGP versus eBGP

Cisco IOS doesn't have an explicit configuration of iBGP versus eBGP. In internal BGP link is to the same ASN as this router. The peering is forced to be from loopback­

— 7 —

Page 8: AARNet BGP multihoming

to­loopback so that any IGP route can be used to maintain the link between the two iBGP routers.

8.2 bgp deterministic-med

The default MED treatment by Cisco routers is somewhat random. This makes MED useful by selecting as the best route the route with the lowest MED.

8.3 soft-reconfiguration inbound

This stores the routes received from the remote router. It is useful when debugging route­maps to compare before and after routes with:

show ip bgp neighbors ... received-routesshow ip bgp neighbors ... routes

It used to be required to use the “clear ip bgp ... soft ...” soft restart commands, but these are implemented as part of the BGP protocols these days. As a result there is no benefit in running soft­reconfiguration on iBGP links (where there is no routing policy to debug).

8.4 next-hop self

This is obviously required for iBGP.It can be used for eBGP. The network will route traffic towards the router, as that 

is how the loopback interface is reached. When the traffic reaches the router the connected interface's administrative distance beats that of iBGP and the traffic exits through the interface.

ISPs often use next­hop self on routes learned by customers to prevent placing the long and less reliable tail links to customers within the ISP's IGP. ISP's IGPs tend to be flat and large so that MPLS can be run between arbitrary routers, so any step to keeping the IGP small is taken.

There is little benefit to a customer network using next­hop self for eBGP.

8.5 bgp router-id

Hardcoding the router ID prevents the router from blackholing should anything happen to the loopback interface (such as a Loopback1 being created). Such incidents are rare, but difficult to recover from.

8.6 maximum-prefix

Routers tend not to have swap disk. There's little point given the difference in speed between hard disks and routing. So when the router runs out of memory it panics and reboots.

To prevent the router running out of memory from being sent too many routes in BGP use “show bgp summary” and “show processes memory” to examine how much memory the routes already received are using, and how many more routes can be received before there is a risk of filling the free memory.

Use that information to set a limit on the number of routes which can be received from a misbehaving neighbour.

8.7 no synchronization

The original intent of BGP was that routes would be received by BGP and then passed within the AS using the IGP. Both BGP and OSPF have features to do this. Synchronisation was one such feature: BGP would not advertise until the IGP had filled its routing table.

Today we use the less efficient but more stable iBGP. There is no need for BGP to wait for the IGP, especially as the IGP and the EGP never carry the same route.

— 8 —

Page 9: AARNet BGP multihoming

9. BGP route import

We do not want to accept routes which should not be in any ISP's routing table. There is a comprehensive “bogon list” of such networks.2 This list is regularly updated as the regional internet registries allocate address space. Although regular updating is suitable for an ISP network it is painful for a campus network. Another approach is to list networks which will never be allocated by a RIR, these are listed in RFC3330.3 We call out the default route and RFC1918 prefixes separately as depending upon the network design these may be acceptable or not.4

The route­maps are named after the AS connected to. This leads to a easy­to­read configuration if there are differing policies for differing neighbours.

route-map AS7575-MAIN-IN-ROUTE deny 10 match ip address prefix-list RFC3330-PREFIXroute-map AS7575-MAIN-IN-ROUTE deny 20 match ip address prefix-list RFC1918-PREFIX

We do not want to accept trivial routes. If we are sent a huge number of routes then we want to keep the significant ones. Discarding host routes (/32) is obvious, and routes under about /27 are considered fair game for filtering.

IPv6 has much better records of minimum allocations in each allocation range, so that protocol does not have the filtering uncertainty of IPv4.5

route-map AS7575-MAIN-IN-ROUTE deny 30 match ip address prefix-list TOO-LONG-PREFIX

We do not want to accept our own address allocations from the ISP. These can be harmless, such as when we advertise our prefix out from our own AS, as BGP AS loop detection will drop the prefix.

These can be harmful, such as when our prefix is advertised by the wrong AS. Remember from Table 1 that exterior routes are better than interior routes, so the results won't be pretty.

route-map AS7575-MAIN-IN-ROUTE deny 40 match ip address prefix-list AS65001-ANY-PREFIX

The same reasoning applies to the ISP advertising the link between our AS and the ISP. Although it is within the ISP's address space, we know exactly where the link is: it is connected to our border router. The ISP will either tell us that or tell us something wrong, either way we don't need to hear it.

route-map AS7575-MAIN-IN-ROUTE deny 50 match ip address prefix-list AS7575-LINK-PREFIX

A site may or may not be willing to accept a default route. AARNet usually sends a default route and the routes of some immediate neighbours.

2 See www.cymru.com/Documents/bogon­list.html3 Internet Assigned Numbers Authority. Special­use IP addresses. RFC3330. Internet Society, CA, 2002.4 Rekhter, Moskowitz, Karrenberg, et al. Address allocation for private internets. RFC1918. ARPANET Network 

Working Group, CA, 1996.5 See www.space.net/~gert/RIPE/ipv6­filters.html

— 9 —

Page 10: AARNet BGP multihoming

When accepting a route we clear our private community range (in this case 65001:1000 to 65001:9999) and set communities indicating which site and which router learned the route.

route-map AS7575-MAIN-IN-ROUTE permit 60 match ip address prefix-list DEFAULT-PREFIX match as-path 100 set local-preference 100 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5001 additive

The :70, :80 and :90 communities are commonly used to set LocalPref. As we will see shortly, this is useful for engineering fallback scenarios. Most sites will not require this policy, but it's simple enough to implement.

Note the large amount of repetition in Cisco route maps. This is a common source of error; Juniper and RtConfig both do a much better job.

route-map AS7575-MAIN-IN-ROUTE permit 70 match community AS65001-70 match as-path 100 set local-preference 70 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5001 additiveroute-map AS7575-MAIN-IN-ROUTE permit 80 match community AS65001-80 match as-path 100 set local-preference 80 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5001 additiveroute-map AS7575-MAIN-IN-ROUTE permit 90 match community AS65001-90 match as-path 100 set local-preference 90 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5001 additiveroute-map AS7575-MAIN-IN-ROUTE permit 100 match community AS65001-100 match as-path 100 set local-preference 100 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5001 additiveroute-map AS7575-MAIN-IN-ROUTE permit 110 match as-path 100 set local-preference 100

— 10 —

Page 11: AARNet BGP multihoming

set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5001 additive

The backup link uses a similar route­map, but sets localpref lower and marks the routes as being learned from a backup link.

route-map AS7575-BACKUP-IN-ROUTE deny 10 match ip address prefix-list RFC3330-PREFIXroute-map AS7575-BACKUP-IN-ROUTE deny 20 match ip address prefix-list RFC1918-PREFIXroute-map AS7575-BACKUP-IN-ROUTE deny 30 match ip address prefix-list TOO-LONG-PREFIXroute-map AS7575-BACKUP-IN-ROUTE deny 40 match ip address prefix-list AS65001-ANY-PREFIXroute-map AS7575-BACKUP-IN-ROUTE deny 50 match ip address prefix-list AS7575-LINK-PREFIXroute-map AS7575-BACKUP-IN-ROUTE permit 60 match ip address prefix-list DEFAULT-PREFIX match ip as-path 100 set local-preference 99 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5002 additiveroute-map AS7575-BACKUP-IN-ROUTE permit 70 match community AS65001-70 match ip as-path 100 set local-preference 69 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5002 additiveroute-map AS7575-BACKUP-IN-ROUTE permit 80 match community AS65001-80 match ip as-path 100 set local-preference 79 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5002 additiveroute-map AS7575-BACKUP-IN-ROUTE permit 90 match community AS65001-90 match ip as-path 100 set local-preference 89 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5002 additiveroute-map AS7575-BACKUP-IN-ROUTE permit 100 match community AS65001-100 match ip as-path 100 set local-preference 99

— 11 —

Page 12: AARNet BGP multihoming

set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5002 additiveroute-map AS7575-BACKUP-IN-ROUTE permit 110 match ip as-path 100 set local-preference 99 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5002 additive

ip as-path access-list 100 permit (^65000_)

ip community-list standard AS65001-70 permit 65001:70ip community-list standard AS65001-80 permit 65001:80ip community-list standard AS65001-90 permit 65001:90ip community-list standard AS65001-100 permit 65001:100

ip community-list expanded AS65001-MY-COMMUNITY permit 65001:....ip community-list expanded AS65001-ANY-COMMUNTY permit 65001:.*

ip prefix-list AS65001-PREFIX description My networks, exactlyip prefix-list AS65001-PREFIX permit 10.1.0.0/16ip prefix-list AS65001-ANY-PREFIX description My networks, or partip prefix-list AS65001-ANY-PREFIX permit 10.1.0.0/16 ge 32

ip prefix-list AS7575-LINK-PREFIX description Link to ISPip prefix-list AS7575-LINK-PREFIX permit 10.101.1.0/30 le 32ip prefix-list AS7575-LINK-PREFIX permit 10.101.2.0/30 le 32

ip prefix-list RFC1918-PREFIX description RFC1918 private networks ip prefix-list RFC1918-PREFIX permit 10.0.0.0/8 le 32ip prefix-list RFC1918-PREFIX permit 172.16.0.0/12 le 32 ip prefix-list RFC1918-PREFIX permit 192.168.0.0/16 le 32

— 12 —

Page 13: AARNet BGP multihoming

ip prefix-list RFC3330-PREFIX description Reserved networks ip prefix-list RFC3330-PREFIX permit 0.0.0.0/8 le 32 ip prefix-list RFC3330-PREFIX permit 127.0.0.0/8 le 32 ip prefix-list RFC3330-PREFIX permit 169.254.0.0/16 le 32 ip prefix-list RFC3330-PREFIX permit 192.0.2.0/24 le 32 ip prefix-list RFC3330-PREFIX permit 198.18.0.0/15 le 32 ip prefix-list RFC3330-PREFIX permit 224.0.0.0/4 le 32 ip prefix-list RFC3330-PREFIX permit 240.0.0.0/4 le 32

ip prefix-list TOO-LONG-PREFIX description /30 and longerip prefix-list TOO-LONG-PREFIX permit 0.0.0.0/0 ge 30

ip prefix-list DEFAULT-PREFIX description Default route ip prefix-list DEFAULT-PREFIX permit 0.0.0.0/0

10. BGP route export

BGP route export can be based on prefixes or based on community values. If you have a simple network policy then use prefixes, if it is more complex then use communities.

route-map AS7575-MAIN-OUT-ROUTE permit 10 match ip address prefix-list AS65001-PREFIX set metric 100 set comm-list AS65001-ANY-COMMUNITY delete

And the alternative route­map for use when this router is running the backup link:

route-map AS7575-BACKUP-OUT-ROUTE permit 10 match ip address prefix-list AS65001-PREFIX set metric 101 set comm-list AS65001-ANY-COMMUNITY delete

Compare this with the community­based approach:

route-map AS7575-MAIN-OUT-ROUTE permit 10 match community AS65001-ORIGINATED-COMMUNITY set metric 100 set comm-list AS65001-ANY-COMMUNITY deleteip community-list standard AS65001-ORIGINATED-COMMUNITY permit 65001:1001

— 13 —

Page 14: AARNet BGP multihoming

Note that we delete our communities when advertising. In general, ISPs should not do this, but enterprise networks should.

11. Injecting routes into BGP

The simplest way is to use a “network” statement.

router bgp 65001 address-family ipv4 network 10.1.0.0 mask 255.255.0.0 route-map AS65001-NETWORK-ROUTE

route-map AS65001-NETWORK-ROUTE permit 10 set community 65001:1001 65001:2001 65001:3001 65001:4001 set origin igp

The communities indicate that the route is originated rather than learned, belongs to the City West campus in Adelaide, and was created by 10.101.255.1.

It is worthwhile re­capping the conditions when a non­redistributed route is advertised: it must be present in the forwarding table, it must exactly match a “network” statement, it must pass all filtering (route­maps, distribute­lists, etc).

We can use the condition of presence in the routing table to for BGP to withdraw a route if the border router loses connectivity with the core. To do that we inject the route at every core router, like so:

router ospf 65001 network 10.1.0.0 0.0.255.255 area 0ip route 10.1.0.0 255.255.0.0 Null0 254

OSPF will then transport that route from the core to the border, as long as that path is up. If the path fails then OSPF running on the border will withdraw the route from the forwarding table. The lack of a matching route in the forwarding table will lead to BGP withdrawing the route.

Hopefully the route will be visible to the Internet through the backup path.

12. Injection into default

We want the default route to be injected into OSPF when we have a default route present in BGP. This is pretty simple

router ospf 65001 default-information originate

We want to have a lower metric when acting as the backup link. We could have a different route­map depending upon the routers current role, or we could trigger the right behaviour from the importing route­map. This is preferred as then only two route­map names on adjacent lines need to be changed to move a link from the main role to the backup role. The injection into OSPF is from the forwarding table, so we need to use a variable which exists in the forwarding table, such as metric. We set tag to indicate the source of the default route, this is useful for debugging and for filtering the reach of the default route between sites.

— 14 —

Page 15: AARNet BGP multihoming

route-map AS7575-MAIN-IN-ROUTE permit 60 match ip address prefix-list DEFAULT-PREFIX match as-path 100 set metric 1 set local-preference 100 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5001 additive

route-map AS7575-BACKUP-IN-ROUTE permit 60 match ip address prefix-list DEFAULT-PREFIX match as-path 100 set metric 2 set local-preference 100 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1004 65001:2001 65001:3001 65001:4001 65001:5001 additive router ospf 65001 default-information originate route-map OSPF65001-DEFAULT-ROUTE

route-map OSPF65001-DEFAULT-ROUTE permit 10 match ip address prefix-list DEFAULT-PREFIX match metric 1 set metric 1 set metric-type type-2 set tag 10route-map OSPF65001-DEFAULT-ROUTE permit 20 match ip address prefix-list DEFAULT-PREFIX match metric 2 set metric 2 set metric-type type-2 set tag 11route-map OSPF65001-DEFAULT-ROUTE permit 30 match ip address prefix-list DEFAULT-PREFIX set metric 666 set metric-type type-2 set tag 19

A Type 2 OSPF route stands apart from a typical OSPF route, in particular a Type 1 and Type 2 route cannot be compared. A Type 2 route is used for injecting exterior routes. It leads to all traffic exiting the network at the lowest Type 2 value, irregardless of the metrics within the OSPF network.

If you take a default­free BGP feed then the process is similar. Generate your own default and use reachability to the root DNS servers to trigger the route's injection.

— 15 —

Page 16: AARNet BGP multihoming

router ospf 65001 default-information originate always route-map OSPF-DEFAULT-ROUTEroute-map OSPF-DEFAULT-ROUTE permit 10 match ip address DNS-A-PREFIX set metric 1 set metric-type type-2route-map OSPF-DEFAULT-ROUTE permit 20 match ip address DNS-B-PREFIX set metric 1 set metric-type type-2

Note that this route­map looks into the forwarding table, and thus can only match attributes found there, not attributes from the BGP routing table.

13. Core-border reachabiliy

We want our prefix withdrawn if the core becomes detached from the border.Generate network prefix at core and sent it towards edge. Two strategies: using 

iBGP or using OSPF. Use OSPF where possible, use BGP where must (eg, middlebox doesn't speak BGP).

14. Multicampus nearest exit

Depending upon the capabilities of the routers, either use OSPF Type­1 routes for the injected defaults with very carefully chosen metrics, or use the OSPF tag on the default route to re­map the metric as the route crosses the link between the sites.

In BGP, each site advertises the its allocation, in our case the /16, plus the more specific routes belonging to that campus.

15. Mutual fallback

Sites can use BGP to offer their neighbours mutual fallback.For example, site­a and site­b can usually use their own Internet links. If site­a's 

link has failure then it routes it traffic via site­b, and vice­versa.This is why we took come care to allow BGP communities unrelated to our site to 

pass through unaltered.

— 16 —

Figure 3: Mutual fallback

site-a

Internet

site-b

Export prefix of site-aExport site-b routes learned from site-bImport site-b routes setting metric=2Import other routes setting metric=1

Export prefix of site-bExport site-b routes learned from site-aImport site-a routes setting metric=2Import other routes setting metric=1

Export prefix prefix of site-a with 7575:90Import site-b routes setting metric=1Import other routes setting metric=2

Export prefix prefix of site-b with 7575:90Import site-a routes setting metric=1Import other routes setting metric=2

site-b

site-a

Page 17: AARNet BGP multihoming

Filtering incoming routes for peers or customer networks is very different to the filtering for upstream networks shown above. For customer networks we filter by exact match.

route-map AS65002-IN-ROUTE permit 10 match ip address prefix-list AS65002-PREFIX match community AS65001-70 match as-path 102 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1000 65001:2000 additive set localpref 70route-map AS65002-IN-ROUTE permit 20 match ip address prefix-list AS65002-PREFIX match community AS65001-80 match as-path 102 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1000 65001:2000 additive set localpref 80route-map AS65002-IN-ROUTE permit 30 match ip address prefix-list AS65002-PREFIX match community AS65001-90 match as-path 102 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1000 65001:2000 additive set localpref 90route-map AS65002-IN-ROUTE permit 40 match ip address prefix-list AS65002-PREFIX match as-path 102 set comm-list AS65001-MY-COMMUNITY delete set community 65001:1000 65001:2000 additive set localpref 100

ip as-path access-list 102 permit ^(_65002)+$

16. Internet route registry

More more and more downstream networks are connected the maintenance of ASn­PREFIX becomes more and more costly. The downstream network gets more and more frustrated as various upstream networks have increasingly inconsistent configurations.

The Internet Routing Registry is the response to this. It contains routing information for the entire Internet. The IRR is a collection of registries: some ISPs maintain their own, others pay for an outsourced service such as RADB.

AARNet maintains entries in RADB on behalf of its customers. If you multihome with AARNet and another ISP you should create your own IRR records and ask AARNet to delete the records it maintains for you.

The IRRToolSet contains RtConfig which can generate router configuration fragments based on the contents of the Internet Routing Registry. Many ISPs regenerate their configurations from IRR on a few “safe” days of the week (eg: Monday to Thursday) and it may be impossible to make changes outside of these days. AARNet regenerates it router configurations when requested.

— 17 —

Page 18: AARNet BGP multihoming

The IRR databases can be individually queried using whois:

$ whois -h whois.radb.net AS7575

A typical entry for a prefix looks like:

route: 129.127.0.0/16 descr: Adelaide University, Adelaide, South Australia origin: AS1851 remarks: Member of Australian Academic and Research Network (AARNet) mnt-by: MAINT-ASAARNET changed: [email protected] 20010921 source: RADB

The RADB cannot contain private AS numbers, so the entry for a prefix which is connected to AARNet using BGP with a private ASN is defined as below. The route appears to networks beyond AARNet as being originated from AARNet's AS7575. AARNet uses a route­set for each private AS to drive its own filtering.

route: 10.1.0.0/16origin: AS7575descr: Example Universityremarks: Route originated by AARNet via private AS65001mnt-by: MAINT-ASAARNETchanged: [email protected] 20080101source: RADB

route-set: AS7575:RS-AS65001members: 10.1.0.0/16descr: Example Universityremarks: Routes accepted by AARNet for private AS65001mnt-by: MAINT-ASAARNETchanged: [email protected] 20080101source: RADB

A site offering mutual fallback to a neighbor could use this route­set to limit imports to AS1851's originated networks.

@RtConfig printPrefix "ip prefix-list AS1851-PREFIX %p/%l\n" filter AS1851

RtConfig is capable of much more complex use. For example, the “import” command will produce a route­map for all of AS1851's exported networks (such as its originated networks and peers and transit networks AS1851 chooses to share with you).

— 18 —

Page 19: AARNet BGP multihoming

17. Denial of service

A denial of service attack can be ameliorated by taking the attacked IP address off the network. The further this can be done at the network edge the better. Upstream and peering networks can allow customers to inject their 

A BGP community can be used to implement this. A simplified configuration is:

interface Null1 ip address 10.255.255.255 255.255.255.255 no ip unreachablesroute-map AS65002-IN-ROUTE permit 10 match as-path 102 match community-list DOS-COMMUNITY match ip access-list prefix-list AS65002-ANY-PREFIX set ip next-hop 10.255.255.255 set community 65001:1000 65001:2000

ip community-list standard DOS-COMMUNITY permit 65001:6ip as-path access-list 102 permit ^(65002)+$ip prefix-list AS65002-ANY-PREFIX 10.2.0.0/16 ge 32

18. BGP dampening

No point doing this for a campus.ISPs do this, but increases in CPU throughput in routers are leading ISPs to 

discard its use.This isn't to say continual flapping is acceptable. ISPs have automated systems to 

detect and discard poor routes.

19. More things to do with BGP

Differential rate limiting. Allow full rate to “on­net” networks, rate limit traffic to “off­net” networks to cap costs.

20. BGP looking glasses

route­views.oregon­ix.net. AARNet hosts a route views mirror. Use this to track historical route changes (ie, WTF just happened).

You can run your own looking glass. Quagga works well. A campus can use iBGP which has the benefit of showing all routes, not just the best route.

21. Instrumentation

Collect SNMP statistics. Use cacti for a trivial network. Use torrus for a big network. These save data in rrdtool format, and there is a wide range of plotting and analysis tools.

Use Nagios to monitor BGP state of neighbours. Cisco can trap if BGP state deteriorates.

22. Flow collection

A campus network collects flows for billing and to have a history for intrusions.A passive optical tap. Use nProbe to generate flow records. Use Snort to do 

instrusion detection. These can site on a network removed from the main switching network. The “hardwired” nature of the optical tap means that many ID 

— 19 —

Page 20: AARNet BGP multihoming

countermeasures fail (these countermeasures are often aimed at a switching infrastructure, as a common tap is a switch in port span mode).

23. Starting dynamips and dynagen

Login into the host using your table's user ID.

$ ssh [email protected]

Start the dynamips server. Table 1 uses 7201, table 2 uses 7202, table 3 uses 7203, table 4 uses 7204.

$ dynamips -H 11000 &

Start the dynagen control process. This starts the routers running.

$ dynagen localhost.net

Load the configuration files into the startup­config and reboot the routers.

=> import /all cfg=> reload /all

You can reach the router's console by telnetting to a port on localhost.

Port Router

1t011 core1 on table t

1t012 firewall1 on table t

1t013 edge1 on table t

1t014 cpe1 on table t

1t021 core2 on table t

1t022 firewall2 on table t

1t023 edge2 on table t

1t024 cpe2 on table t

Glen Turnerhttp://www.gdt.id.au/~gdt/presentations

— 20 —


Recommended