0

I'm struggling to get NAT working on my Raspberry Pi as I intend.

Without giving a lot of information, this is the issue I encounter

$ sudo iptables -t nat -A PREROUTING -p tcp -i wlan0 --dport 2222 -j DNAT --to 192.168.2.241:22
iptables v1.8.2 (nf_tables): unknown option "--to"
Try `iptables -h' or 'iptables --help' for more information.

I believe this is supposed to map any incoming connection on port 2222, protocol tcp, interfact wlan0 to the ip address and port 192.168.2.241:22.

However I get this error that the switch --to is not recognized.

I also tried using --to-destination however that also fails.

Is this due to some new update with Raspbian / Debian 10?

user3728501
  • 228
  • 4
  • 11
  • The message is basically telling you to look and the iptables manual. According to the manual, there is no --to option. or --to-destination option. Try -d or --destination. http://man7.org/linux/man-pages/man8/iptables.8.html – Paul May 05 '20 at 04:02
  • @paul hi and thanks for the reply, I did actually have a good look in detail at the man pages on my system, but it seems I was confused by reading several different documenations online! I did not realize that -d was the ame as --to-destination - cheers & all the best! – user3728501 May 05 '20 at 13:49
  • @Paul Actually I'm not sure if my above comment is correct. I had another look into this and I assumed that -d should be changed to -s (source) and that --to-destination should be changed to -d - but looking again I'm not sure this is the case, since there seems to be no way to specify port translation with these options? Apparenly my iptables is v1.8.2. A lot of online documentation refers to --to-destination as an option, which isn't available in v1.8.2, apparently. Any idea why this might be? – user3728501 May 06 '20 at 00:05

0 Answers0