Access Control Lists Overview
Access Control Lists Overview
Access lists allow Cisco routers to function as a packet filter and are
supported for several protocols, some of them are listed in the
following table:
Protocol Range
DecNet 300-399
XNS 400-499
AppleTalk 600-699
Access lists are lists of rules that either permit or deny certain inbound or
outbound traffic from particular hosts. The list is applied to one or more interfaces
on the router. When the router routes traffic in and out these interfaces, the rules
in the list are processed sequential, looking for a matching rule permitting the
traffic to pass. When there is not matching rule permitting the traffic to pass it is
denied because of the implicit deny any at the end of each rule. For example, if
you deny telnet traffic to host 172.16.22.139 using the rule:
access-list 110 deny TCP any host 172.16.22.139 eq TELNET
and this would be the only rule in the access list you would deny any IP traffic
from entering or leaving the router's interface.
The implicit deny all, for many, is a confusing part of access lists and often
forgotten in practice, while in fact it is very logical; if you want to protect a
network using a packet filter you would typically start out with denying
everything and from there permit certain traffic or hosts to communicate.
However, instead of protecting private networks from external intruders, access
lists are also commonly used to manage network traffic, for example, if you do
not want certain protocols or services available in particular subnets you can
block only those ports but permit all other traffic. This is also used as an effective
way to prevent traffic such as ICMP messages and routing updates from traveling
over certain links.
Use the Interface config mode access-group command to bind the access list to
an interface:
router(config-if)#ip access-group number in|out
For example, to deny host C from sending traffic to the WAN in the network
depicted in the diagram below, use the following commands.
router(config)#access-list 10 deny 192.168.23.11
router(config)#access-list 10 permit any
router(config)#interface ethernet 0
router(config-if)#ip access-group 10 in
When traffic is send to the router's Ethernet interface the rules in access list 10
are processed, if the traffic is send by host C the router drops the packets and
stops processing the rules. The rule access-list 10 permit any is included because
of the implicit deny. There must be at least one "permit" rule otherwise the
protocol is completely disabled for the interface as soon as you bind it.
The first example is simple: if you want to deny access to all hosts
in the network 172.16.23.0 with subnet mask 255.255.255.0 you
would use 172.168.23.0 0.0.0.255as the source in the access-
list command. When the router checks if the addressing information
of an incoming packet matches the denied address specified in the
access list, it only cares about the part of the address where the
corresponding bits in the inverse mask are 0. The part of the
address where the corresponding bits in the inverse mask are set to
1 can be anything (in this example 0 to 255).
Use the global exec access-list command to create access lists, this
command supports numerous arguments, most of them are beyond
the scope of the CCNA exam. Cisco explains the complete syntax at
it's web site. Nevertheless, here's the most important part:
router(config)#access-list number deny|permit protocol source|any
destination|any
When TCP or UDP is used as the protocol argument two other important
arguments are operator port. The port argument can be a TCP or UDP port
number or name (e.g. 21 or FTP, 23 or TELNET, 123 or NTP), the operator is
usually eq which means equal, other options include lt (less than) and gt (greater
than).
Use the Interface config mode access-group command to apply the access list to
an interface:
router(config-if)#ip access-group number in|out
You can prevent SMTP traffic originating from the WANs from
traveling over link A by putting an outbound extended IP access list
on the Serial 0 interface of RouterX. Use the following commands on
RouterX:
router(config)#access-list 105 deny TCP any host 172.16.11.253 eq SMTP
router(config)#access-list 105 permit IP any any
router(config)#interface serial 0
router(config-if)#ip access-group 105 out
For example:
router(config)#no access-list 102
VTY Lines
You can also use standard access lists to limit access to VTY lines.
For example:
router(config)#access-list 5 permit 192.168.23.8
router(config)#line 0 5
router(config)#access-class 5 in
The following command displays the contents of an access list, and if applied to
an interface, the number of matches per permit/deny rule:
router(config)#show access-lists number|name
If you don't specify an access-list number or name, all the current access lists will
be displayed. You can also use the show ip access-lists command to display one
or all the current IP access lists.