Securing your network from unwanted intrusions is a top priority for any organization. One effective way to bolster your network's security is by implementing a strict firewall policy that blocks traffic from specific countries. This article will guide you through configuring your FortiGate firewall to allow traffic from only certain countries, while blocking all others.

Before we dive into the configuration process, it's crucial to understand that blocking traffic based on country is not foolproof. It's relatively easy for attackers to spoof their location. However, this method can help deter casual attacks and make your network less visible to automated scanners.

Understanding Country-based Firewall Rules
FortiGate firewall allows you to create rules that filter traffic based on the source or destination country. These rules use the Geo-IP database, which maps IP addresses to their respective countries. It's essential to keep this database up-to-date for accurate filtering.

In this example, we'll create an allow list of countries and block all others. This means that traffic from countries not in the allow list will be blocked.
Creating an Allow List of Countries

First, you need to identify the countries you want to allow traffic from. This could be based on your organization's operations, user base, or business partners.
To create an allow list, you can use the FortiGate's Country Group feature. This allows you to define a group of countries and apply rules to them as a single entity.
Configuring the Firewall Policy

Once you've created your country group, you can use it in your firewall policy. Here's how to configure your FortiGate firewall to allow traffic from your specified countries and block all others:
1. Log in to your FortiGate's web interface and navigate to the 'Policy & Objects' > 'IPv4 Policy' page.
2. Click on 'Create New' to create a new policy. Set the source as your country group (e.g., 'Allowed Countries'). Set the destination as 'any' to allow traffic to any destination.

3. Set the service to 'any' to allow all types of traffic. You can also specify specific services if you want to allow only certain types of traffic (e.g., HTTP, HTTPS).
4. Set the action to 'accept' to allow traffic that matches this policy.







![OneBlock Timelapse: To Rule Them All [Timelapse] [4K 60 fps]](https://i.pinimg.com/originals/1f/c5/4b/1fc54b7645407844f883394dba2370d7.jpg)












5. Click 'OK' to save the policy.
Testing and Monitoring Your Firewall Policy
After configuring your firewall policy, it's crucial to test it to ensure it's working as expected. You can do this by trying to access your network from different countries and verifying that only allowed countries can connect.
Regularly monitoring your firewall logs is also essential. This can help you detect any suspicious activity and ensure that your firewall is blocking unwanted traffic.
Testing Your Firewall Policy
To test your firewall policy, you can use a VPN service that allows you to change your IP address's location. Connect to a server in a country you've allowed, then try to access your network. Repeat this process with a server in a blocked country to ensure it's not allowing traffic.
You can also use online tools like WhatIsMyIP to check your IP address's location and test your firewall policy.
Monitoring Your Firewall Logs
Regularly reviewing your firewall logs can provide valuable insights into your network's security. It can help you identify any potential threats, detect any policy misconfigurations, and ensure that your firewall is blocking unwanted traffic.
In your FortiGate's web interface, navigate to the 'Log & Report' > 'Event Log' page to view your firewall logs. You can filter the logs by policy name to view only the logs related to your country-based firewall policy.
In conclusion, configuring your FortiGate firewall to block traffic from specific countries can enhance your network's security. However, it's essential to remember that this is not a foolproof method and should be used in conjunction with other security measures. Regularly reviewing and updating your firewall policy is also crucial to ensure it remains effective. Stay vigilant and proactive in your network's security to protect your organization from potential threats.