Bulk add SNAT rules for 1024 public WAN IPs (datacentre project)

  • Hi,

    Hope someone can help..

    I have 4 x /24 Public IP blocks (1024 addresses) which I have bound to pfsense as virtual server type any.

    I need to add a large number of SNAT rules to map a large number of SMTP servers to outbound public IPs, is there a way to add rules by script / command line?

  • To map whole subnets should be possible in pfSense outbound NAT.
    You can add a rule for a source subnet and at Translation select "Other subnet" from the bottom of the dropdown and enter your public subnet below.
    Maybe you also need to select "Bitmask" from the pool options.

    If you need special mappings defined in a translation table, there will also be a way to script it.
    Go to Diagnostics > Backup & Restore, select NAT at "backup area" and download the XML file. Open the file in a text editor and take a look at the rules to get an idea how they are constructed.
    This way you may build up your additional rules and insert them in the XML in the <outbound>section and import the file after in Diagnostics > Backup & Restore.</outbound>