1
Access Control List
Agenda
2
Access Lists: Usage and Rules
“permit or deny statements that filter traffic based on the source address, destination address, protocol type, and port number of a packet”
3
s0
Block traffic from Network 3 to access Network 1
Access Lists: Usage and Rules
4
s0
Block traffic from Network 3 to access Network 1
Access List Command Overview
5
Step 1: Set parameters for this access list test �statement (which can be one of several statements).
Step 2: Enable an interface to use the specified �access list.
Router(config-if)# {protocol} access-group �access-list-number {in | out}
Router(config)# access-list access-list-number �{permit | deny} {test conditions}
A List of Test: Permit
6
access-list 1 permit {test condition}
Packets to Interface(s)
of the assigned
the Access Group
Y
Match
First
Test
?
Permit
N
Packet �Discard
Bucket
Deny
Interface(s)
Destination
A List of Test: Deny
7
access-list 1 deny {test condition}
Packets to Interface(s)
of the assigned
the Access Group
Deny
Y
Match
First
Test
?
N
Packet �Discard
Bucket
Deny
A List of Tests: Deny or Permit
8
access-list 1 deny / permit {test condition}
Packets to Interface(s)
of the assigned
the Access Group
Y
Deny
Y
Match
First
Test
?
Permit
N
Packet �Discard
Bucket
Deny
Interface(s)
Destination
Access List Command Overview
9
Figure 10-1: Sample network
Block traffic from Network 3 to access Network 1
RouterA(config)# access-list 1 deny Network3
RouterA(config)# access-list 1 permit any
s0
A List of Tests: Deny or Permit
Router(config)# access-list access-list-number {permit | deny} {test conditions}
10
Router(config)# access-list 1 permit {test condition-1}
Router(config)# access-list 1 deny {test condition-2}
Router(config)# access-list 1 permit {test condition-3}
Router(config)# access-list 1 deny {test condition-4}
…
Router(config)# access-list 1 deny {test condition-n}
(Implicit Deny)
A List of Tests: Deny or Permit
11
Packets to Interface(s)
in the Access Group
Packet �Discard
Bucket
Y
Interface(s)
Destination
Deny
Y
Match
First
Test
?
Permit
N
Deny
Permit
Match
Next
Test(s)
?
Deny
Match
Last
Test�?
Y
Y
N
Y
Y
Permit
Implicit
Deny
If No Match,
Deny All
(Implicit Deny)
Deny
N
Inbound and Outbound
12
Block traffic from Network 3 to access Network 1
RouterA(config)# access-list 1 deny Network3
RouterA(config)# access-list 1 permit any
Router(config-if)# {protocol} access-group �access-list-number {in | out}
s0
f0
Inbound and Outbound
13
Block traffic from Network 3 to access Network 1
RouterA(config)# access-list 1 deny Network3
RouterA(config)# access-list 1 permit any
in
out
Router(config-if)# {protocol} access-group �access-list-number {in | out}
Access List Command Overview
14
Figure 10-1: Sample network
Block traffic from Network 3 to access Network 1
RouterA(config)# access-list 1 deny Network3
RouterA(config)# access-list 1 permit any
Option 1
RouterA(config)# int s0
RouterA(config-if)# ip access-group 1 in
Option 2
RouterA(config)# int f0
RouterA(config-if)# ip access-group 1 out
s0
f0
Option 2
Option 1
Type of Access Lists
15
Two major types of test conditions for IP protocol suit
Outgoing
Packet
E0
S0
Incoming
Packet
Access List Processes
Permit?
Source
and �(Destination)
Protocol
Standard IP Access List Configuration
16
Router(config-if)# ip access-group �access-list-number {in | out}
Router(config)# access-list access-list-number �{permit | deny} source [mask]
Standard IP Access Lists
17
Router(config)# access-list access-list-number �{permit | deny} source [mask]
Wildcard Bits: How to Check the Corresponding Address Bits
18
Do Not Check Address �(Ignore Bits in Octet)
=
0
0
1
1
1
1
1
1
128
64
32
16
8
4
2
1
=
0
0
0
0
0
0
0
0
=
0
0
0
0
1
1
1
1
=
1
1
1
1
1
1
0
0
=
1
1
1
1
1
1
1
1
Octet Bit Position and
Address Value for Bit
Ignore Last 6 Address Bits
Check All Address Bits
(Match All)
Ignore Last 4 Address Bits
Check Last 2 Address Bits
Examples
Standard IP Access Lists
19
Wildcard masking example matching a single host
Standard IP Access Lists
CSC488 Rangsit University
20
Wildcard masking example matching a network
Standard IP Access Lists
21
Figure 10-6: Wildcard masking example using partial masking
Standard IP Access Lists
22
Figure 10-7: Wildcard masking example without match
Standard IP Access List Examples
23
X
Create Access List to
Deny host 172.22.5.2 to access 172.22.2.2
?
?
?
?
Where ?
?
?
Standard IP Access List Examples
24
X
X
Standard IP Access List Examples
25
Sample IP network
X
Answer
as close to the destination as possible
Standard IP Access List Examples
26
Creating a standard IP access list
Use
access-list 1 permit 0.0.0.0 255.255.255.255
or
access-list 1 permit any
to permit others
Standard IP Access List Examples
27
Figure 10-15: Creation and application of standard IP access list
Blocked all traffic from all hosts in subnet 172.22.5.0/24
Standard IP Access List Examples
28
Figure 10-17: Access list that blocks multiple subnets
Blocked all traffic from all hosts in subnets 172.22.4.0/24 and 172.22.5.0/24.
Verify IP Access List
29
Figure 10-11: Show access-lists and show ip access-lists commands
Verify IP Access List
30
Figure 10-12: Show ip interface command
Standard IP Access List Examples
31
Figure 10-13: Removing an ip access list from an interface
Standard IP Access List Examples
32
Figure 10-14: Show ip interface after removal of access list 1 from e0
TCP / IP Majors Protocols
33
Network
Physical
Internet
Application
Transport
LLC / MAC
IP (Internet Protocol)
TCP
UDP
TELNET
FTP
SMTP
HTTP
TFTP
SNMP
ICMP
OSPF
Port Number
34
LLC/MAC
I P Protocol
TCP
telnet
FTP
WWW
(x1)
(x2)
(x3)
U data
SA
DA
H
H
SP
DP
Destination Port
When more than one application are running on the same machine. Special ID called “Port Number” is need to specify the application.
Source Port
Well-Known Port Number
35
Driver
IP
TCP
telnet server
FTP server
WWW server
(20)
(23)
(80)
U data
SA
DA
H
H
SP
DP
Servers are known by well-known ports number, e.g., FTP 20 + 21, TELNET 23, SMTP 25, HTTP 80
When more than one server are running on the same machine.
Client port numbers are dynamically assigned
(>1024).
Socket Number
36
IP
TCP
IP
TCP
telnet server
FTP server
WWW server
(20)
(23)
(80)
Any connection has a unique
socket number
(source IP, source Port Number
dest. IP, dest. Port Number)
telnet client
WWW client
(1050)
(1051)
IP
TCP
telnet client
(1050)
telnet client
240.148.240.105
(1051)
240.148.240.10
240.148.240.100
.
.
.
1.(240.148.240.100: 20, 240.148.240.105. 1050)
2.(240.148.240.100: 20, 240.148.240.105. 1051)
3.(240.148.240.100: 20, 240.148.240.10. 1050)
4.(240.148.240.100; 80, 240.148.240.10. 1051)
(1)
(2)
(3)
(4)
TCP Header
37
sequence number:32
acknowledgement number:32
window size:16
Options + padding
0 15 16 31
destination port:16
Offset:4
resv:6
flags:6
checksum :16
Urgent Pointer:16
source port:16
UDP header
38
0 15 16 31
destination port:16
length :16
checksum :16
source port:16
Extended IP Access Lists
39
Destination
Address
Source
Address
Protocol (L3/L4)
Port
Number
Segment
(for Example, �TCP Header)
Data
Packet
(IP Header)
Frame
Header
(For Example, �HDLC)
Use
Access
List Statements
1-99 or 100-199 to �Test the
Packet
Deny
Permit
Extended IP Access List Configuration
40
Router(config-if)#ip access-group access-list-number {in | out}
Router(config)#access-list access-list-number �{permit | deny} protocol source source-wildcard [operator port] destination destination-wildcard [operator port] [established] [log]
Extended Access List Example 1
41
access-list 101 deny tcp 172.16.4.0 0.0.0.255 172.16.3.0 0.0.0.255 eq 21
access-list 101 deny tcp 172.16.4.0 0.0.0.255 172.16.3.0 0.0.0.255 eq 20
access-list 101 permit ip any any
(implicit deny all)
(access-list 101 deny ip 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255)
interface ethernet 0
ip access-group 101 out
172.16.3.0
172.16.4.0
172.16.4.13
E0
S0
E1
Non-
172.16.0.0
Extended Access List Example 2
42
access-list 101 deny tcp 172.16.4.0 0.0.0.255 any eq 23
access-list 101 permit ip any any
(implicit deny all)
interface ethernet 0
ip access-group 101 out
172.16.3.0
172.16.4.0
172.16.4.13
E0
S0
E1
Non-
172.16.0.0
Extended Access List Example 3
43
Figure 10-18: Sample IP network with a Web server
X
Web traffic
Protocol = tcp
Port = 80
as close to the source as possible
access-list 101 deny tcp 172.22.5.2 0.0.0.0 172.22.2.2 0.0.0.0 eq 80
Extended Access List Example 3
44
Sample IP network with a Web server
X
Web traffic
Protocol = tcp
Port = 80
as close to the source as possible
access-list 101 deny tcp host 172.22.5.2 host 172.22.2.2 eq www
Extended Access List Example 3
45
Standard Versus Extended Access List
46
Standard
Extended
Filters based on�source
Filters based on�source and destination
Permits or denies entire TCP/IP protocol suite
Specifies a specific IP protocol and port number
Range: 100 through 199
Range: 1 through 99
Problem
47
172.16.3.0
192.168.1.0
192.168.1.5
E0
S0
E1
128.16.1.0
Answer
48
172.16.3.0
192.168.1.0
192.168.1.5
E0
S0
E1
128.16.1.0
access-list 1 deny 192.168.1.5 0.0.0.0�access-list 1 permit any
E0