ip as-path access-list

To configure an access-list filter for Border Gateway Protocol (BGP) autonomous system (AS) numbers, use the ip as-path access-list command. To remove the filter, use the no form of this command.

ip as-path access-list name { deny | permit } regexp

no ip as-path access-list name { deny | permit } regexp

Syntax Description

name
AS path access list name. The name can be any alphanumeric string up to 63 characters.
deny
Rejects packets with AS numbers that match the regexp argument.
permit
Allows packets with AS numbers that match the regexp argument.
regexp
Regular expression to match BGP AS paths. See the Cisco Nexus 7000 Series NX-OS Fundamentals Configuration Guide, Release 4.2.

Command Default

None

Command Modes

Global configuration mode

Command History

Release
Modification
5.0(3)N1(1)
This command was introduced.

Usage Guidelines

You can apply autonomous system path filters to both inbound and outbound BGP paths. Each filter is defined by the regular expression. If the regular expression matches the representation of the autonomous system path of the route as an ASCII string, then the permit or deny condition applies. The autonomous system path should not contain the local autonomous system number.

Examples

This example shows how to configure an AS path filter for BGP to permit AS numbers 55:33 and 20:01 and apply it to a BGP peer for inbound filtering:

switch# configure terminal
switch(config)# ip as-path access-list filter1 permit 55:33,20:01
switch(config) router bgp 65536:20
switch(config-router)# neighbor 192.0.2.1/16 remote-as 65536:20
switch(config-router-neighbor)# address-family ipv4 unicast
switch(config-router-neighbor-af)# filter-list filter1 in
switch(config-router-neighbor-af)#

Related Commands

Command
Description
filter-list
Assigns an AS path filter to a BGP peer.
show ip as-path access-list
Displays information about IP AS path access lists.