0

I've got many rules like:

-A POSTROUTING -s IP_LOCAL1 -j SNAT --to-source IP_PUBLIC1
-A POSTROUTING -s IP_LOCAL2 -j SNAT --to-source IP_PUBLIC2
...
...
-A POSTROUTING -s IP_LOCAL100 -j SNAT --to-source IP_PUBLIC100

Is there any possibility to make an ipset with declaration IP_LOCAL1:IP_PUBLIC1 and then make only one rule using ipset?

  • Just to clarify, you need a permanent 1:1 mapping, so anything with --to-source $firstip-$lastip will not do? I don't think you can tie ipset to SNAT in the way you propose (as they're distinct modules) – ilkkachu Dec 7 '17 at 20:49
  • also, are those IP addresses sequential (x.x.x.1 to y.y.y.1, x.x.x.2 to y.y.y.2, etc) or are they random? – ilkkachu Dec 7 '17 at 20:51
  • No there ip addresses are random and rather not range. – Mario_bash Dec 7 '17 at 20:53
0

No.

Currently it is not possible to use ipset as SNAT directives.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.