Saturday, December 27, 2008

How to edit standard/extended access-lists without using notepad ?

In newer 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-list 100 permit tcp any any
R1(config)#access-list 100 permit udp any any
R1(config)#access-list 100 permit ospf any any
R1(config)#access-list 100 permit eigrp any any
R1(config)#do show access-list 100
Extended IP access list 100
permit tcp any any
permit udp any any
permit ospf any any
permit eigrp any any

Now let'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 any
R1(config-ext-nacl)#end

R1#show access-list 100
Extended IP access list 100
permit tcp any any
permit ospf any any
permit eigrp any any

See :-) ! The list stays intact but the second line has been removed.

Best Regards,
Deepak Arora

No comments: