Skip to main content

ZBFP and self zone policy.

Let’s continue our tests with the ZBPF. Now I’m going to implement L3 firewall (no transparent) and block EIGRP and OSPF packets sent and received on the outside interface (gig0/0).


                    OUTSIDE     L3 firewall      INSIDE
                  [10.0.0.1]                   [10.0.0.3] 
                    /----\        /----\         /----\ 
                   |  R1  |------|  R2  |-------|  R3  |
                    \----/      / \----/ \       \----/ 
                            gig0/0     gig0/1  

                               <-X->| <-->
                               eigrp, ospf
 
 
R1:

!
interface GigabitEthernet0/0
 ip address 10.0.0.1 255.255.255.0
 !
!
router eigrp 1
 network 0.0.0.0
!
router ospf 1
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0
!

 
 
R2:

interface GigabitEthernet0/0
 ip address 10.0.0.2 255.255.255.0
!
interface GigabitEthernet0/1
 ip address 20.0.0.2 255.255.255.
!
router eigrp 1
 network 0.0.0.0
!
router ospf 1
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0
!

 
 
R3:

!
interface FastEthernet0/0
 ip address 20.0.0.3 255.255.255.0
 !
!
router eigrp 1
 network 0.0.0.0
!
router ospf 1
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0
!


Let’s try if each router sees his neighbors:
 
 
r1#sh ip eigrp neighbors 
EIGRP-IPv4 Neighbors for AS(1)
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   10.0.0.2                Gi0/0             14 00:03:38    1   200  0  16
r1#sh ip ospf neighbor   

Neighbor ID     Pri   State           Dead Time   Address         Interface
20.0.0.2          1   FULL/DR         00:00:34    10.0.0.2        GigabitEthernet0/0
r1#

 
 
r2#sh ip eigrp neighbors 
EIGRP-IPv4 Neighbors for AS(1)
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   10.0.0.1                Gi0/0             13 00:04:07    1   200  0  45
1   20.0.0.3                Gi0/1             14 00:35:38    1   200  0  47
r2#sh ip ospf neighbor   

Neighbor ID     Pri   State           Dead Time   Address         Interface
33.33.33.33       1   FULL/DR         00:00:35    20.0.0.3        GigabitEthernet0/1
10.0.0.1          1   FULL/BDR        00:00:30    10.0.0.1        GigabitEthernet0/0
r2#
 
 
 
r3#sh ip eigrp neighbors 
IP-EIGRP neighbors for process 1
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   20.0.0.2                Fa0/0             11 00:36:02    1   300  0  17
r3#sh ip ospf neighbor   

Neighbor ID     Pri   State           Dead Time   Address         Interface
20.0.0.2          1   FULL/BDR        00:00:38    20.0.0.2        FastEthernet0/0
r3#


Now I create class map to match OSPF and EIGRP packets, policy map with action ‘drop & log’:
 
access-list 101 permit ospf any any
access-list 101 permit eigrp any any
!
class-map type inspect match-any ZBF-L2-SELF-CLASS1
 match access-group 101
!
!
policy-map type inspect ZBF-L2-SELF-POLICY
 class type inspect ZBF-L2-SELF-CLASS1
  drop log
 class class-default
  drop log
!

and then security zones and zone-pairs:
 
zone security INSIDE
zone security OUTSIDE
zone-pair security OUT-SELF source OUTSIDE destination self
 service-policy type inspect ZBF-L2-SELF-POLICY
zone-pair security SELF-OUT source self destination OUTSIDE
 service-policy type inspect ZBF-L2-SELF-POLICY
! 

The last step is to add interfaces to correct security zones:
 
!
interface GigabitEthernet0/0
zone-member security OUTSIDE
!
interface GigabitEthernet0/1
zone-member security INSIDE    
! 

Let’s test the applied policy:
 
r1#
*Apr 16 18:54:14.809: EIGRP-IPv4(1): Neighbor 20.0.0.2 not on common subnet for GigabitEthernet0/0
*Apr 16 18:54:15.749: %DUAL-5-NBRCHANGE: EIGRP-IPv4 1: Neighbor 10.0.0.2 (GigabitEthernet0/0) is down: holding time expired
*Apr 16 18:54:28.509: EIGRP-IPv4(1): Neighbor 20.0.0.3 not on common subnet for GigabitEthernet0/0
*Apr 16 18:54:33.265: %OSPF-5-ADJCHG: Process 1, Nbr 20.0.0.2 on GigabitEthernet0/0 from FULL to DOWN, Neighbor Down: Dead timer expired
r1#
r1#sh ip ospf neighbor 

r1#sh ip eigrp neighbors 
EIGRP-IPv4 Neighbors for AS(1)
r1#

 
r2(config-if)#e
*Apr 16 18:21:10.879: %FW-6-DROP_PKT: Dropping Unknown-l4 session 10.0.0.2:0 224.0.0.5:0 on zone-pair SELF-OUT class ZBF-L2-SELF-CLASS1 due to  DROP action found in policy-map with ip ident 0 nd
r2#
r2#
*Apr 16 18:21:12.843: %SYS-5-CONFIG_I: Configured from console by console
*Apr 16 18:21:15.575: %FW-6-LOG_SUMMARY: 1 packet were dropped from 10.0.0.2:68 => 224.0.0.5:67 (target:class)-(SELF-OUT:ZBF-L2-SELF-CLASS1)
*Apr 16 18:21:15.575: %FW-6-LOG_SUMMARY: 2 packets were dropped from 0.0.0.0:68 => 255.255.255.255:67 (target:class)-(OUT-SELF:class-default)
*Apr 16 18:21:15.575: %FW-6-LOG_SUMMARY: 1 packet were dropped from 10.0.0.1:68 => 224.0.0.5:67 (target:class)-(OUT-SELF:ZBF-L2-SELF-CLASS1)
*Apr 16 18:21:15.575: %FW-6-LOG_SUMMARY: 1 packet were dropped from 10.0.0.1:68 => 224.0.0.10:67 (target:class)-(OUT-SELF:ZBF-L2-SELF-CLASS1)
*Apr 16 18:21:15.575: %FW-6-LOG_SUMMARY: 1 packet were dropped from 10.0.0.2:68 => 224.0.0.10:67 (target:class)-(SELF-OUT:ZBF-L2-SELF-CLASS1)
*Apr 16 18:21:15.575: %FW-6-LOG_SUMMARY: 1 packet were dropped from 20.0.0.3:0 => 224.0.0.10:0 (target:class)-(OUT-SELF:ZBF-L2-SELF-CLASS1)
*Apr 16 18:21:15.575: %FW-6-LOG_SUMMARY: 1 packet were dropped from 20.0.0.2:0 => 224.0.0.10:0 (target:class)-(OUT-SELF:ZBF-L2-SELF-CLASS1)
*Apr 16 18:21:15.575: %FW-6-LOG_SUMMARY: 1 packet were dropped from 20.0.0.3:0 => 224.0.0.5:0 (target:class)-(OUT-SELF:ZBF-L2-SELF-CLASS1)
*Apr 16 18:21:18.119: EIGRP-IPv4(1): Neighbor 10.0.0.1 not on common subnet for GigabitEthernet0/1
*Apr 16 18:21:23.315: %DUAL-5-NBRCHANGE: EIGRP-IPv4 1: Neighbor 10.0.0.1 (GigabitEthernet0/0) is down: holding time expired

r2#sh ip eigrp neighbors 
EIGRP-IPv4 Neighbors for AS(1)
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
1   20.0.0.3                Gi0/1             13 00:57:37    1   200  0  51
r2#sh ip ospf neighbor   

Neighbor ID     Pri   State           Dead Time   Address         Interface
33.33.33.33       1   FULL/DR         00:00:32    20.0.0.3        GigabitEthernet0/1
r2#

 
r3#sh ip eigrp neighbors 
IP-EIGRP neighbors for process 1
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
0   20.0.0.2                Fa0/0             12 00:58:01    1   200  0  23
r3#sh ip ospf neighbor   

Neighbor ID     Pri   State           Dead Time   Address         Interface
20.0.0.2          1   FULL/BDR        00:00:30    20.0.0.2        FastEthernet0/0
r3#

So, now on R2 we can’t see any adjacency between R2 and R1. You have to remember to implement ‘self’ policy in both directions: outside->self, self->outside. You should remember following rules for self-zone:
  • By default the traffic is allowed (bidirectional to and from any neighbor)
  • You can either ‘drop’ or ‘pass’ the traffic, ‘inspect’ action is not valid for self-zone
  • Each direction on the interface is treated separately and if you apply policy for example: OUTSIDE->SELF, the traffic from SELF to OUTSIDE is allowed without any restriction until you add the first policy
  • Be careful with routing protocols and if you plan to have the policy ‘in’ and ‘out’ on self-zone, you have to permit the routing protocol explicitly
  • When you work with the self-zone policy you can find that on the GNS3 some protocols are allowed despite correct configuration. I found there is a difference in processing these packet on the GNS3 and on real devices.
Useful command which allows you to see more details about dropped packets:
Device(config)# parameter-map type inspect-global Device(config-profile)# log dropped-packets enable*
  • non available on all versions of IOS

Comments

Popular posts from this blog

What should you know about HA 'override enabled' setting on Fortigate?

High availability is mandatory in most of today's network designs. Only very small companies or branches can run their business without redundancy. When you have Fortigate firewall in your network you have many options to increase network availability. You can use Fortigate Clustering Protocol ( FGCP ) or Virtual Router Redundancy Protocol ( VRRP ). FGCP has two modes: 'override' disabled (default) and 'override' enabled . I'm not going to explain how to set up HA as you can find many resources on Fortinet websites: https://cookbook.fortinet.com/high-availability-two-fortigates-56/ https://cookbook.fortinet.com/high-availability-with-fgcp-56/ Let's recap what is the main difference between them. The default HA setting is 'override' disabled and this is an order of selection an active unit: 1) number of monitored interfaces - when both units have the same number of working (up) interfaces check next parameter 2) HA uptime - an

MAC Authentication Bypass

One of the method to control your network is using MAB feature. It is helpful in case you have devices without dot1x functionality. Today I will try to implement basic configuration and analyze log messages. There is only one switch SW1 and one device attached to port Fa1/0/2.   ! aaa new - model aaa authentication dot1x default group radius ! ! int Fas1 / 0 / 2 authentication host - mode single - host authentication port - control auto mab ! I haven’t configured ACS yet but let’s see what error message I receive:   SW1 ( config - if ) # mab - ev ( Fa1 / 0 / 2 ): Received MAB context create from AuthMgr mab - ev ( Fa1 / 0 / 2 ): Created MAB client context 0x1100000F mab : initial state mab_initialize has enter mab - ev ( Fa1 / 0 / 2 ): Sending create new context event to EAP from MAB for 0x1100000F ( 0000.0000 . 0000 ) mab - sm ( Fa1 / 0 / 2 ): Received event 'MAB_START' on handle 0x1100000F mab : during state mab_initia

Inpection of asymmetric sessions on FortiGate

There is one feature available on FortiGate, and I think you should know it, as it modifies a bit what we know about stateful firewalls. In past every packet was treated individually and you had to create policies in both directions. With stateful firewalls we can track connections, and by checking couple of attributes, we can treat them as part of the same session. For example when you initiate connection from a host1 to host2, the returning connection from host2 to host1 will be treated as part of the same connection (session). They have to have the same source/destination and destination/source IPs, port numbers and interfaces.There is an exception from this rule and FortiGate in some specific cases can accept connections on port which was not used in the initial connection. Let me explain how it works on the below example:      The host1 has a default gateway on R1 (10.0.1.2), but you may notice that it is not the optimal path to host2 subnet. When we analyze the packet flo