Skip to main content
salmas
Staff
Staff
Apr 22, 2024 11:47 AM UTC

Technical Tip: Script to create Address objects and one address group for all geography countries on FortiGate

  • Jul 30, 2026 9:00 AM UTC
  • 1 reply
  • 7930 views

Description

This article describes how to use a script to import all geography-based address objects and to create an address object group for all the countries. 

Scope

FortiGate.

Solution

Check the following steps to create an address object for each geography-based country and to create an address group for all the countries. 

 

To create address objects, download the .zip file named Geography-based address objects.zip attached to this article. 


Before running the script, create a configuration backup and verify that no existing address objects or groups use the same names, as existing objects may be modified.


Upload a script using the GUI:

  • Select the username (Top right corner) and select Configuration -> Scripts.

  • Select 'Run Script'.

  • Select the text file from the downloaded zip and select 'OK'.

Geo_Script.png

 

Confirm all country address objects are created by navigating to Policy & Objects -> Addresses: Geography.

 

If desired, check and verify the IDs of each country on the text file attached.  

 

diagnose firewall ipgeo country-list

 

To create an address group for all the countries, another script is added to this document named All_countries_address_group_script.zip. Copy and paste this script to the FortiGate CLI.

 

Note:

The geography object named Reserved (ZZ) includes private, reserved, and other IP ranges that are not publicly assigned. Exclude this object if the group should contain only publicly assigned country ranges.

 

Related document:

Geography based addresses

    1 reply

    jhaffly
    New Member
    Apr 28, 2026 3:35 PM UTC

    Are the two .zip files still available for download.  I don’t see them attached to this article.

    Risk and Resilience in the Age of AI. An OT Thought Leadership Summit for Houston's Critical Infrastructure Leaders. Date: Thursday, December 3, 2026. Time: 8:30 am - 1:30 pm (CT). Location: The Westin Houston, Memorial City | 945 Gessner Road, Houston, TX 77024