Skip to main content
salmas
Staff
Staff
April 22, 2024

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

  • April 22, 2024
  • 1 reply
  • 7661 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
    April 28, 2026

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