28.06.2014 Views

Discussion

Discussion

Discussion

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Translated, this match looks for four adjacent occurrences of the AS path 65500. It<br />

would match a path of 65500 65500 65500 65500. Examples of AS paths that this regular<br />

expression would not match are 65500 65500 65500, which has only three occurrences<br />

of the AS number, and 65500 65525 65500 65500 65500, which doesn’t have<br />

four consecutive occurrences of the AS number.<br />

After you define the match criteria in the set as-path command, you then need to<br />

incorporate them into a routing policy. In this recipe, the policy match-AS65500<br />

rejects all routes whose AS path matches the regular expression but accepts all other<br />

routes.<br />

As a final step, apply the policy to your BGP group as an import policy.<br />

To verify that the policy is working, look at the BGP routes in the routing table.<br />

Before applying the policy, routes containing the AS path 65500 65500 65500 65500<br />

are present:<br />

aviva@RouterD> show route protocol bgp<br />

inet.0: 25 destinations, 31 routes (25 active, 0 holddown, 0 hidden)<br />

+ = Active Route, - = Last Active, * = Both<br />

10.0.8.0/24 *[BGP/170] 01:42:26, localpref 100<br />

AS path: 65500 65500 65500 65500 I<br />

> to 10.0.31.2 via t1-0/0/3.0<br />

...<br />

The route to 10.0.8.0/24 is active (indicated by the asterisk). After applying the policy,<br />

the route is no longer in the routing table:<br />

aviva@RouterD> show route 10.0.8.0/24<br />

inet.0: 25 destinations, 31 routes (14 active, 0 holddown, 14 hidden)<br />

This output shows that there are now 14 hidden routes. This is where you find the<br />

routes that your policy rejected:<br />

aviva@RouterD> show route 10.0.8.0/24 hidden<br />

inet.0: 25 destinations, 31 routes (14 active, 0 holddown, 14 hidden)<br />

+ = Active Route, - = Last Active, * = Both<br />

10.0.8.0/24 [BGP ] 01:44:48, localpref 100<br />

AS path: 65500 65500 65500 65500 I<br />

> to 10.0.31.2 via t1-0/0/3.0<br />

Because the route is hidden, there is no preference associated with it. The route is<br />

marked as [BGP ] instead of [BGP/170].<br />

Routes that originate within your AS do not yet have an AS path associated with<br />

them. To find them with an as-path policy, create a match condition based on the<br />

null AS path:<br />

[edit policy-options]<br />

aviva@RouterF# set as-path local-as "( )"<br />

[edit policy-options policy-statement null-path]<br />

aviva@RouterF# set term accept-null-path from protocol bgp<br />

aviva@RouterF# set term accept-null-path from as-path local-as<br />

Filtering BGP Routes Based on AS Paths | 447<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!