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

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

Command Default


Command Modes

Global configuration mode

Command History

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.


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 remote-as 65536:20
switch(config-router-neighbor)# address-family ipv4 unicast
switch(config-router-neighbor-af)# filter-list filter1 in

Related Commands

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