Technical Tip: Firewall does not block incoming (WAN to LAN) connection even though deny policy
Description
There is an inbound NAT to access an internal web server from an external network but we wish to block one specific external IP from accessing it.
Even though a deny policy is configured above the allowed policy with the source as the IP of the external client, still it does not trigger the firewall policy.
Solution

In this case, try to deny access to the web server from IP 172.26.48.75.
- Select Policy & Objects -> Firewall Policy.
- Select or create the policy.


set match-vip enable
end
Note: The destination address of the deny policy should match the VIP address. If it has been set to the normal local server IP address, use the following CLI to enable match-vip in the deny policy:
set match-vip enable
The match-vip option is disabled by default until v7.2.3. In versions after 7.2.3, the option is enabled by default.
The 'set match-vip' option is only available if the policy action is set to 'deny'.
After enabling the above option, the DNATed packets that are not matched by a VIP policy are matched with the general policy where they can be explicitly dropped and logged.
Or:
Always configure the deny policy:
- Select Policy & Objects -> Firewall Policy.
- Select or create the policy with the destination address as the VIP for which traffic is denied instead of 'All'.

Related articles:
- Troubleshooting Tip: VIP traffic not matching the firewall policy with an 'all' destination
-
Technical Tip: Configure firewall policies for a VIP when Central NAT is enabled
- Changes in default behavior of match-vip - FortiOS 6.4.3 release notes
- Technical Tip: Using Virtual IPs to configure port forwarding
