Zum Inhalt springen

AB 20 — Access Control Lists (ACLs)

Mein Fortschritt0/10 (0 %)

Although many different protocols can use access control lists, the CCNA vendor exams are concerned only with IPv4 ACLs. The following chart shows some of the other protocols that can use ACLS.

1-99 or 1300-1999Standard IPv4
100-199 or 2000-2699Extended IPv4
600-699AppleTalk
800-899IPX
900-999Extended IPX
1000-1099IPX Service Advertising Protocol

Using Wildcard Masks

When compared to an IP address, a wildcard mask identifies which addresses get matched to be applied to the permit or deny argument in an access control list (ACL) statement:

  • A 0 (zero) in a wildcard mask means to check the corresponding bit in the address for an exact match.

  • A 1 (one) in a wildcard mask means to ignore the corresponding bit in the address – can be either 1 or 0. In the examples, this is shown as x.

  • Example: 172.16.0.0 0.0.255.255

172.16.0.0 = 10101100.00010000.0000000.00000000

0.0.255.255 = 00000000.00000000.11111111.11111111

Result = 10101100.00010000.xxxxxxxx.xxxxxxxx

172.16.x.x (Anything between 172.16.0.0 and 172.16.255.255 will match the example statement.)

Tip

An octet of all 0s means that the octet has to match exactly to the address. An octet of all 1s maens that the octet can be ignored.

anyUsed in place of 0.0.0.0 255.255.255.255, will match any address that it is compared against.
hostUsed in place of 0.0.0.0 in the wildcard mask, will match only one specific address.

Note

Standard ACLs are the oldest type of ACL. They date back as early as Cisco IOS Release 8.3. Standard ACLs control traffic by comparing the source of the IP packets to the addresses configured in the ACL.

Router(config)#access-list 10 permit 172.16.0.0 0.0.255.255Read this line to say, “all packets with a source IP address of 172.16.x.x will be permitted to continue through the internetwork.
access-listACL command.
10Arbitrary number between 1 and 99, or 1300 and 1999, designating this as a standard IP ACL.
permitPackets that match this statement will be allowed to continue.
172.16.0.0Source IP address to be compared to.
0.0.255.255Wildcard mask
Router(config)#access-list 10 deny host 172.17.0.1Read this line to say, “all packets with a source IP address of 172.17.0.1 will be dropped and discarded.”
access-listACL command.
10Arbitrary number between 1 and 99, or 1300 and 1999, designating this as a standard IP ACL.
denyPackets that match this statement will be dropped and discarded.
hostKeyword.
172.17.0.1Specific host address.
Router(config)#access-list 10 permit anyRead this line to say, “all packets with any source IP address will be permitted to continue through the internetwork.”
access-listACL command.
10Arbitrary number between 1 and 99, or 1300 and 1999, designating this as a standard IP ACL.
permitPackets that match this statement will be allowed to continue.
anyKeyword to mean all IP addresses.

Tip

An implicit deny statement is hard coded into every ACL. You cannot see it, but it states, “deny everything not already permitted.” This is always the last line of any ACL. If you want to defeat this implicit deny, put a permit any statement in your standard ACLs or permit ip any any in your extended ACLs as the last line.

Router(config)#interface gigabitethernet 0/0Moves to interface configuration mode.
Router(config-if)#ip access-group 10 inTakes all access list lines that are defined as being part of group 10 and applies them in an inbound manner. Packets going into the router from giga-bitethernet 0/0 will be checked.

Tip

Access lists can be applied in either an inbound direction (keyword in) or in an outbound direction (keyword out).

Tip

Not sure in which direction to apply an ACL? Look at the flow of packets.

  • Do you want to filter packets as they are going in a router’s interface from an external source? Use the keyword in for this ACL.

  • Do you want to filter packets as they go out of the router’s interface toward another device= Use the keyword out for this ACL.

Tip

Apply a standard ACL as close as possible to the destination network or device.

Router#show ip interfaceDisplays any ACLs applied to that interface
Router#show access-listsDisplays the contents of all ACLs on the router
Router#show access-list access-list-numberDisplays the contents of the ACL by the number specified
Router#show access-list nameDisplays the content of the ACL by the name specified
Router#show run
Router(config)#no access-list 10Removes all ACLs numbered 10

Note

Extended ACLs were also introduced in Cisco IOS Release 8.3. Extended ACLs control traffic by comparing the source and destination of the IP packets to the addresses configured in the ACL. Extended ACLs can also filter packets using protocol/port numbers for a more granular filter.

Router(config)#access-list 110 permit tcp 172.16.0.0.0 0.0.0.255 192.168.100.0 0.0.0.255 eq 80Read this line to say, “HTTP packets with a source IP address of 172.16.0.x will be permitted to travel to the destination address 192.168.100.x.”
access-listACL command.
110Number is between 100 and 199, or 2000 and 2699, designating this as an extended IP ACL.
permitPackets that match this statement will be allowed to continue.
tcpProtocols must be TCP.
172.16.0.0Source IP address to be compared to.
0.0.0.255Wildcard mask for the source IP address.
192.168.100.0Destination IP address to be compared to.
0.0.0.255Wildcard mask for the destination IP address.
eqOperand, means « equal to ».
80Port 80, indicating HTTP trafic.
Router(config)#access-list 110 deny tcp any 192.168.100.7 0.0.0.0 eq 23Read this line to say, “Telnet packets with any source IP address will be dropped if they are addressed to specific host 192.168.100.7.”
access-listACL command.
110Number is between 100 and 199, or 2000 and 2699, designating this as an extended IP ACL.
denyPackets that match this statement will be dropped and discarded.
tcpProtocols must be TCP.
anyAny source IP address.
192.168.100.7Destination IP address to be compared to.
0.0.0.0Wildcard mask: address must match exactly.
eqOperand, means “equal to.”
23Port 23, indicating Telnet traffic.
Router(config)#interface gigabitethernet 0/0 Router(config-if)#ip access-group 110 outMoves to interface configuration mode and takes all access list lines that are defined as being parts of a group 110 and applies them in an outbound manner. Packets are going gigabitethernet 0/0 will be checked.

Tip

Access lists can be applied in either an inbound direction (keyword in) or in an outbound direction (keyword out).

Only one access list can be applied per interface, per direction.

Apply an extended ACL as close as possible to the source network or device.

The network topology for the configuration that follows shows five ACL examples using the commands covered in this chapter.

Example 1: Write an ACL that prevents the 10.0 network from accessing the 40.0 network but allows everyone else to.

RedDeer(config)#access-list 10 deny 172.16.10.0 0.0.0.255The standard ACL denies complete network for complete TCP/IP suite of protocols.
RedDeer(config)#access-list 10 permit anyDefeats the implicit deny.
RedDeer(config)#interface gigabitethernet 0/0Moves to interface configuration mode.
RedDeer(config)#ip access-group 10 outApplied ACL in an outbound direction.

Example 2: Write an ACL that states that 10.5 cannot access 50.7. Everyone else can.

Edmonton(config)#access list 115 deny ip host 172.16.10.5 host 172.16.50.7The extended ACL denies specific hostfor entire TCP/IP suite to a specific destination.
Edmonton(config)#access list 115 permit ip any anyAll others are permitted through.
Edmonton(config)#interface gigabitethernet 0/0Moves to interface configuration mode.
Edmonton(config)#ip access-group 115 inApplies the ACL in an inbound direction.

Example 3: Write an ACL that states that 10.5 can Telnet to the Red Deer router. No one else can.

RedDeer(config)#access-list 20 permit host 182.16.10.5The standard ACL allows a specific host access. The implicit deny statement filters everyone else out.
RedDeer(config)#line vty 0 4Moves to virtual terminal lines configuration mode.
RedDeer(config-line)#access-class 20 inApplied ACL 20 in an inbound direction. Remember to use access-class, not access-group.

Example 4: Write a named ACL that states that 20.163 can Telnet to 70.2. No one else from 20.0 can Telnet to 70.2. Any host from any other subnet can connect to 70.2 using anything that is available.

Calgary(config)#ip access-list extended serveraccessCreates a named ACL and moves to named ACL configuration mode.
Calgary(config-ext-nacl)#10 permit tcp host 172.16.20.163 host 172.16.70.2 eq telnetThis specific host is permitted Telnet access to a specific destination.
Calgary(config-ext-nacl)#20 deny tcp 172.16.20.0 0.0.0.2555 host 172.16.70.2 eq telnetNo other hosts are allowed to telnet to the server.
Calgary(config-ext-nacl)#30 permit ip any anyDefeats the implicit deny statement and allows all other traffic to pass through.
Calgary(config-ext-nacl)#exitReturns to global configuration mode.
Calgary(config)#interface gigabitethernet 0/0Moves to interface configuration mode.
Calgary(config)#ip access-group serveraccess outSets the ACL named serveraccess in an outbound direction on the interface.

Example 5: Write an ACL that states that hosts 50.1-60.63 are not allowed web access to 80.16. Hosts 50.64-50.254 are. Everyone can do everything else.

RedDeer(config)#access-list 101 deny tcp 172.16.50.0 0.0.0.63 host 172.16.80.16 eq 80Creates an ACL that denies HTTP traffic from a range of hosts to a specific destination
RedDeer(config)#access-list 101 permit ip any anyDefeats the implicit deny statement and allows all other traffic to pass through
RedDeer(config)#interface gigabitethernet 0/0Moves to interface configuration mode
RedDeer(config)#ip access-group 101 inApplied the ACL in an inbound direction
  • Was sind ACLs und wozu dienen diese?

  • Was ist der Unterschied zwischen einer Standard ACL und einer Extended ACL?

Erstelle das obere Netzwerk und konfiguriere die folgenden ACLs auf Router 0:

  • Nur der Web-Service des öffentlichen Web Servers soll übers Internet erreichbar sein.

  • Der Web-Service des Intranet Servers soll aus dem Development Netzwerk, aber auch aus dem Marketing-Netzwerk erreichbar sein. Andere Verbindungen des Marketing-Netzwerks ins Development Netzwerk sollen geblockt werden.

  • Sowohl die Mitarbeiter der Marketing-Abteilung als auch die Mitglieder der Development Abteilung, sollen Verbindungen zu Servern im Internet initialisieren und deren Dienste nutzen können. So soll z.B. der Dienst des Foreign Web Servers verfügbar sein. Informiere dich über das Schlüsselwort established und ändere die ACLs so um, dass dies möglich ist.

  • Da aus dem Netzwerk 172.17.0.0/16 dauernd Attacken auf den öffentlichen Webserver beobachtet werden, soll nur dieses Netzwerk keine Verbindung mehr zum öffentlichen Web Server herstellen können.

Die folgenden beiden Links werden dir die Arbeit erleichtern:

https://www.computernetworkingnotes.com/ccna-study-guide/configure-extended-access-control-list-step-by-step-guide.html

https://www.omnisecu.com/cisco-certified-`network`-associate-ccna/how-to-create-and-configure-extended-named-access-control-lists.php

Abbildung

Abbildung

Abbildung

Welche Aussagen zu Access Control Lists (ACLs) sind richtig?