1

I am using Raspbian on a Raspbery Pi (based on Debian 10) and I'm trying to use the following line in my iptables rule set:

-A POSTROUTING -s 2.3.4.5/26 -o eth0 -j SNAT --to-source 1.2.3.4

However when I try to load the rule file with iptables-restore I get the following error:

iptables-restore v1.8.2 (nf_tables): unknown option "--to-source"
Error occurred at line: 8
Try 'iptables-restore -h' or 'iptables-restore --help' for more information.

I am 99.9 % sure that the line is correct, there are many tutorials online that use exactly this line. The option --to-source is even mentioned in the man page for iptables.

Any ideas? Is this a bug?

0

1 Answer 1

1

Could it be related to the iptable_nat and nf_nat_ipv4 Kernel modules not being loaded as described here?

As the poster on that forum states:

“Maybe you don’t load required kernel modules? It can be, I’m guessing, iptable_nat and nf_nat_ipv4. This can be caused that you upgraded kernel package but didn't upgraded kernel modules package.”

If that all seems weird to you, sometimes if you have run a package update in an OS like Raspbian, you need to reboot the system for the new kernel modules.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .