Using Named and Reflexive Access-Lists
Problem
You want to use a reflexive ACL, embedded in a named ACL.
Solution
A basic named ACL is similar to the numbered ACLs that we discussed earlier in this chapter. They can work like either Standard or Extended IP ACLs:
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#ip access-list standard
Router1(config-std-nacl)#
STANDARD-ACL
remark
Router1(config-std-nacl)#
This is a standard ACL
permit any log
Router1(config-std-nacl)#exit
Router1(config)#ip access-list extended
Router1(config-ext-nacl)#
EXTENDED-ACL
remark
Router1(config-ext-nacl)#
This is an extended ACL
deny tcp any any eq www
Router1(config-ext-nacl)#permit ip any any log
Router1(config-ext-nacl)#exit
Router1(config)#interface
Router1(config-if)#
Serial0/1
ip access-group
STANDARD-ACL
in
Router1(config-if)#exit
Router1(config)#end
Router1#
You can embed a reflexive ACL inside of a named Extended IP ACL. The reflect keyword defines the reflexive ACL rule, and the evaluate command executes it. The following example filters ICMP packets so that you can initiate a PING test from one side of the network, but not the other:
Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router1(config)#ip access-list extended
Router1(config-ext-nacl)#
PING-OUT
permit icmp any any reflect
ICMP-REFLECT
timeout
Router1(config-ext-nacl)#
15
permit ip any any
Router1(config-ext-nacl)#exit
Router1(config)#ip access-list ...
Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.