|CCNA Cisco Certification boot camp.|
Access lists regulate network traffic flow and security by using permit and deny statements that filter traffic based on source address, destination address, and protocol type of a packet. They are available for IP, IPX, AppleTalk, and other protocols.
Access lists must be entered in sequentially, you can't move individual statements once they are entered. You can disable the access list with the no access-list [list #] command. It is common to create the access list separately and apply it by copying and pasting it into the router configuration.
To copy an externally created access list, for example from a TFTP server, create the list on the TFTP host and save the file as plain text (ASCII). Then, from your router, use the copy tftp running-config file_id command to copy the access list to your router. Finally, perform the copy running-config startup-config command to save the access list to your router's NVRAM. The first command of an edited access list file should delete the previous access list (for example, type a no access-list command at the beginning of the file) else the new rules will be appended to the end of the access list.
If you telnet into a router and apply an access list, there is the possibility that you could be blocked from the router. To avoid the inconvenience of being locked out, use the command reload in [hh:mm]. This command will cause the router to restart and load a startup-config without the access list that blocked access.
Access List Rules
Access lists must be applied sequentially and they always end with an implicit deny statement. Since all traffic not explicitly permitted in the access list is blocked, using the command access-list [list #] permit any at the end of the access list allows remaining traffic that hasn't been blocked with a deny statement through the interface. This is why you can't append new rules to an access list, any statements added after the permit any or implicit deny command wouldn't be evaluated, a packet is only evaluated by an access list until it matches a statement. You should place first on the list the lines that are most likely to find a match, this will reduce unnecessary processing and save CPU time. To remove an access-list use the command no access-list [list #]. This command removes the entire access list. If you don't remove an access list first, all new lines will be appended to the end of the old one. After you create access lists, you must apply them to an interface so they can filter traffic. They can be either outgoing or incoming filters.
Applying an Access List
Router(config-if)#ip access-group ? <1-199> IP access list (standard or extended) <1300-2699> IP expanded access list (standard or extended) WORD Access-list nameThe following command filters incoming traffic with standard IP access-list 1
Router(config-if)#ip access-group 1 inThe following command filters outgoing traffic with standard IP access-list 1
Router(config-if)#ip access-group 1 out
If the filter direction (in or out) isn't specified, it uses outbound by default. An interface can't have more than one inbound or more than one outbound access list applied to it. Multiple lists are allowed if the lists are for different protocols.Access Lists Follow These Rules
Two Main Types of Access Lists
1. StandardStandard IP Access Lists
Standard IP access lists filter network traffic based on the source IP address. Using a standard access list, you can filter traffic by a host IP address, subnet, or a network address. In order to configure standard IP access lists, you you must first create the access list and then apply it to an interface using the following syntax:
access-list [list #] [permit|deny] [source address] [source wildcard mask]
Wildcard masks are the inverse of the subnet, the 0's are significant and the 1's are not significant. If you compare the source address to the wildcard mask, the source address bits that match up with the 0's specifies the network (only one) and the source address bits that match the 1's are all the hosts to which the list applies.Wildcard Examples
Example for Standard IP Access Lists
Router(config)#access-list 1 deny host 192.168.1.4 Router(config)#access-list 1 permit 0.0.0.0 255.255.255.255 Router(config)#int e0 Router(config-if)#ip access-group 1 out
This access list allows traffic from 192.168.1.4 to enter the router, but the access list denies it from exiting on interface Ethernet 0. The deny statement uses the default wildcard mask of 0.0.0.0 (i.e. all bits are significant and it only applies to one host). The 0.0.0.0 255.255.255.255 can be replaced with the word any. The list is applied to the outbound of one interface as opposed to the inbound. This will prevent the host being blocked from other networks on the router that might not have been intended since traffic from 192.168.1.4 can enter the router and be switched to other networks on interfaces other than ethernet 0. You should apply the standard IP access list as close to the destination network as possible, or you could inadvertently block access to portions of your network. Use the command show access-lists to see the access lists on your router. For just IP access lists use the command show ip access-list.
To remove the access list use the command no access-list [list #]. Use the show ip interface and the show interface commands to verify that an access list has been successfully applied to an interface.Standard IPX Access Lists
Standard IPX Access Lists are similar to standard IP access lists, except they can filter based on source and destination addresses or networks.
access-list [list #] [permit|deny] [source network/ node address] [destination network/ destination address]
The following access list denies IPX network 500 from accessing IPX network 200 on inbound ethernet 0 and then permits all others. This access list should be applied as close to network 500 as possible to reduce network traffic.Example
Router(config)#access-list 800 deny 500 200 Router(config)#access-list 800 permit -1 -1 Router(config)#int e0 Router(config-if)#ipx access-group 800 in
The -1 is like the IP's any command, it applies to all hosts. Standard IPX access lists can be seen with the command show access-lists or show ipx accest-list.
2. ExtendedExtended IP Access Lists
Extended IP access lists can filter based on source IP address, destination
IP address, protocol type, and application destination and source port numbers,
whereas standard IP access lists only filter sources addresses. You also
configure extended IP access lists by creating the list and applying it to an
interface using the following syntax:
access-list [list #] [permit|deny] [protocol] [source IP addr] [source wildcard mask] [operator] [port] [destination IP addr] [destination wildcard mask] [operator] [port] [log]
Example: This access list will block 192.168.1.10 from accessing TCP port www (http) on host 192.168.2.2. The host keyword is a shortcut for the 0.0.0.0 wildcard mask. Since extended IP access lists use destination addresses, the list should be applied as close to the source as possible to reduce unnecessary traffic on the network.
Router(config)#access-list 100 deny tcp host 192.168.1.10 host 192.168.2.2 eq www Router(config)#access-list 100 permit ip any any Router(config)#int e0 Router(config-if)#ip access-group 100 in
To remove the access list use the command no ip access-group [list #]. Use the same commands to monitor an extended IP access list as a standard access list i.e. show access-lists or show ip access-list. Extended IP access lists show the number of matches per line of the access list; to clear these counters, use the command clear access-list counter [list #].Extended IPX Access Lists
Extended IPX access lists allow you to filter based on source and destination network or node address, IPX protocol type, and IPX socket #.
access-list [list #] [permit|deny] [protocol] [source network/ node address] [socket] [destination network/ node address] [socket]
Example: The -1s are for any ipx protocol or network. This access list denies all protocols (-1) and all sockets (0) from IPX network 500 from going to IP network 200 (all sockets also). The access list should be applied to the inbound interface that IPX network 500 is on. This will reduce network traffic and save router resources.
Router(config)#access-list 900 deny -1 500 0 200 0 Router(config)#access-list 900 permit -1 -1 0 -1 0 Router(config)#int e0 Router(config-if)#ipx access-group 900 in
Again you can see the IPX extended access list with the command show access-lists or show ipx acces-list.
IPX SAP Filters
IPX SAP filters limit SAP traffic in order to control what resources on the IPX network will be visible to IPX clients. This allows you to limit the advertisement of particular servers and services to a particular IPX network segment. Since SAP advertisements are broadcasts, limiting them can reduce network traffic. Can be used to block server advertisements between separate departments.access-list [list #] [permit|deny] [source network / node address] [service-type]
Example: Denies all SAP advertisements from network 200, but allows updates to all other network segments.
Router(config)#access-list 1001 deny 200 0 Router(config)#access-list 1001 permit -1 0
To apply a SAP filter to an inbound interface, use the commands:
Router(config)#int e0 Router(config-if)#ipx input-sap-filter 1001OR to apply the access list to an outbound interface, use the commands:
Router(config)#int e0 Router(config-if)#ipx output-sap-filter 1001
This would block all advertisements from network 200 from being passed to other routers on the internetwork. Again you can use the command show access-lists to see the access lists.
Controlling VTY Access
You can control access to VTY ports by applying a standard access list to the VTY lines.
Router_2#conf t Enter configuration commands, one per line. End with CNTL/Z. Router_2(config)#access-list 15 permit host 192.168.1.71 Router_2(config)#line vty 0 4 Router_2(config-line)#access-class 15 in
This will stop all hosts except 192.168.1.71 from telneting into the router. This is accomplished by only allowing one host and then not permitting any other hosts since there is an implicit deny at the end of all access lists.
Certification boot camp back to back.