Skip to main content
ispcolohost
New Member
Oct 28, 2016 1:32 PM UTC
Solved

Create or clone policy via CLI without needing policyid?

Hi all, is there any way to create new firewall policy via 'config firewall policy' without having to specify a policy id; i.e., let it just take the next available number?  I'm trying to either mass clone or mass create new rules to break multi-interface rules into individual rules so 'interface pair view' becomes usable again in the web interface.  Doing this while having to come up with unique numbers for each clone or edit command is a nightmare.

    emnoc
    emnocAnswer
    New Member
    Oct 28, 2016 5:17 PM UTC

    Even btter since you said clone, you could do the following

     

     

    config firewall policy 

     

       clone   1111 to  0 

     

    That would allow you to clone a existing policyid 1111 to the next newiest number ( id  ) and then you can make the change.

     

    This  method is available for fwpolicy id, services customs, but not for  address or addrgroups. It's probably the #1 missed cli option that can speed up deploy and when your doing mass deployments imho

     

     

    9 replies

    FortiOSman
    New Member
    Oct 28, 2016 4:06 PM UTC

    config firewall policy

    edit 0

     

    0 is the policy id for next available. 

     

     

    FortiOSman,

    Up, Up, and Away!

    Translate
    ispcolohost
    New Member
    Oct 28, 2016 4:45 PM UTC

    Awesome; thanks!

    Translate
    emnoc
    emnocAnswer
    New Member
    Oct 28, 2016 5:17 PM UTC

    Even btter since you said clone, you could do the following

     

     

    config firewall policy 

     

       clone   1111 to  0 

     

    That would allow you to clone a existing policyid 1111 to the next newiest number ( id  ) and then you can make the change.

     

    This  method is available for fwpolicy id, services customs, but not for  address or addrgroups. It's probably the #1 missed cli option that can speed up deploy and when your doing mass deployments imho

     

     

    Translate
    dio99
    New Member
    Dec 8, 2016 9:20 AM UTC

    use edit 0 and it will create next id :)

     

    // Anders

    Translate
    hklb
    Visitor III
    Dec 8, 2016 1:56 PM UTC

    you can do a "clone 120 to 0" to clone to the next ID avaible

    Translate
    emnoc
    New Member
    Dec 8, 2016 4:21 PM UTC

    But his question is "other than doing a show" I don't know of a way to know what's the next policyid that will be assigned UNLESS you do a "show" or  do what was suggested b4, find a unused policy-id and clone to that policy-id

     

    FortiOS will not let you overwrite an existing policyid

     

    Ken

     

    Translate
    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