Reflexive Access Lists
December 10th, 2007 neteng
Starting with this post, I’m going to attempt a new format to my lab-type articles. I want to try and maintain some consistency between my presentations, in the hope that they will be cleaner and easier to comprehend. With that in mind, let’s get started!
Topic
Reflexive ACLs
Definition
Reflexive ACLs provide network engineers the tools to implement session filtering, albeit rather crudely. Their creation and application are almost identical to standard and extended access lists, but they are used to create dynamic entries for return traffic when an outgoing connection is attempted. Essentially, dynamic ACL entries are built on the return-traffic interface to allow the other side of the traffic pair to come in. This way, you can practically have an ip deny any any rule on your outside interface (untrusted network) and only allow traffic to come in that was initiated from your inside (trusted) network. Now, this can already be achieved somewhat through the established keyword when creating an access-list; but this only applies to TCP traffic. Reflexive ACLs will keep track of traffic pairs for UDP, ICMP, etc.
For TCP sessions, dynamic entries are removed 5 seconds after two FIN flags are detected (the five seconds allows a graceful shutdown window), or immediately after matching a TCP packet with a RST flag. Entries for all protocols will be removed if idle for the timeout period. One gotcha with reflexive ACLs is when using applications that switch port numbers during a session. A key example of this is FTP. Passive-mode FTP must be used so that a dynamic port is not requested for data transfer traffic.
Before deploying reflexive ACLs, you need to look at your network/traffic flows, and determine how to apply them to your interfaces. Logically, you have two types of interfaces: internal and external. The most typical scenario is to apply the ACLs to the untrusted external network interface (i.e. Internet) of your router. If you happen to have multiple interfaces on the router (i.e. internal, external and DMZ), then you will probably want to configure the reflexive ACLs on your trusted internal interface so as not to affect traffic initiated from the outside to your DMZ.
Reflexive ACLs can only be defined through named extended access lists, but they can be called from other types of access-lists (standard numbered, etc.).
Example
In our example, we’re going to use a simple inside/outside interface configuration. The first thing we need to look at is our traffic policy. The IT manager has decided that he wants to only allow people to surf the web (HTTP/HTTPS) and deny all other traffic. With that in mind, we need to construct an outbound access-list that will reflect our outgoing traffic to an inbound access-list. Basically, outgoing entries will be mirrored, with the incoming and outgoing hosts flipped in the ACL statement. Here’s our topology:

Our configuration will go onto R2. We will initiate traffic from R1 to R3.
With the policy in mind, let’s start our configuration off by creating our access-lists:
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip access-list extended OUTBOUND
R2(config-ext-nacl)#permit tcp any any eq 80 reflect WEB
R2(config-ext-nacl)#permit tcp any any eq 443 reflect WEB
R2(config-ext-nacl)#deny ip any any
Of course, the deny ip any any statement at the end is implied, but I put it in for clarity. You can see that we are reflecting all outbound HTTP/HTTPS traffic to a dynamic ACL named WEB. What we will now do is reference WEB in the inbound ACL so that it will be evaluated before permitting or denying traffic:
R2(config)#ip access-list extended INBOUND
R2(config-ext-nacl)#evaluate WEB
R2(config-ext-nacl)#deny ip any any
Now let’s apply them to our outside interface (FastEthernet1/0):
R2(config)#int fa1/0
R2(config-if)#ip access-group OUTBOUND out
R2(config-if)#ip access-group INBOUND in
Let’s take a look at our ACLs:
R2#show access-list
Extended IP access list INBOUND
10 evaluate WEB
20 deny ip any any
Extended IP access list OUTBOUND
10 permit tcp any any eq www reflect WEB
20 permit tcp any any eq 443 reflect WEB
30 deny ip any any
Reflexive IP access list WEB
You can see that we our reflexive ACL WEB is listed, but currently is devoid of entries. For our test, lets enable HTTP services on R3:
R3(config)#ip http server
Now let’s initiate some HTTP traffic from R1 to R3 and then take a look at our reflexive ACL again:
R2#show access-lists
Extended IP access list INBOUND
10 evaluate WEB
20 deny ip any any
Extended IP access list OUTBOUND
10 permit tcp any any eq www reflect WEB (8 matches)
20 permit tcp any any eq 443 reflect WEB
30 deny ip any any
Reflexive IP access list WEB
permit tcp host 150.1.3.3 eq www host 192.168.12.1 eq 14867 (12 matches) (time left 294)
And there we have it! You can see that there is a timer associated with the dynamic entry. The default is 5 minutes, but this can be changed with the ip reflexive-list timeout
If we tried to send uninitiated traffic from R3 to R1, it would not pass the evaluate statement and therefore, be dropped due to the deny ip any any statement.
Well, that’s about all there is to it folks! Remember, if we ran into a situation where we needed to apply the ACLs to the internal interface, we would simply change the direction in which the reflect and evaluate statements are applied. The reflect statements would now be on the inbound ACL and the evaluate statements would applied to the outbound ACL.
I hope this has been helpful for you!
References
Configuring IP Session Filtering (Reflexive Access Lists) - Cisco.com
neteng
Buy Me a Beer! Help me keep my sanity as I write more articles.Posted in HOWTO, Networking, Security | 1 Comment »









