Access list cisco configuration. Advanced ACL Configuration

Understanding Access Control Lists (ACL)

Defining an access control list may seem a challenging and complex task, especially to those that have just delved into the world of computer networking and network security. The aim of this article is to explain the role of access control lists and basic concepts used to understand them. The article also teaches you how to configure them on a Cisco router.

Access control list (in further text: ACL) is a set of rules that controls network traffic and mitigates network attacks. precisely, the aim of ACLs is to filter traffic based on a given filtering criteria on a router or switch interface.

Why use access control lists (ACL)

Initially, ACLs were the only means of providing firewall protection. Even though there are many other types of firewalls and alternatives to ACLs in existence, they are still used today, even in combination with other technologies (like in virtual private networks to define which traffic should be encrypted and sent via VPN tunnel) and you should master them in order to achieve success at the CCNA level and beyond.

  • Limit network traffic to increase network performance
  • Provide traffic flow control
  • Provide a basic level of security for network access by defining which part of the network/server/service can be accessed by a host and which cannot
  • Granular control over traffic entering or existing the network

Types of Access Control Lists

ACLs are primarily divided into two types: standard and extended. We also differentiate between numbered and named ACLs.

Standard ACLs allow filtering traffic solely based on Layer 3 source address written in the header of the IP (Internet Protocol) packet. The command syntax for configuring a standard numbered ACL:

The first value 1-99 or 1300-1999 specifies the standard ACL number range.

The second value specifies whether to permit or deny the configured source IP address traffic.

The third value is the source IP address that must be matched.

The fourth value is the wildcard mask to be applied to the previously configured IP address to indicate the range.

Extended ACLs filter traffic based on Layer 3 and 4 source and destination information thus giving greater flexibility and control over network access than standard ACLs. The Cisco Extended ACL command guide can be found here. The command syntax for configuring an extended numbered ACL:

The first value 100-199 or 2000-2699 specifies the extended ACL number range.

The second value specifies whether to permit or deny traffic according to the criteria that follows.

The third value indicates protocol type, that is, IP, TCP, UDP, ICMP or other IP-sub protocol

access, list, cisco, configuration, advanced

The source and destination IP address and their associated wildcard masks determine where traffic originates and its final destination, respectively.

As already mentioned, it is also possible to create a named ACL, which must be specified as either standard or extended. The command syntax for configuring a named standard or extended ACL:

Router(config)# ip access-list [standard | extended] ACL_name

Upon executing this command, a user is placed into subconfiguration mode where permit and deny commands are entered:

An extended named ACLs offer additional parameters:

After creating the standard or extended ACL, you must apply it to the appropriate interface (or to a VTY line). The command to apply the ACL to an interface:

ACL Example

The idea of this example is to demonstrate the usage of standard and extended numbered ACLs.

On this network, you want to block all remote access to the routers except from PC C2. First, you should create a numbered ACL on all three routers and then apply it to incoming traffic on the VTY lines as follows:

R1(config)# access-list 10 permit 192.168.3.10 0.0.0.0 R2(config)# access-list 10 permit 192.168.3.10 0.0.0.0 R3(config)# access-list 10 permit 192.168.3.10 0.0.0.0

R1(config-line)# access-class 10 in R2(config-line)# access-class 10 in R3(config-line)# access-class 10 in

Then suppose you want to block all packets containing the source IP address from the following pool of addresses on R1: any RFC 1918 private addresses and 127.0.0.0/8. The solution is as follows:

R1(config)# access-list 100 deny IP 10.0.0.0 0.255.255.255 any R1(config)# access-list 100 deny IP 172.16.0.0 0.15.255.255 any R1(config)# access-list 100 deny IP 192.168.0.0 0.0.255.255 any R1(config)# access-list 100 deny IP 127.0.0.0 0.255.255.255 any R1(config)# access-list 100 permit IP any any

R1(config)# interface s0/0/0 R1(config-if)# ip access-group 100 in

I hope this was enough to get you started with ACL or refresh some important notions when preparing for a Cisco Exam.

Free CCNA | Standard ACLs | Day 34 | CCNA 200-301 Complete Course

Is there anything related with ACL that you’d like us to dig into?

Ingrid BeloŇ°a

Ingrid Belosa is a networking enthusiast from Croatia. She is here to help you with grasping networking concepts.

Advanced ACL Configuration

When working with network devices, one of the simplest methods of controlling traffic is using access control lists (ACL). This article extends on the ‘Basic Access List Configuration’ (insert link) article that covered the basics and how to configure a basic access list. This article reviews the different advanced options that exist when implementing ACLs, including lists using both source and destination address, reflexive ACLs, and time-basic ACLs.

Like this article? We recommend 

When working with network devices, one of the simplest methods of controlling traffic is using access control lists (ACL). This article extends on the ‘Basic Access List Configuration’ article that covered the basics and how to configure a basic access list. This article reviews the different advanced options that exist when implementing ACLs, including lists using both source and destination address, reflexive ACLs and time-basic ACLs.

Overview

When trying to control network traffic, it is not often possible to do this with only the source address; this is where more advanced extended ACLs come in. With an extended ACL, it becomes possible to use the source and destination address or network information, as well as a number of other pieces of information, to control traffic. This provides an ACL to be developed that can more specifically target the specific traffic to be filtered. Not only can the list be created to block a specific address or network, but it can be created to block traffic from a specific address or network going to a specific address or network. It is even possible with an extended ACL to define what protocol that is being permitted or denied. As with standard ACLs, there is a specific number range that is used to specify an extended access list; this range is from 100-199 and 2000-2699.

Other advanced ACLs exist (and will also be covered in this article); these include a review of reflexive ACLs and time based ACLs. Reflexive ACLs implement a form of session filtering that can be used to permit traffic back in through an outside interface that was originated inside a network. This is one of many solutions that Cisco offers in their iOS to limit unauthorized traffic into a networking device. Time-based ACLs work the same as other extended ACLs but provide a mechanism that applies the ACL within a specific timeframe. This option is useful in situations where access to the network is only permitted at specific times; for example, during the working day or during a specific event.

Access List Configuration

An extended access list not only provides the ability to match traffic based on the source address but also on a number of other criteria. As the space for this article is limited, the basic options available will be covered; if interested in the full command syntax, visit cisco.com. The command syntax of an extended ACL is as follows:

router(config)#access-list access-list-number deny | permit protocol host hostname host hostname [time-range time-range-name] [established]
router(config)#ip access-list extended access-list-name router(config-ext-nacl)#[sequence-number] permit | deny protocol host hostname host hostname [time-range time-range-name] [established] [reflect name]

  • When creating an extended ACL, the access-list-number will always be from 100-199 or 2000-2699 as stated above.
  • The choice of the permit or deny action dictates what action is being taken.
  • The protocol parameter is used to set the protocol that is being filtered; the common values include ip, tcp, and udp.
  • The source parameter is the source IP network that is being matched by the ACL.
  • The source-wildcard parameter is used to affect the source addresses being matched by the ACL by masking off the target addresses with an inverse mask.
  • The hosthostname parameter is used to match a specific host instead of a network.
  • The destination parameter is the destination IP network that is being matched by the ACL.
  • The destination-wildcard parameter is used to affect the destination addresses being matched by the ACL by masking off the target addresses with an inverse mask; the hosthostname operates the same.
  • The time-rangetime-range-name parameter is used to link a preconfigured time-range with the ACL making it a time based ACL.
  • The established parameter is used to configure a generic form of session filtering when using TCP.
  • The reflectname parameter is used to create a reflexive access list; this parameter is only available with using named ACL configuration mode. This parameter is used along with the evaluate command as shown later in this article.
access, list, cisco, configuration, advanced

The second shown method of configuration uses the named ACL configuration; this method allows some additional functionality that does not exist with the original method including the ability to edit individual lines in an ACL. When using a numbered ACL, the whole list must be deleted and reentered in order to make a change.

In order for an ACL to be functional, it must be applied to a specific interface. When being applied, the access list is configured in a specific direction from the perspective of the interface with the options of coming into the interface (in) or going out of the interface (out). The general rule when applying access lists is to apply standard IP access lists as close to the destination as possible and to apply extended access lists as close to the source as possible. The reasoning for this rule is that standard access lists lack granularity; it is better to implement them as close to the destination as possible. Extended access lists have more potential granularity, thus they are better implemented close to the source. The command syntax to apply an ACL is as follows:

router(config-if)#ip access-group access-list-number | access-list-name in | out

Reflexive access lists allow traffic to be permitted based on an entry in a temporary table. The entries in this table are created when traffic is sourced from an “inside” interface and is going through an “outside” interface. Information about this session is entered into this table and return traffic is monitored. If the returning traffic matches the outbound information recorded in the table it is allowed in through the interface (“outside”); if it does not, it will be denied. For those who are aware of security terminology, a reflexive ACL works similarly to a stateful firewall.

Examples

Examples of configurations of both an extended ACL and a reflective ACL are shown below.

Extended ACL example

Figure 1 shows a simple network topology with a couple different networks.

In this example, an ACL is required to permit the traffic coming from the 10.10.10.0/24 network to the web server at IP address 172.16.1.100/24 on TCP port 80 but deny all other traffic going to the web server. Standard practice says to place an extended ACL as close to the source as possible; however, in this example, traffic is being blocked from several other sources as well that are off different interfaces. If the ACL would be applied at the source interface, the traffic from the other interfaces would not be affected.

The configuration required to setup the ACL in this example is as follows:

router(config)#access-list 100 permit tcp 10.10.10.0 0.0.0.255 host 172.16.1.100 eq 80

Since in this case the access list is supposed to block traffic from all other sources, no other configuration is required as access lists have an implicit deny at the end of them.

The next step would be to apply the ACL onto the correct interface in the appropriate direction. In this case, the best interface to apply the ACL would be on the F0/1 interface outbound. This would restrict all traffic from entering the 172.16.1.0/24 network destined for the web server that did not come from the 10.10.10.0/24 network.

The configuration required to apply the ACL is as follows:

router(config)#interface f0/1 router(config-if)#ip access-group 100 out

Reflexive ACL example

Figure 2 shows a simple network topology that includes an internal network with hosts that access the Internet.

In this example, the goal is to set up a reflexive ACL so that the only traffic that is allowed out the F0/1 interface is TCP traffic, and the only traffic allowed back into the F0/1 interface is TCP traffic that was initiated from the internal network.

The configuration required to setup the ACL in this example is as follows:

router(config)#ip access-list extended out-going router(config-ext-nacl)#permit tcp any any reflect sample-reflection router(config)#ip access-list extended in-coming router(config-ext-nacl)#evaluate sample-reflection

Notice that a named ACL is being used; reflexive ACLs require that a named ACL be used for configuration. These ACLs must be applied to a specific interface; in this case they are both applied to the F0/1 interface.

The configuration required to apply the ACL is as follows:

router(config)#interface f0/1 router(config-if)#ip access-group out-going out router(config-if)#ip access-group in-coming in

Summary

The options available for extended ACLs are quite numerous, and the examples discussed in this article only cover the basics. Hopefully, the content in this article will allow a good base of understanding. If you are interested in the other options available for extended ACLs, please visit cisco.com.

Configuring ACLs

Access Control Lists (ACLs) are an ordered set of rules that you can use to filter traffic. Each rule specifies a set of conditions that a packet must satisfy to match the rule. When the switch determines that an ACL applies to a packet, it tests the packet against the conditions of all rules. The first match determines whether the packet is permitted or denied. If there is no match, the switch applies the applicable default rule.

Learn more with this free online training course on the Meraki Learning Hub:

With Meraki, you only have to define an ACL once in a network and it will be propagated to all switches within that network. Additionally, the default rule for Meraki ACLs is Permit Any Any.

For more detailed information and examples of ACLs, see our MS Switch ACL Operation article.

ACL Location in Meraki Dashboard

To configure an ACL from the Meraki dashboard, navigate to Switch Configure ACL.

Initial Setup

Upon initial setup, you will see that the explicit Permit Any Any rule is defined by default.

Add a Rule

To add a new rule, select the Add a rule button below the list of ACL rules.

Edit a Rule

For each ACL rule, you can define the policy, IP version, source IP address or subnet, source port, destination IP address or subnet, destination port, and VLAN. You also have the option to describe the rule in a comment section.

Note: The source and destination addresses must be an IP address or subnet in CIDR form (e.g. ‘192.168.1.0/24’), or ‘any’.

Note: The VLAN qualifier is not supported on the MS390. For the MS390, ACL rules with non-empty VLAN fields will be ignored.

Move a Rule

To change the position of a specific rule in the ACL, select the crossed arrows symbol to the right of the rule and drag the rule up or down the list.

Remove a Rule

To delete a rule from the ACL, select the x symbol to the far right of the rule.

Save Changes to an ACL

To save changes to the ACL rules, select the Save button below the ACL.

The Save button will be surrounded by an amber bar if there are unsaved changes on the page.

It may take 1-2 minutes for the changes to the ACL to propagate from the Meraki dashboard to the switches in your network.

Monitoring ACLs

Beginning with MS 16, MS platforms (with the exception of MS390) have an ACL Hit Counter live tool on the Tools tab of the switch details page. The tool can be run for 30s, 1min, or 2min, during which time the access-control entries (ACEs) defined in the network-wide Switching ACL page will be displayed under the tool along with hit counts indicating how many frames have matched the ACEs while the live tool is running.

access, list, cisco, configuration, advanced

This tool can be useful for confirming that traffic is being denied or allowed as expected, or that hosts on the network are indeed sending the type of traffic admins expect.

How to create and configure Standard Named Access Control Lists (ACLs)

Before continuing, refer Introduction to Access Control Lists lesson. if you are not familiar with Access Contol Lists.

Refer Standard Access Control Lists lesson if you are not familiar with Standard Access Control List configuration iOS commands.

Refer Named Access Control Lists if you are not familiar with Named Access Control Lists configuration iOS commands.

The basic iOS command to create a Named Access Control List (ACL) is shown below, which is similar to creating a Numbered Access Control List (ACL).

Router(config)# ip access-list standard|extended ACL_name

The standard and extended keywords specify whether it is a Standard Access Control List (ACL) or an Extended Access Control List (ACL).

Standard Named Access Control Lists (ACLs). Lab Practice

The following diagram shows our Standard Named Access Control Lists lab setup. We have three routers, three switches, six workstations and three servers connected as below. The host names, IP addresses and the interfaces of the routers are shown in diagram. The IP addresses of the workstations and the servers are also shown in the diagram.

The purpose of this lab is to deny network 172.16.0.0/16 from accessing the 172.20.0.0/16 network, using Standard Named Access Control List (ACL). Connect computers, switches and routers as shown in the figure. Configure the IP address and default gateway TCP/IP settings in all computers and servers. Configure the hostname, IP address and routing on three routers. Click the following link to learn more about configuring hostnames, IP addresses and Enhanced Interior Gateway Routing Protocol (EIGRP) in routers.

Click the following link to know where to place a Standard Access Control List (ACL). In this lab, the router near to the destination network is Router03, and we have to configure Standard Named Access Control List (ACL) in Router03.

How to create Standard Named Access Control List (ACL) using access-list iOS command

Following iOS commands shows how to create a Standard Named Access Control List (ACL).

Router03enable Router03#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router03(config)#ip accesslist standard BLOCK_NETWORK1 Router03(config-std-nacl)#deny 172.16.0.0 0.0.255.255 Router03(config-std-nacl)#permit any Router03(config-std-nacl)#exit Router03(config)#exit %SYS-5-CONFIG_I: Configured from console by console Router03#

Remember, there is an implicit deny any at the end of every Access Control Lists (ACLs). If there is no permit any statement at the end, above Standard Named Access Control List (ACL) may filter out all traffic to the destination network. The permit any permits any other traffic, if there is no matching deny in previous statements. Above Standard Named Access Control List (ACL) effectively allow all the traffic to the destination network except 172.16.0.0/16 network.

If you want to remove the Access Control List (ACL), use the no form of the command. You cannot delete a specific entry in an Access Control List (ACL). You can only delete the entire Access Control List (ACL), as shown below.

Router03(config)#no access-list BLOCK_NETWORK1

How to configure Standard Named Access Control Lists (ACL) to an interface using access-group command

The Standard Named Access Control List (ACL) created above can be applied using the iOS command shown below.

Router(config)# interface interface_no Router(config-if)# ip access-group ACL_name in|out

The in/out keyword of the command is used to specify the direction in which the traffic is filtered.

The in keyword is used to specify that the traffic should be filtered when it arrive the router via an interface. Following diagram explains the in keyword. Here the traffic will be filtered as it arrives the router.

How to setup and use Standard Access List on a cisco switch

The out keyword is used to specify that the traffic should be filtered as it leaves the router via an interface. Following diagram explains the out keyword. Here the traffic will be filtered as it leaves the router.

The Standard Access Control Lists must be applied close to the destination network. Here the interface close to the destination is fa0/0 in Router03. Following iOS commands apply the Standard Named Access Control List (Access Control List Name. BLOCK_NETWORK1) to the interface fa0/0 (Router03) in out direction.

Router03enable Router03#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router03(config)#interface fa0/0 Router03(config-if)#ip access-group BLOCK_NETWORK1 out Router03(config-if)#exit Router03(config)#exit Router03# %SYS-5-CONFIG_I: Configured from console by console Router03#

If you want to remove the Access Control List (ACL) from the above interface, use the no form of the command as shown below.

Router01(config-if)#no IP access-group BLOCK_NETWORK1 out

What is an Access Control List (ACL)?

A commonly used tool at the Cisco command line is the access control list (ACL). At their simplest, access control lists are collections of IP addresses that are used by a router, switch, or a firewall to identify network traffic that must be handled in a special way. Cisco and other network vendors use ACLs for many different purposes.

This article focuses on iOS access control lists as used on Cisco routers, although much of this discussion applies to Cisco switches as well. Firewalls also use access control lists, but in a more specific way than the many purposes we’ll describe here.

ACLs are used in a few general ways:

  • Securing traffic flowing through a network device. Access control lists are one of the tools a router or firewall uses to decide whether or not to forward traffic. If the ACL permits the flow, the traffic is forwarded; if not, the traffic’s dropped.
  • Securing traffic flowing to a network device. A network device can use ACLs to determine if a particular IP address should be allowed to log into the management interface.
  • Filtering routing updates. Sometimes, you want a router to only advertise a subset of routes outbound to its neighbor, or to filter the routes coming inbound to a neighbor. ACLs can be used to define which routes should be treated normally and which should be filtered.
  • Toidentify interesting traffic. Several different processes running on network devices need to know what traffic is interesting to them. For example, network address translation (NAT) needs to know which traffic should be translated from one IP to another. Custom routing (aka policy-based routing) needs to know which traffic should be forwarded according to the policy, and which can be forwarded via the standard routing table. Quality of service (QoS) policies use ACLs, to determine which traffic is subject to which QoS treatment. VPN tunnels use ACLs to know which traffic should be encrypted or decrypted.

This list is not exhaustive, but lays a foundation for understanding how access lists are used.

Access Control List Examples

Different ACLs are used for different purposes. Let’s take a look at a few of the access control list types that Cisco defines for iOS:

  • Standard ACL creates a list of IP addresses or IP address ranges. Standard access control lists are the simplest type of ACL.
  • Extended ACL has more capability than a standard ACL. An extended ACL lists source and destination IP address pairs, and can even include what sort of traffic is flowing between the pairs. For example, an extended ACL could have an access control entry (ACE) identifying source IP address 10.100.200.3 talking to destination IP address 8.8.8.8 on port UDP 53. Extended ACLs offer fine control for traffic matching. Even more detailed matches are possible, such as matching on TCP flags or type-of-service values.
  • IPv6 access control lists are similar to extended ACLs, but are used specifically for IPv6 addresses.
  • MAC access control lists allow the filtering of traffic using the Ethernet MAC address of the traffic instead of the IP address. MAC ACLs are rarely used in production networks, but illustrate the power and flexibility available to network administrators.
  • Prefix lists are typically used instead of standard ACLs when the goal is to filter routing updates. The syntax for prefix lists is less complicated than that of access control lists, particularly where route filtering is concerned.
access, list, cisco, configuration, advanced

There are several other kinds of access lists in the iOS world, including reflexive, lock and key, and MPLS. We don’t need to go through them all here. It’s enough for now to recognize that there are many different kinds of ACLs for different purposes. That said, the majority of Cisco iOS processes will use standard or extended ACLs, as well as prefix-lists, to identify traffic.

What are some examples of ACLs in action?

ROUTER1#show run | section access-list IP access-list standard MANAGEMENT-STATIONS permit 10.100.201.56 permit 10.100.200.3 permit 10.100.200.9 permit 192.168.100.0 0.0.0.255 ROUTER1#show run | section line vty line vty 0 4 access-class MANAGEMENT-STATIONS in login transport input all line vty 5 15 access-class MANAGEMENT-STATIONS in login transport input all ROUTER1#
ROUTER1#show run | section access-list extended IP access-list extended MATCH-THIS-TRAFFIC permit tcp 10.100.200.0 0.0.0.255 any eq www permit tcp 10.100.200.0 0.0.0.255 any eq ftp ftp-data permit tcp 10.100.200.0 0.0.0.255 any eq 22 deny IP any any log ROUTER1#show run | section interface FastEthernet1/0 interface FastEthernet1/0 IP address 10.100.200.1 255.255.255.0 IP access-group MATCH-THIS-TRAFFIC in duplex auto speed auto ROUTER1#show logging | i IPACCESS May 18 14:38:36.563: %SEC-6-IPACCESSLOGDP: list MATCH-THIS-TRAFFIC denied icmp 10.100.200.100. 50.50.50.50 (8/0), 1 packet May 18 14:39:41.703: %SEC-6-IPACCESSLOGP: list MATCH-THIS-TRAFFIC denied tcp 10.100.200.100(49542). 50.50.50.50(23), 1 packet ROUTER1#

About Ethan Banks

Ethan Banks is a network architect, independent IT writer, frequent conference speaker and co-host of the Packet Pushers Podcast.