Firewall Types
Firewall Types
Implementing Firewall
Technologies
For
By
Eng. Abeer Hosni
1- Established Keyword (Legacy):
Objectives:
Configure filtering on R1 so that only WWW, SSL and telnet traffic is permitted if only
sourced from the CLIENT to the SERVER.
Configuration:
CLIENT(config)#int f0/0
CLIENT(config-if)#ip address 192.168.1.100 255.255.255.0
CLIENT(config-if)#no shutdown
CLIENT(config-if)#exit
CLIENT(config)#no ip routing
CLIENT(config)#ip default-gateway 192.168.1.1
SERVER(config)#line vty 0 4
SERVER(config-line)#password 123
SERVER(config-line)#login
SERVER(config-line)#exit
SERVER(config)#ip http server
SERVER(config)#ip http secure-server
SERVER(config)#int f0/1
SERVER(config-if)#ip address 11.0.0.100 255.255.255.0
SERVER(config-if)#no shutdown
SERVER(config-if)#exit
SERVER(config)#no ip routing
SERVER(config)#ip default-gateway 11.0.0.1
R1(config)#int f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int f0/1
R1(config-if)#ip address 11.0.0.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#access-list 100 permit tcp host 11.0.0.100 eq 80 host 192.168.1.100 gt 1023
established
R1(config)#access-list 100 permit tcp host 11.0.0.100 eq 443 host 192.168.1.100 gt 1023
established
R1(config)#access-list 100 permit tcp host 11.0.0.100 eq 23 host 192.168.1.100 gt 1023
established
R1(config)#int f0/1
R1(config-if)#ip access-group 100 in
Verification:
The "established" keyword is used to indicate an established connection for TCP protocol.
An established connection can be considered as the TCP protocol traffic originating from
your network, not from an external network.
This means that the packets belong to an existing connection if the (TCP) segment has the
Acknowledgment (ACK) or Reset (RST) bit set.
SERVER#ping 192.168.1.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.100, timeout is 2 seconds:
UUUUU
Success rate is 0 percent (0/5)
SERVER#telnet 192.168.1.100
Trying 192.168.1.100 ...
% Destination unreachable; gateway or host down
SERVER#telnet 192.168.1.100 80
Trying 192.168.1.100, 80 ...
% Destination unreachable; gateway or host down
R1(config)#int f0/1
R1(config-if)#no ip unreachables
SERVER#telnet 192.168.1.100
Trying 192.168.1.100 ...
% Connection timed out; remote host not responding
R1#show access-list
Extended IP access list 100
10 permit tcp host 11.0.0.100 eq www host 192.168.1.100 gt 1023 established (5
matches)
20 permit tcp host 11.0.0.100 eq 443 host 192.168.1.100 gt 1023 established (3
matches)
30 permit tcp host 11.0.0.100 eq telnet host 192.168.1.100 gt 1023 established (16
matches)
Objectives:
Configure filtering on R1 so that the CLIENT can telnet to the SERVER on work hours
only, from 9 AM to 5 PM.
Configuration:
CLIENT(config)#int f0/0
CLIENT(config-if)#ip address 192.168.1.100 255.255.255.0
CLIENT(config-if)#no shutdown
CLIENT(config-if)#exit
CLIENT(config)#no ip routing
CLIENT(config)#ip default-gateway 192.168.1.1
SERVER(config)#line vty 0 4
SERVER(config-line)#password 123
SERVER(config-line)#login
SERVER(config-line)#exit
SERVER(config)#int f0/1
SERVER(config-if)#ip address 11.0.0.100 255.255.255.0
SERVER(config-if)#no shutdown
SERVER(config-if)#exit
SERVER(config)#no ip routing
SERVER(config)#ip default-gateway 11.0.0.1
R1#clock set 3:9:00 2 feb 2016
R1#config t
R1(config)#int f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int f0/1
R1(config-if)#ip address 11.0.0.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#time-range WORK_HOURS
R1(config-time-range)#periodic weekdays 9:00 to 17:00
R1(config-time-range)#exit
R1(config)#access-list 100 permit tcp host 192.168.1.100 host 11.0.0.100 eq 23 time-
range WORK_HOURS
R1(config)#int f0/0
R1(config-if)#ip access-group 100 in
Verification:
Time based ACL is used to activate entry based on clock. It can be an absolute or
periodic time.
R1#show clock
03:18:31.351 UTC Tue Feb 2 2016
R1#show time-range
time-range entry: WORK_HOURS (inactive)
periodic weekdays 9:00 to 17:00
used in: IP ACL entry
CLIENT#telnet 11.0.0.100
Trying 11.0.0.100 ...
% Destination unreachable; gateway or host down
CLIENT#telnet 11.0.0.100
Trying 11.0.0.100 ... Open
R1#show access-list
Extended IP access list 100
10 permit tcp host 192.168.1.100 host 11.0.0.100 eq telnet time-range WORK_HOURS
(active) (14 matches)
3- Dynamic ACL (Lock and Key) (Legacy):
Objectives:
Configure dynamic ACL on R1 so that CLIENT1 or CLIENT2 can open TCP sessions on
SERVER based on authentication.
Configuration:
CLIENT1(config)#int f0/0
CLIENT1(config-if)#ip address 192.168.1.100 255.255.255.0
CLIENT1(config-if)#no shutdown
CLIENT1(config-if)#exit
CLIENT1(config)#no ip routing
CLIENT1(config)#ip default-gateway 192.168.1.1
CLIENT2(config)#int f0/0
CLIENT2(config-if)#ip address 192.168.1.101 255.255.255.0
CLIENT2(config-if)#no shutdown
CLIENT2(config-if)#exit
CLIENT2(config)#no ip routing
CLIENT2(config)#ip default-gateway 192.168.1.1
SERVER(config)#int f0/1
SERVER(config-if)#ip address 11.0.0.100 255.255.255.0
SERVER(config-if)#no shutdown
SERVER(config-if)#exit
SERVER(config)#no ip routing
SERVER(config)#ip default-gateway 11.0.0.1
SERVER(config)#line vty 0 4
SERVER(config-line)#password 123
SERVER(config-line)#login
R1(config)#int f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int f0/1
R1(config-if)#ip address 11.0.0.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#line vty 0 4
R1(config-line)#password 123
R1(config-line)#login
R1(config-line)#exit
R1(config)#enable secret 456
R1(config)#access-list 100 permit tcp 192.168.1.0 0.0.0.255 host 192.168.1.1 eq 23
R1(config)#access-list 100 dynamic ALLOW_TO_SERVER permit tcp 192.168.1.0
0.0.0.255 host 11.0.0.100
R1(config)#int f0/0
R1(config-if)#ip access-group 100 in
Verification:
Dynamic ACL is used to open a hole in the ACL based on authentication. It’s considered a
legacy technology as it has been replaced by easy VPN and SSL VPN.
CLIENT1#telnet 11.0.0.100
Trying 11.0.0.100 ...
% Destination unreachable; gateway or host down
CLIENT1#telnet 192.168.1.1
Trying 192.168.1.1 ... Open
User Access Verification
Password:
R1>ena (Physically on CLIENT1)
Password:
R1#access-enable (Physically on CLIENT1)
R1#exit (Physically on CLIENT1)
[Connection to 192.168.1.1 closed by foreign host]
CLIENT1#telnet 11.0.0.100
Trying 11.0.0.100 ... Open
R1#show access-lists
Extended IP access list 100
10 permit tcp 192.168.1.0 0.0.0.255 host 192.168.1.1 eq telnet (165 matches)
20 Dynamic ALLOW_TO_SERVER permit tcp 192.168.1.0 0.0.0.255 host 11.0.0.100
permit tcp 192.168.1.0 0.0.0.255 host 11.0.0.100 (10 matches)
- The problem now is that the access list on the router allows the entire
192.168.1.0/24 network to access the SERVER.
CLIENT2#telnet 11.0.0.100
Trying 11.0.0.100 ... Open
R1#show access-list
Extended IP access list 100
10 permit tcp 192.168.1.0 0.0.0.255 host 192.168.1.1 eq telnet
20 Dynamic ALLOW_TO_SERVER permit tcp 192.168.1.0 0.0.0.255 host 11.0.0.100
CLIENT1#telnet 192.168.1.1
Trying 192.168.1.1 ... Open
User Access Verification
Password:
R1>ena
Password:
R1#access-enable host
R1#exit
[Connection to 192.168.1.1 closed by foreign host]
CLIENT1#telnet 11.0.0.100
Trying 11.0.0.100 ... Open
CLIENT2#telnet 11.0.0.100
Trying 11.0.0.100 ...
% Destination unreachable; gateway or host down
R1#show access-list
Extended IP access list 100
10 permit tcp 192.168.1.0 0.0.0.255 host 192.168.1.1 eq telnet (180 matches)
20 Dynamic ALLOW_TO_SERVER permit tcp 192.168.1.0 0.0.0.255 host 11.0.0.100
permit tcp host 192.168.1.100 host 11.0.0.100 (9 matches)
Notice now that only host 192.168.1.100 is permitted to access host 11.0.0.100
- Another problem arises now. The dynamic ACL has no age out. There are two
solutions for this problem:
1- Configure the access-enable command with the timeout option.
CLIENT1#telnet 192.168.1.1
Trying 192.168.1.1 ... Open
User Access Verification
Password:
R1>ena
Password:
R1#access-enable host timeout 30 (In minutes)
R1#exit
CLIENT1#telnet 11.0.0.100
Trying 11.0.0.100 ... Open
R1#show access-list
Extended IP access list 100
10 permit tcp 192.168.1.0 0.0.0.255 host 192.168.1.1 eq telnet (1365 matches)
20 Dynamic ALLOW_TO_SERVER permit tcp 192.168.1.0 0.0.0.255 host 11.0.0.100
permit tcp host 192.168.1.100 host 11.0.0.100 (8 matches) (time left 1772)
Note: the timer starts just after starting the connection to the SERVER. This is an
absolute timeout.
2- Timeout can be configured while creating the dynamic ACL statement.
CLIENT1#telnet 192.168.1.1
Trying 192.168.1.1 ... Open
User Access Verification
Password:
R1>ena
Password:
R1#access-enable host
R1#exit
CLIENT1#telnet 11.0.0.100
Trying 11.0.0.100 ... Open
R1#show access-list
Extended IP access list 100
10 permit tcp 192.168.1.0 0.0.0.255 host 192.168.1.1 eq telnet (636 matches)
20 Dynamic ALLOW_TO_SERVER permit tcp 192.168.1.0 0.0.0.255 host 11.0.0.100
permit tcp host 192.168.1.100 host 11.0.0.100 (18 matches)
- Another problem is that user R1 has to enter the enable mode of the router R1
which causes security problems. This can be solved using two solutions:
1- Using the autocommand under the line vty to be applied to all users:
R1(config)#line vty 0 4
R1(config-line)#autocommand access-enable host
CLIENT1#telnet 192.168.1.1
Trying 192.168.1.1 ... Open
User Access Verification
Password:
[Connection to 192.168.1.1 closed by foreign host]
R1#show access-list
Extended IP access list 100
10 permit tcp 192.168.1.0 0.0.0.255 host 192.168.1.1 eq telnet (678 matches)
20 Dynamic ALLOW_TO_SERVER permit tcp 192.168.1.0 0.0.0.255 host
11.0.0.100
permit tcp host 192.168.1.100 host 11.0.0.100
CLIENT1#telnet 192.168.1.1
Trying 192.168.1.1 ... Open
User Access Verification
Username: abeer
Password:
[Connection to 192.168.1.1 closed by foreign host]
R1#show access-list
Extended IP access list 100
10 permit tcp 192.168.1.0 0.0.0.255 host 192.168.1.1 eq telnet (744 matches)
20 Dynamic ALLOW_TO_SERVER permit tcp 192.168.1.0 0.0.0.255 host
11.0.0.100
permit tcp host 192.168.1.100 host 11.0.0.100
Hint:
Be very careful when using the autocommand command as it has no help. If you
type the option “access-enable host” in a wrong format, you will end up logging
out of the router without opening a hole the dynamic ACL.
4- Reflexive ACL (Legacy):
Objectives:
Configure Reflexive ACL on R1 so that it allows all traffic sourced from the CLIENT to the
SERVER, not vice versa.
Configuration:
CLIENT(config)#int f0/0
CLIENT(config-if)#ip address 192.168.1.100 255.255.255.0
CLIENT(config-if)#no shutdown
CLIENT(config-if)#exit
CLIENT(config)#no ip routing
CLIENT(config)#ip default-gateway 192.168.1.1
SERVER(config)#line vty 0 4
SERVER(config-line)#password 123
SERVER(config-line)#login
SERVER(config-line)#exit
SERVER(config)#ip http server
SERVER(config)#ip http secure-server
SERVER(config)#int f0/1
SERVER(config-if)#ip address 11.0.0.100 255.255.255.0
SERVER(config-if)#no shutdown
SERVER(config-if)#exit
SERVER(config)#no ip routing
SERVER(config)#ip default-gateway 11.0.0.1
R1(config)#int f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int f0/1
R1(config-if)#ip address 11.0.0.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#ip access-list extended IN_TO_OUT
R1(config-ext-nacl)#permit ip 192.168.1.0 0.0.0.255 any reflect STATE_TABLE
R1(config)#ip access-list extended OUT_TO_IN
R1(config-ext-nacl)#evaluate STATE_TABLE
R1(config-ext-nacl)#exit
R1(config)#int f0/1
R1(config-if)#ip access-group IN_TO_OUT out
R1(config-if)#ip access-group OUT_TO_IN in
Verification:
Reflexive ACL is better than using the word established. But it doesn’t inspect
applications. Outbound ACL triggers mirror entry in a state table. Inbound ACL checks
that state table.
It has limitations that it doesn’t work well with some applications like VOIP, active FTP
and traceroute. As in these applications the destination replies as if it were the source.
Also it causes problems to AH and ESP VPN connections.
SERVER#192.168.1.100
Trying 192.168.1.100 ...
% Destination unreachable; gateway or host down
SERVER#ping 192.168.1.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.100, timeout is 2 seconds:
UUUUU
Success rate is 0 percent (0/5)
CLIENT#telnet 11.0.0.100
Trying 11.0.0.100 ... Open
CLIENT#telnet 11.0.0.100 80
Trying 11.0.0.100, 80 ... Open
CLIENT#ping 11.0.0.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 11.0.0.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/28/36 ms
R1#show access-list
Extended IP access list IN_TO_OUT
10 permit tcp 192.168.1.0 0.0.0.255 any reflect STATE_TABLE (73 matches)
20 permit udp 192.168.1.0 0.0.0.255 any reflect STATE_TABLE
30 permit icmp 192.168.1.0 0.0.0.255 any reflect STATE_TABLE (11 matches)
Extended IP access list OUT_TO_IN
10 evaluate STATE_TABLE
Reflexive IP access list STATE_TABLE
permit icmp host 11.0.0.100 host 192.168.1.100 (20 matches) (time left 297)
CLIENT#traceroute 11.0.0.100
Type escape sequence to abort.
Tracing the route to 11.0.0.100
R1#show access-list
Extended IP access list IN_TO_OUT
10 permit tcp 192.168.1.0 0.0.0.255 any reflect STATE_TABLE (73 matches)
20 permit udp 192.168.1.0 0.0.0.255 any reflect STATE_TABLE (329 matches)
30 permit icmp 192.168.1.0 0.0.0.255 any reflect STATE_TABLE (11 matches)
Extended IP access list OUT_TO_IN
1 permit icmp any 192.168.1.0 0.0.0.255 time-exceeded
2 permit icmp any 192.168.1.0 0.0.0.255 port-unreachable (6 matches)
10 evaluate STATE_TABLE
Reflexive IP access list STATE_TABLE
permit udp host 11.0.0.100 eq 33439 host 192.168.1.100 eq 49282 (1 match) (time
left 295)
permit udp host 11.0.0.100 eq 33438 host 192.168.1.100 eq 49281 (1 match) (time
left 295)
permit udp host 11.0.0.100 eq 33437 host 192.168.1.100 eq 49280 (1 match) (time
left 295)
Hint:
The default timeout for entries in reflexive ACL is 300 sec. To change the default,
run the following command.
- For 1100 incomplete sessions by default, the router will start to drop the packets.
To verify:
R#show tcp intercept connections
R#show tcp intercept statistics
6- CBAC(Context-Based Access Control): (Stateful
ACL)
Objectives:
Configure R1 to inspect all TCP, UDP and ICMP sourced from the LAN network to the
SERVER.
Configuration:
CLIENT(config)#int f0/0
CLIENT(config-if)#ip address 192.168.1.100 255.255.255.0
CLIENT(config-if)#no shutdown
CLIENT(config-if)#exit
CLIENT(config)#no ip routing
CLIENT(config)#ip default-gateway 192.168.1.1
SERVER(config)#line vty 0 4
SERVER(config-line)#password 123
SERVER(config-line)#login
SERVER(config-line)#exit
SERVER(config)#ip http server
SERVER(config)#ip http secure-server
SERVER(config)#int f0/1
SERVER(config-if)#ip address 11.0.0.100 255.255.255.0
SERVER(config-if)#no shutdown
SERVER(config-if)#exit
SERVER(config)#no ip routing
SERVER(config)#ip default-gateway 11.0.0.1
R1(config)#int f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int f0/1
R1(config-if)#ip address 11.0.0.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#access-list 100 permit ip 192.168.1.0 0.0.0.255 any
R1(config)#access-list 101 deny tcp any any
R1(config)#access-list 101 deny udp any any
R1(config)#access-list 101 deny icmp any any
R1(config)#int f1/0
R1(config-if)#ip access-group 100 out
R1(config-if)#ip access-group 101 in
Now all traffic from CLIENT to SERVER is denied since the reverse way is denied access.
CLIENT#ping 11.0.0.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 11.0.0.100, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
All traffic should be permitted now from LAN to WAN, not vice versa.
CLIENT#ping 11.0.0.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 11.0.0.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/65/228 ms
CLIENT#telnet 11.0.0.100
Trying 11.0.0.100 ... Open
CLIENT#telnet 11.0.0.100 80
Trying 11.0.0.100, 80 ... Open
SERVER#ping 192.168.1.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.100, timeout is 2 seconds:
UUUUU
Success rate is 0 percent (0/5)
SERVER#telnet 192.168.1.100
Trying 192.168.1.100 ...
% Destination unreachable; gateway or host down
To verify:
R1#show ip inspect sessions
Established Sessions
Session 69CD4118 (192.168.1.100:8)=>(11.0.0.100:0) icmp SIS_OPEN
Objectives:
Configure the FW router to inspect all TCP, UDP and ICMP sourced from the INSIDE
network to the OUTSIDE.
Configure the FW router to inspect all TCP, UDP and ICMP sourced from the OUTSIDE
network to the DMZ.
Configuration:
CLIENT(config-if)#ip address 192.168.1.100 255.255.255.0
CLIENT(config-if)#no shutdown
CLIENT(config-if)#no ip routing
CLIENT(config)#ip default-gateway 192.168.1.1
DMZ_SERVER(config)#int f1/1
DMZ_SERVER(config-if)#ip address 12.0.0.100 255.255.255.0
DMZ_SERVER(config-if)#no shutdown
DMZ_SERVER(config-if)#no ip routing
DMZ_SERVER(config)#ip default-gateway 12.0.0.1
DMZ_SERVER(config)#ip http server
DMZ_SERVER(config)#ip http secure-server
DMZ_SERVER(config)#line vty 0 4
DMZ_SERVER(config-line)#no login
To create another zone pair between the OUTSIDE and the DMZ:
FW(config)#zone-pair security OUT_TO_DMZ_PAIR source OUTDISE destination DMZ
FW(config-sec-zone-pair)#service-policy type inspect IN_TO_OUT
Test:
CLIENT#ping 11.0.0.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 11.0.0.100, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 24/40/52 ms
CLIENT#11.0.0.100
Trying 11.0.0.100 ... Open
CLIENT#11.0.0.100 80
Trying 11.0.0.100, 80 ... Open
CLIENT#11.0.0.100 443
Trying 11.0.0.100, 443 ... Open
CLIENT#ping 12.0.0.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.100, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
DMZ_SERVER#ping 12.0.0.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/8 ms
DMZ_SERVER#12.0.0.100
Trying 12.0.0.100 ... Open
DMZ_SERVER#ping 11.0.0.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 11.0.0.100, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
To verify:
CLIENT#ping 11.0.0.100 repeat 10000
FW#show policy-map type inspect zone-pair sessions
<Output omitted>
Number of Established Sessions = 1
Established Sessions
Session 69CD56A0 (192.168.1.100:8)=>(11.0.0.100:0) icmp SIS_OPEN
Created 00:00:04, Last heard 00:00:00
ECHO request
Bytes sent (initiator:responder) [8424:8352]
<Output omitted>
Note:
- All traffic to and from the router itself is enabled by default, as there is a default zone which
is the self-zone.
- ACL is processed first.
Best wishes
Abeer