在路由器里插入和删除ACL
在路由器里插入和删除ACE:(如直接添加,后添加的ACE会在ACL的最有一行,由于ACL执行时从上往下顺序匹配,一旦上面的匹配了,下面的就不再执行;如果直接删除某条ACE会将整个ACL删除。) www.zhishiwu.com
R1(config)#access-list 101 permit ip 1.1.1.0 0.0.0.255 2.2.2.0 0.0.0.255
R1(config)#access-list 101 permit ip 1.2.1.0 0.0.0.255 2.2.2.0 0.0.0.255
R1(config)#access-list 101 permit ip 1.3.1.0 0.0.0.255 2.2.2.0 0.0.0.255
1.插入ACE
R1#sh access-lists 101
Extended IP access list 101
10 permit ip 1.1.1.0 0.0.0.255 2.2.2.0 0.0.0.255
20 permit ip 1.2.1.0 0.0.0.255 2.2.2.0 0.0.0.255
30 permit ip 1.3.1.0 0.0.0.255 2.2.2.0 0.0.0.255
R1(config)#ip access-list extended 101
R1(config-ext-nacl)#15 permit ip 1.4.1.0 0.0.0.255 2.2.2.0 0.0.0.255
R1#sh access-lists 101
Extended IP access list 101
10 permit ip 1.1.1.0 0.0.0.255 2.2.2.0 0.0.0.255
15 permit ip 1.4.1.0 0.0.0.255 2.2.2.0 0.0.0.255
20 permit ip 1.2.1.0 0.0.0.255 2.2.2.0 0.0.0.255
30 permit ip 1.3.1.0 0.0.0.255 2.2.2.0 0.0.0.255
2.删除ACE
R1#sh access-lists 101
Extended IP access list 101
10 permit ip 1.1.1.0 0.0.0.255 2.2.2.0 0.0.0.255
15 permit ip 1.4.1.0 0.0.0.255 2.2.2.0 0.0.0.255
20 permit ip 1.2.1.0 0.0.0.255 2.2.2.0 0.0.0.255
30 permit ip 1.3.1.0 0.0.0.255 2.2.2.0 0.0.0.255
R1(config)#ip access-list extended 101
R1(config-ext-nacl)#no 15
R1#sh access-lists 101
Extended IP access list 101
10 permit ip 1.1.1.0 0.0.0.255 2.2.2.0 0.0.0.255
20 permit ip 1.2.1.0 0.0.0.255 2.2.2.0 0.0.0.255
30 permit ip 1.3.1.0 0.0.0.255 2.2.2.0 0.0.0.255