3-Access - List Ccna Security Ipv4 Ipv6
3-Access - List Ccna Security Ipv4 Ipv6
SECURITY OF NETWORK
ENG. ABDELSALAM SALEH ELRASHDI
Outline
IP ACL Operation
Standard IPv4 ACLs
Extended IPv4 ACLSs
Contextual Unit: Debug with ACLs
Troubleshoot ACLs
Contextual Unit: IPv6 ACLs
Summary
ACL
After completing this chapter, students will be able to:
◦ Explain how ACLs are used to filter traffic.
◦ Compare standard and extended IPv4 ACLs.
◦ Explain how ACLs use wildcard masks.
◦ Explain the guidelines for creating ACLs.
◦ Explain the guidelines for placement of ACLs.
◦ Configure standard IPv4 ACLs to filter traffic according to networking requirements.
◦ Modify a standard IPv4 ACL using sequence numbers.
◦ Configure a standard ACL to secure vty access.
◦ Explain the structure of an extended access control entry (ACE).
◦ Configure extended IPv4 ACLs to filter traffic according to networking requirements.
◦ Configure an ACL to limit debug output.
◦ Explain how a router processes packets when an ACL is applied.
◦ Troubleshoot common ACL errors using CLI commands.
◦ Compare IPv4 and IPv6 ACL creation.
◦ Configure IPv6 ACLs to filter traffic according to networking requirements.
Access Control Lists
(ACLs)
Access Control Lists (ACLs)
1
An ACL is a sequential list of of permit or deny statements, known as access control entries
(ACEs).
◦ ACEs are also commonly called ACL statements.
ACLs control whether a router permits or denies packets based on criteria in the header that
identifies the:
◦ Source IP address
◦ Destination IP address
◦ IP protocols (ICMP, TCP, UDP, EIGRP, …)
◦ TCP/UDP source port
◦ TCP/UDP destination port
ACL Operation
Extended ACLs
Can permit or deny traffic for:
Protocol type IP (IP, ICMP, EIGRP, OSPF, TCP, UDP, …)
Source IP address
Source TCP or UDP ports
Destination IP address
Destination TCP or UDP ports
Numbered and Named ACLs
Wildcard Mask
Standard and Extended ACLs both use wildcard masks.
◦ Wildcard masks and subnet masks differ in the way they match binary 1s and 0s.
Wildcard masks use the following rules to match binary 1s and 0s:
◦ Wildcard mask bit 0 - Match the corresponding bit value in the address
◦ Wildcard mask bit 1 - Ignore the corresponding bit value in the address
Calculating Wildcard Masks #1
Calculating wildcard masks can be difficult, but you can do it easily by
subtracting the subnet mask from 255.255.255.255.
For example, assume you wanted to permit access to all users from the
192.168.3.0 /24
◦ Subtract the subnet mask (255.255.255.0) from the subnet mask 255.255.255.255.
255.255.255.255
-255.255.255. 0
0. 0. 0.255
255.255.255.255
-255.255.255.240
0. 0. 0. 15
Decimal Binary
IP Address 192.168.1.1 11000000.10101000.00000001.00000001
The host keyword can be used to substitute for the 0.0.0.0 wildcard mask.
This mask states that all IPv4 address bits must match or only one host is matched.
Decimal Binary
IP Address 0.0.0.0 00000000.00000000.00000000.00000000
Extended ACLs - This way, undesirable traffic is denied close to the source network
without crossing the network infrastructure.
Standard ACLs - Because standard ACLs do not specify destination addresses, place
them as close to the destination as possible.
Placing a standard ACL at the source of the traffic will effectively prevent that traffic
from reaching any other networks through the interface where the ACL is applied.
ACL Placement
Placement of the ACL and therefore the type of ACL used may also depend
on:
The extent of the network administrator’s control
Bandwidth of the networks involved
Ease of configuration
Can only permit/deny based on source address.
Will deny traffic to all sites.
Why here?
OR
Configuring Standard IPv4 ACLs
Numbered and Named
How are ACLs
Created?
In Two Steps!
permit | deny are terms to specify how the packets which meet the condition will be
handled.
permit: Implies the packet will not be filtered.
deny: Implies the packet will be filtered.
remark: Allows you to enter a description of the ACL
2. Apply the ACL to an interface
SAME AS
32
Removing an ACL
Step 3: Apply the ACL to the interface using the ip access-group command
X
R1(config)# ip access-list standard NO_ACCESS
R1(config-std-nacl)# deny host 192.168.11.10
R1(config-std-nacl)# permit any
R1(config-std-nacl)# exit
R1(config)# interface g0/0
R1(config-if)# ip access-group NO_ACCESS out
Commenting ACLs
But what make them really special is that they can also filter based on:
◦ Upper layer protocols (e.g., IP, TCP, UDP, ICMP, EIGRP, …)
◦ Source port
◦ Destination port
Extended ACLs Syntax
Extended ACLs also filter on Protocol and Destination address.
The choice of Protocol adds
All extended ACLs follow this basic syntax. various other options.
IP 20 (FTP-data)
100- LT
199 TCP 21 (FTP)
GT
UDP any any 23 (TELNET)
EQ
2000 ICMP host host 25 (SMTP)
NEQ
to EIGRP 53 (DNS)
2699
OSPF 80 (HTTP)
Use ? examples.
Extended IP ACLs Examples
access-list 101 permit ip any any
Deny all packets from any source address going specifically to host 10.1.1.1.
Deny all packets from host 10.1.1.1 going to any destination address.
Extended TCP ACLs Examples
access-list 101 deny tcp any any eq telnet
Same function as last example; except it denies using the keyword telnet.
Extended TCP ACLs Examples
Any TCP packets whose source port is 23 are denied access to any destination.
Extended TCP ACLs Examples
Any TCP packets whose source port is 23 are denied access to any destination.
S0/0/0 S0/0/1
10.1.1.1/30
R1 G0/1
R3
G0/0
192.168.10.0/24 192.168.11.0/24
S1 S2
The established parameter allows only responses to traffic that originates from the
192.168.10.0/24 network to return to that network.
Without the established parameter in the ACL statement, clients could send traffic to a
web server, but not receive traffic returning from the web server.
Applying Extended ACLs to Interfaces
S0/1/0
S0/0/0 S0/0/1
10.1.1.1/30
R1 G0/1
R3
G0/0
192.168.10.0/24 192.168.11.0/24
S1 S2
R1(config)#interface g0/0
R1(config-if)# ip access-group 103 in
R1(config-if)# ip access-group 104 out
Deny FTP and Permit Everything Else
S0/1/0
S0/0/0 S0/0/1
10.1.1.1/30
R1 G0/1
R3
G0/0
192.168.10.0/24 192.168.11.0/24
S1 S2 FTP X
S0/0/0 S0/0/1
10.1.1.1/30
R1 G0/1
R3
G0/0
192.168.10.0/24 192.168.11.0/24
S1 S2
Telnet
X
R1(config)# access-list 102 deny tcp any 192.168.11.0 0.0.0.255 eq 23
R1(config)# access-list 102 permit ip any any
S0/0/0 S0/0/1
10.1.1.1/30
R1 G0/1
R3
G0/0
192.168.10.0/24 192.168.11.0/24
S1 S2
R1(config)# ip access-list extended SURFING
R1(config-ext-nacl)# permit tcp 192.168.10.0 0.0.0.255 any eq 80
R1(config-ext-nacl)# permit tcp 192.168.10.0 0.0.0.255 any eq 443
R1(config-ext-nacl)# exit
R1(config)# ip access-list extended BROWSING
R1(config-ext-nacl)# permit tcp any 192.168.10.0 0.0.0.255 established
R1(config-ext-nacl)# exit
R1(config)# interface g0/0
R1(config-if)# ip access-group SURFING in
R1(config-if)# ip access-group BROWSING out
Verifying Extended ACLs
R1#show access-lists
Extended IP access list BROWSING
10 permit tcp any 192.168.10.0 0.0.0.255 established
Extended IP access list SURFING
10 permit tcp 192.168.10.0 0.0.0.255 any eq www
20 permit tcp 192.168.10.0 0.0.0.255 any eq 443
R1#
R1#show ip interface g0/0
GigabitEthernet0/0 is up, line protocol is up
Internet address is 192.168.10.1/24
<output omitted for brevity>
Outgoing access list is BROWSING
Inbound access list is SURFING
<rest of output omitted for brevity>
Editing Extended ACLs
R1# show access-lists
Extended IP access list BROWSING Should be
10 permit tcp any 192.168.10.0 0.0.0.255192.168.10.0
established
Extended IP access list SURFING
10 permit tcp 192.168.11.0 0.0.0.255 any eq www
20 permit tcp 192.168.10.0 0.0.0.255 any eq 443
R1#
R1# configure terminal
R1(config)# ip access-list extended SURFING
R1(config-ext-nacl)# no 10
R1(config-ext-nacl)# 10 permit tcp 192.168.10.0 0.0.0.255
any eq www
R1(config-ext-nacl)# exit
R1#
R1#show access-lists
Extended IP access list BROWSING
10 permit tcp any 192.168.10.0 0.0.0.255 established
Extended IP access list SURFING
10 permit tcp 192.168.10.0 0.0.0.255 any eq www
20 permit tcp 192.168.10.0 0.0.0.255 any eq 443
Troubleshooting Common ACL Operations – Error 1
R3# show access-lists
Extended IP access list 110
10 deny tcp 192.168.10.0 0.0.0.255 any (12 match(es))
20 permit tcp 192.168.10.0 0.0.0.255 any eq telnet
30 permit ip any any
S0/0/0 S0/0/1
R1 G0/1 R3 G0/1
G0/0 G0/0
192.168.30.0/24 S3 192.168.31.0/24
192.168.10.0/24 S1
192.168.11.0/24
S2 S4
R1 G0/1 R3 G0/1
G0/0 G0/0
192.168.30.0/24 S3 192.168.31.0/24
192.168.10.0/24 S1
192.168.11.0/24
S2 S4
192.168.30.0/24 S3 192.168.31.0/24
192.168.10.0/24 S1
192.168.11.0/24
S2 S4
R1 G0/1 R3 G0/1
G0/0 G0/0
192.168.30.0/24 S3 192.168.31.0/24
192.168.10.0/24 S1
192.168.11.0/24
S2 S4
R1 G0/1 R3 G0/1
G0/0 G0/0
192.168.30.0/24 S3 192.168.31.0/24
192.168.10.0/24 S1
192.168.11.0/24
S2 S4
R1 R3
G0/0 G0/1
G0/0
:1 :1
:1
2001:DB8:CAFE:10::/64 2001:DB8:CAFE:11::/64 2001:DB8:CAFE:30::/64
S1 S2 S3
Parameter Description
protocol Enter the name or number of an Internet protocol, or an integer representing an IPv6
protocol number.
source-ipv6-prefix/prefix- The source or destination IPv6 network or class of networks for which to set deny or
length permit conditions
destination-ipv6-address
any Enter any as an abbreviation for the IPv6 prefix ::/0. This matches all addresses.
S0/0/0
:1 S0/0/1
:1
R1 R3
G0/0 G0/1
:1 G0/0
:1 :1
2001:DB8:CAFE:10::/64 2001:DB8:CAFE:11::/64 2001:DB8:CAFE:30::/64
S1 S2 S3 X
PC1 PC2 PC3
S0/0/0
:1 S0/0/1
:1
R1 R3
G0/0 G0/1
:1 G0/0
:1 :1
2001:DB8:CAFE:10::/64 2001:DB8:CAFE:11::/64 2001:DB8:CAFE:30::/64
FTP X S1 S2 S3
S0/0/0
:1 S0/0/1
:1
R1 R3
G0/1
HTTP/HTTPS G0/0
:1 :1 G0/0
:1
2001:DB8:CAFE:10::/64 2001:DB8:CAFE:11::/64 2001:DB8:CAFE:30::/64
X S1 S2 S3
Telnet
PC1 PC2 Telnet from PC3
2001:DB8:CAFE:10::10
PC3
2001:DB8:CAFE:11::11
X
• Permit access only HTTP and HTTPS to 2001:DB8:CAFE:30::12/64
Network 10
• Deny all other traffic to PC1 – ::10
R3(config-ipv6-acl)# remark Deny telnet access to PC2 for all other devices
R3(config-ipv6-acl)# deny tcp any host 2001:db8:cafe:11::11 eq 23
R3(config)#interface g0/0
R3(config-if)#ipv6 traffic-filter RESTRICTED-ACCESS in
Verifying IPv6 ACLs
R3# show ipv6 interface g0/0
GigabitEthernet0/0 is up, line protocol is up
Global unicast address(es):
2001:DB8:CAFE:30::1, subnet is 2001:DB8:CAFE:30::/64
Input features: Access List
Inbound access list RESTRICTED-ACCESS
<some output omitted for brevity>