Securing BGP Lab: MaxAS

Routing Infrastructure and Security Operations Workshop

 

Introduction

This lab is focused on taking our existing infrastructure and implementing some of the BGP Best Practices to secure the configuration on the router, as covered in the BGP BCP presentation earlier.

The lab work looks at 4 essential configuration features necessary to secure BGP operations on a router:

  1. Limiting the maximum AS-PATH length for received prefixes

  2. Protecting the EBGP Peerings from receiving more than the expected number of prefixes

  3. Generalised TTL Security Mechanism - how to prevent remote attackers from disrupting EBGP sessions

  4. Preventing the propagation of private AS numbers to the Internet

 

Lab Topology

The diagram below is a reminder of the lab topology:

 

Lab 1: Limiting the AS PATH length

The first in the series of exercises to be looked at is limiting the AS PATH length received on prefixes received from other providers around the Internet. The Internet is not very “deep” in that the typical number of AS hops to get from any one operator to any other operator is around five.

 

Background

It is highly unusual in today’s highly interconnected network to see more than 10 or 15 consecutive (and different) AS numbers in any one path. However various researchers and observers of the global routing system have noted instances from time to time where some operators will announce prefixes with extraordinarily long AS PATHs, usually done by inserting dozens or even over one hundred of their own AS number when the prefix is announced. It is not entirely clear why this is being done, and most conclude that it is down to either operator error, operator ignorance, or a misunderstanding of what the AS-PATH attribute is actually used for.

 

Exercise

Cisco IOS has a BGP generic configuration option called maxas-limit. What this does is drop any prefix with an AS-PATH attribute longer than the number of ASes listed in the command.

Each group connects to upstream transit provider, private peer, and public peers via the IXP. We are going to set the maxas-limit command on our Border and Peering routers. There is nothing to be gained by doing this on routers with only IBGP sessions, as we are implementing our BGP policy at the edge of the network, on the EBGP sessions (as discussed in the presentations).

To show you how it works, we will set the AS-PATH length limit to 5. Here is an example for the Border Router, peering with the upstream provider:

router bgp X0
 bgp maxas-limit 5
!

Don’t forget to implement this on the Peering Router as well.

Please note that a value of 5 is not suitable for an Internet connected router receiving the full BGP table and no default route - while the average AS-PATH length is 5 hops, the typical longest usable paths can be up to 15 AS hops. Most operators set the AS-PATH limit to 20 or thereabouts, as noted in the background above.

While you are doing this exercise, the lab instructors will start originating some prefixes from the two Transit providers - you will notice that these prefixes have a very long AS-PATH on them. Check what happens before you implement the above policy, and after you implement it.

Have a look at the router logs - do you see messages like this (taken from an earlier version of this lab):

%BGP-6-ASPATH: Long AS path 122 121 121 121 121 121 121 121 121 121 10 received from 100.122.1.0: BGP(0) Prefixes: 100.68.1.0/24

Also set up the same configuration on your Peering Router, where you peer with your private peer and with the IXP Route Server. It might appear to be less likely that a directly connected peer will originate prefixes with a very long AS-PATH, but the unusual can happen, and it is always better to have consistent policies applied to all EBGP neighbours.

Note: Cisco IOS also has similar commands to limit the number of communities and extended communities attached to prefix announcements. Can you find them from the CLI?

 

Discussion

Discuss amongst your group what you think might be the reasons for these unusually long AS-PATHs.

Here are some possibilities mentioned earlier:

Any others?

The figure below show the last 20 years of the maximum AS-PATH length observed in the global Internet from one vantage point in Japan.

 

Conclusion

This lab has shown how to limit the accepted AS-PATH length on BGP updates. It is recommended to consider implementing such a limit (20 ASNs or thereabouts) on all EBGP sessions configured on the network.