Network Forward Ports maximum 500 per network - Possible Bug?

Hello All

It appears that there is a max limit on the amount of Network Forward ports you can add per parent network.

So far i can only get a max of 500 network forward ports added in total, regardless of if theyre in different network forwards, seems to be a max of 500 for the whole network.

The error i get is:

                ip saddr ip daddr tcp dport 11499 masquerade
: fork/exec /snap/lxd/23537/bin/nft: argument list too long

I did a bit of looking an some places suggest setting a higher ulimit -n to allow argument lists to be larger, but as lxd is snap packaged, i dont think i can set this and have it apply inside snap.

Below is an example of what i was trying to do with the above output.

   echo "Recreating network forward"
   lxc network forward delete $network $hostip
   lxc network forward create $network $hostip

   echo "Adding port entry for ssh"
   lxc network forward port add $network $hostip tcp 10022 $instanceip 22
   echo "Adding port entry for server ports"
   lxc network forward port add $network $hostip tcp 11000-11499 $instanceip
   lxc network forward port add $network $hostip tcp 11500-11999 $instanceip
   lxc network forward port add $network $hostip tcp 12000-12499 $instanceip
   lxc network forward port add $network $hostip tcp 12500-12999 $instanceip

Perhaps i am expecting too much of network forwards, or is there something known that might help?

Thanks for your efforts!


We should be able to use the -f - to nft command and pass the config in via stdin.

Please can you open an issue here Issues · lxc/lxd · GitHub to track it.

Hello @matt_neteo, did you open the tracking issue? Thanks

This should fix it