Thursday, February 14, 2008

Editing Numbered Access-Lists On The Fly

 

Hi Brian,

I’veheard that items in a numbered ACL can be deleted without taking down the entire ACL. Is it true and how?

Innewer IOS versions sequence numbers can be used to quickly edit, add, and remove entries from a named extended access-list. However in all IOS versions that support named extended access-lists, numbered extended access-lists can actually be treated like named lists where their name is the number. Without sequence numbers you can’t add or edit lines, but if you need to remove a single line from somewhere in the list without deleting it you can. Take the following example:

R1#conf t 
Enter configuration commands, one per line. End with CNTL/Z.R1(config)#access-list100 permit tcp any any
R1(config)#access-list 100 permit udp any anyR1(config)#access-list100 permit ospf any any
R1(config)#access-list 100 permit eigrp any anyR1(config)#doshow access-list 100
Extended IP access list 100 permit tcp any any
permit udp any any permit ospf any any
permit eigrp any any

Nowlet’s suppose that we want to remove the second line that permits udp. Normally we would have to say “no access-list 100″, then recreate the list without line number two. However by treating this like a named access-list we have a second option:

R1(config)#ip access-list extended 100 
R1(config-ext-nacl)#no permit udp any anyR1(config-ext-nacl)#endR1#show access-list 100
Extended IP access list 100 permit tcp any any
permit ospf any any permit eigrp any any

Tada! The list stays intact but the second line has been removed.

ShareThis