OPNsense Forum

English Forums => 24.7, 24.10 Legacy Series => Topic started by: ezhik on September 23, 2024, 08:52:31 PM

Title: Adding 100 port forwarding Firewall Rules in bulk or automatically?
Post by: ezhik on September 23, 2024, 08:52:31 PM
Hey!

I need to add 100 port forwarding firewall rules and I'd like to find a way to do so automatically or via API.

It will be a 1:1 mapping of external to internal port to a single internal IP. For example 1234 will be directed to 1234, 1235 to 1235 and so on.

Any help is greatly appreciated!
Title: Re: Adding 100 port forwarding Firewall Rules in bulk or automatically?
Post by: Patrick M. Hausen on September 24, 2024, 12:57:09 AM
All to the same internal IP?
Title: Re: Adding 100 port forwarding Firewall Rules in bulk or automatically?
Post by: ezhik on September 24, 2024, 02:49:58 AM
Yes.
Title: Re: Adding 100 port forwarding Firewall Rules in bulk or automatically?
Post by: Patrick M. Hausen on September 24, 2024, 10:51:11 AM
Then you need just a single rule with a port range or essentially an arbitrary list of single ports and ranges. Define the ports in Firewall > Aliases.
Title: Re: Adding 100 port forwarding Firewall Rules in bulk or automatically?
Post by: ezhik on September 24, 2024, 05:08:20 PM
Interesting, will check it out. Thanks!
Title: Re: Adding 100 port forwarding Firewall Rules in bulk or automatically?
Post by: ezhik on October 05, 2024, 03:29:18 AM
So this worked!

For those who are wondering, you need to set "Content" to your port range, for example: 15000:15100