FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
jhelder
Staff
Staff
Article Id 264818
Description

This article describes a practical approach to safeguarding the network by denying connections from IPs originating in China.
However, it is important to note that this method can be applied to block connections from any country, providing an additional layer of defense against potential threats. It is possible to effectively block or deny all connection attempts originating from undesired countries.

Scope FortiGate.
Solution
  1. Verify 'Local in Policy' Enablement:

Navigate to 'System' and access 'Feature Visibility'. Confirm whether 'Local in Policy' is enabled. 


k1.1.JPG

 

  1. Proceed to 'Policy and Object' and select 'Addresses'. Choose to create a new address object to define the IP ranges for the specific country to block.

k1.2.JPG

 

  1. Create the Local-in Policy using the CLI:

Configure the local-in policy by setting the appropriate parameters:
Specify the previously created address object as the source for the policy.
Define the desired interface and services to be affected. For instance, if 'port1' serves as a WAN interface.

And in the service, it is all defined, because it is necessary to block all connections coming to the firewall in any port number.

 

k1.3.JPG

 

By following these steps, it is possible to effectively block connections originating from specific country IP ranges, ensuring enhanced security for the FortiGate.

 

The next tip on the same topic is a bonus tip in case there is a need to allow only one country to connect to the firewall and all of the other countries to be blocked. In this example, all of the countries except China will be blocked

:

 local in policy.png

 

The following is achieved with the use of 'set srcaddr-negate enable' which would block all of the addresses except the one configured in 'srcaddr'. One friendly reminder is that the default action in local policies is denied, therefore there is no need to configure it.


Note:
From v7.6.x, local-in policy can be configured on GUI under Policy & Objects -> Local-in Policy.

Screenshot 2024-10-14 155058.png

 

Related documents: