Clase 17. Packet Filtering
Clase 17. Packet Filtering
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
Deny web access to users from network B, but permit them to have all
other access."
This is just a simple example. You can configure multiple rules to further
permit or deny services to specific users. You can also filter packets at
the port level using an extended ACL.
Types of ACLs
Standard ACLs
Can permit or deny traffic for Source IP addresses … only!
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
5
Wildcard Mask
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.
access-list 1 permit host 192.168.1.1
Decimal Binary
IP Address 0.0.0.0 00000000.00000000.00000000.00000000
administrator’s control
Bandwidth of the networks
involved
Ease of configuration
13
Can only permit/deny based on source address.
Will deny traffic to all sites.
14
Can permit/deny based on source,
destination, protocol... Can block before
wasting network bandwidth.
Why here?
OR
How are ACLs Created?
mode.
Define statements of what to
filter.
2. Apply the ACL to an interface.
Enter interface configuration
mode.
Identify the ACL and the
direction to filter.
Create a Standard ACL
RTR(config)# access-list ACL# {permit|deny} { test-conditions }
By default, there is an
implied deny at the
end of all ACLs for
traffic that was not
matched to a
configured entry.
SAME AS
Step 3: Apply the ACL to the interface using the ip access-group command
X
X
R1(config)# access-list 1 deny host 192.168.10.10
R1(config)# access-list 1 permit 192.168.10.0 0.0.0.255
R1(config)# interface s0/0/0
R1(config-if)# ip access-group 1 out
27
Named ACL
Named ACLs
RTR(config)# ip access-list {standard|extended} { NAME }
dropped.
RTR(config {std- | ext-}nacl)# deny {source [source wildcard] | any}
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
Example 1 – Commenting a numbered ACL
R1(config)# access-list 1 remark Do not allow Guest workstation through
R1(config)# access-list 1 deny host 192.168.10.10
R1(config)# access-list 1 remark Allow devices from all other 192.168.x.x subnets
R1(config)# access-list 1 permit 192.168.0.0 0.0.255.255
R1(config)# interface s0/0/0
R1(config-if)# ip access-group 1 out
R1(config-if)#
…)
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
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
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
SSH 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
55
Juniper Filters
1 Create filter
edit firewall
set filter controlwww term 1 from source-address 10.10.20.0/24
set filter controlwww term 1 from destination-address 10.10.12.10/32
set filter controlwww term 1 from protocol icmp
set filter controlwww term 1 then accept
set filter controlwww term 2 from source-address 10.10.20.0/24
set filter controlwww term 2 from destination-address 10.10.12.10/32
set filter controlwww term 2 from protocol tcp
set filter controlwww term 2 from destination-port http
set filter controlwww term 2 then accept
quit
S0/0/0
S0/0/1
:1
:1
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
PC1 PC2
PC3
Parameter Description
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
2001:DB8:CAFE:10::10
PC3
2001:DB8:CAFE:11::11
X PC3
2001:DB8:CAFE:30::12/64
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
68
R3(config-if)#ipv6 traffic-filter RESTRICTED-ACCESS in
Verifying IPv6 ACLs