Modul 5 Access Control List PDF
Modul 5 Access Control List PDF
Standard IP ACLs
Can only filter on source IP addresses
Extended IP ACLs
Can filter on:
Source IP address
S dd
Destination IP address
Protocol (TCP, UDP)
Port Numbers (Telnet 23, http 80, etc.)
and other parameters
Creating Standard ACLs 2 Steps
8
Creating ACLs 2 Steps
9
(Standard IP)
Learn by example!
172.16.20.0/24 10172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
Task:
Permit only the host 172.16.30.2 from exiting the Sales
network.
Deny all other hosts on the Sales network from leaving the
172.16.30.0/24 network.
Learn by example!
172.16.20.0/24 11172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
(Standard IP)
From Cisco Web Site
172.16.20.0/24 12172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
Applying ACLs
You can define ACLs without applying them.
them
However, the ACLs will have no effect until they are applied to the router's
interface.
It is a good practice to apply the Standard ACLs on the interface closest to the
destination of the traffic and Extended ACLs on the interface closest to the
source. (coming later)
Defining In, Out, Source, and Destination
Out - Traffic that has already been routed by the router and is leaving the
interface
In - Traffic that is arriving on the interface and which will be routed router.
Learn by example!
172.16.20.0/24 13172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
RouterB(config)# interface e 0
( g ) ip
RouterB(config-if)# p access-group
g p 10 in
Learn by example!
172.16.20.0/24 14172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
RouterB(config)# interface s 0
RouterB(config-if)# ip access-group 10 out
R t B(
RouterB(config)#
fi )# interface
i t f s 1
RouterB(config-if)# ip access-group 10 out
Learn by example!
172.16.20.0/24 15172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
Because of the implicit deny any, this has an adverse affect of also denying
packets from Administration from reaching
p g Engineering,
g g, and denying
y gp packets from
Engineering from reaching Administration.
RouterB(config)#access-list 10 permit 172.16.30.2
Implicit deny any -do not need to add this, discussed later
R t B(
RouterB(config)#access-list
fi )# li t 10 denyd 0.0.0.0
0 0 0 0 255.255.255.255
255 255 255 255
RouterB(config)# interface s 0
g
RouterB(config-if)# ip
p access-group
g p 10 out
RouterB(config)# interface s 1
RouterB(config-if)# ip access-group 10 out
Example 2
172.16.20.0/24 16172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
Task:
Permit only the hosts 172.16.30.2, 172.16.30.3, 172.16.30.4,
172.16.30.5 from exiting the Sales network.
Deny all other hosts on the Sales network from leaving the
172.16.30.0/24 network.
Example 2
172.16.20.0/24 17172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
Once a condition is met, all other statements are ignored, so the implicit
y any
deny y only
y applies
pp to not-matched p packets.
RouterB(config)#access-list 10 permit 172.16.30.2
RouterB(config)#access-list 10 permit 172.16.30.3
RouterB(config)#access-list 10 permit 172.16.30.4
RouterB(config)#access list
RouterB(config)#access-list 10 permit 172
172.16.30.5
16 30 5
Implicit deny any -do not need to add this, discussed later
RouterB(config)#access-list 10 deny 0.0.0.0 255.255.255.255
RouterB(config)# interface e 0
RouterB(config-if)# ip access-group 10 in
Example 2
172.16.20.0/24 18172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
RouterB(config)# interface e 0
RouterB(config-if)# no ip access-group 10 in
Example 3
172.16.20.0/24 19172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
Task:
Deny only the host 172.16.30.2 from exiting the Sales network.
Permit all other hosts on the Sales network to leave the
172.16.30.0/24 network.
Keyword
y any
y can b
be used to represent
p all IP
Addresses.
Example 3
172.16.20.0/24 20172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
Order matters! What if these two statements were reversed? Does the
p
implicit deny
y any
y ever g
get a match? No,, the permit
p any
y will cover all other
packets.
RouterB(config)#access-list 10 deny 172.16.30.2
RouterB(config)#access-list 10 permit any
Implicit deny any -do not need to add this, discussed later
RouterB(config)#access-list 10 deny 0.0.0.0 255.255.255.255
RouterB(config)#
R t B( fi )# interface
i t f e 0
RouterB(config-if)# ip access-group 10 in
Notes from www.cisco.com
21
Traffic coming into the router is compared to ACL entries based on the
order that the entries occur in the router.
New statements are added to the end of the list.
The router keeps looking until it has a match.
If no matches are found when the router reaches the end of the list, the
t ffi iis d
traffic denied.
i d
For this reason, you should have the frequently hit entries at the top of the
list.
There is an "implied
p deny"
y for traffic that is not p
permitted.
A single-entry ACL with only one "deny" entry has the effect of denying all
traffic.
You must have at least one "permit" statement in an ACL or all traffic will
be blocked.
blocked
0 - check
check the corresponding bit value.
value.
1 - do not check (ignore) that corresponding bit value.
Example 4 Using Wildcard Masks
172.16.20.0/24 24172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
Task:
Want RouterA to permit entire sales network and just the
172.16.50.2 station.
Deny all other traffic from entering Administrative network.
Example 4 Using Wildcard Masks
172.16.20.0/24 25172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
RouterA(config)# interface e 0
RouterA(config-if)#ip access-group 11 out
Practice
26
RouterB(config)#access-list 10 permit __________ ___________
Note: More than one interface can use the same access-list.
Standard ACL
33
W will
We ill see why
h in
i a moment.
Extended ACLs are used more often than standard ACLs because they
provide a greater range of control.
Extended
te ded ACLs
C sccheck
ec tthee sou
source
ce a
andd dest
destination
at o pac
packet
et
addresses as well as being able to check for protocols and port
numbers.
This gives greater flexibility to describe what the ACL will check.
Packets can be permitted or denied access based on where the packet
originated and its destination as well as protocol type and port addresses.
Extended Access Lists
36
The ip access-group
access group command links an existing extended ACL to
an interface.
Remember that only one ACL per interface, per direction, per protocol
is allowed. The format of the command is:
Router(config-if)#ip access-group access-list-number
{in | out}
Example 1
172.16.20.0/24 38172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
172.16.10.2/24
Port 172.16.30.2/24 172.16.50.2/24
80
Task
What if we wanted Router A to permit only the Engineering workstation
172.16.50.2 to be able to access the web server in Administrative
network with the IP address 172.16.10.2 and p port address 80.
All other traffic is denied.
Example 1
172.16.20.0/24 39172.16.40.0/24
s0 s0 s1 s0
RouterA .1 .2 RouterB .1 .2 RouterC
.1 e0 .1 e0 .1 e0
172 16 10 3/24
172.16.10.3/24 172 16 30 3/24
172.16.30.3/24 172 16 50 3/24
172.16.50.3/24
172.16.10.2/24
Port 172.16.30.2/24 172.16.50.2/24
80
RouterA(config)#inter e 0
RouterA(config-if)#ip access-group 110 out
Whyy is better to p
place the ACL on RouterA instead of RouterC?
Notes from www.cisco.com
40
Source
10.0.0.0/8
Destination 172.16.0.0/16
The g
general rule:
Standard ACLs do not specify destination addresses, so they should
be placed as close to the destination as possible.
Put the extended ACLs as close as possible to the source of the traffic
denied.
Placing ACLs
42
Source
10.0.0.0/8
Destination 172.16.0.0/16
If the ACLs are placed in the proper location, not only can traffic be
filtered, but it can make the whole network more efficient.
Iff traffic
ffi is
i going
i to be
b filtered,
fil d the
h ACL should
h ld b
be placed
l d whereh iit h
has
the greatest impact on increasing efficiency.
Placing ACLs Extended Example
43
deny telnet
deny ftp
permit any
Source
S
10.0.0.0/8
Destination 172.16.0.0/16
deny telnet
deny ftp
permit any
Source
S
10.0.0.0/8
RouterA Destination 172.16.0.0/16
access-list 101 deny tcp any 172.16.0.0 0.0.255.255 eq telnet
access-list 101 deny tcp any 172.16.0.0 0.0.255.255 eq ftp
access-list 101 permit ip any any
interface fastethernet 0/1
access-group 101 in
Place this extended ACL in Router A.
Then,
Then packets do not cross Router AA'ss Ethernet,
Ethernet do not cross the serial interfaces of
Routers B and C, and do not enter Router D.
Traffic with different source and destination addresses will still be permitted.
Placing ACLs Standard Example
45
deny 10.0.0.0
Source
S permit an
any
10.0.0.0/8
Destination 172.16.0.0/16
access-list 10 deny 10.0.0.0 0.255.255.255
RouterD access-list 10 permit any
interface fastethernet 0/0
access-group
g 10 i
in
deny 10.0.0.0
Source
S permit an
any
10.0.0.0
Destination 172.16.0.0/16
interface fastethernet 0/0
RouterD access-group 10 in
access-list 10 deny 10.0.0.0 0.255.255.255
access-list
li t 10 permit
mit any
Better to use extended access lists, and place them close to the source,
as this traffic will travel all the wayy to RouterD before being
g denied.
Firewalls
47