iptables rules does not work as needs
by mackowiakp from LinuxQuestions.org on (#5F6PK)
I want to redirect traffic coming to/from QNAP NAS from LAN/WAN/NAS itself, on port 8082 to RPi port 8081.
192.168.0.7 - address of NAS
192.168.0.25 - address of RPI
For this I use such rules (part of iptables-save output):
Code:-A PREROUTING -d 192.168.0.7/32 -p tcp -m tcp --dport 8082 -j DNAT --to-destination 192.168.0.25:8081
-A POSTROUTING -d 192.168.0.25/32 -p tcp -m tcp --dport 8081 -j SNAT --to-source 192.168.0.7:8082When I try to nmap NAS from other node in LAN i got such output:
Code:[maciek@Piotr ~]$ nmap -p8082 192.168.0.7
Starting Nmap 7.70 ( https://nmap.org ) at 2021-03-11 08:57 CET
Nmap scan report for my.NAS.name (192.168.0.7)
Host is up (0.00058s latency).
PORT STATE SERVICE
8082/tcp filtered blackice-alerts
Nmap done: 1 IP address (1 host up) scanned in 0.23 secondsWhats wrong in my entry? Really dont know. Any help?


192.168.0.7 - address of NAS
192.168.0.25 - address of RPI
For this I use such rules (part of iptables-save output):
Code:-A PREROUTING -d 192.168.0.7/32 -p tcp -m tcp --dport 8082 -j DNAT --to-destination 192.168.0.25:8081
-A POSTROUTING -d 192.168.0.25/32 -p tcp -m tcp --dport 8081 -j SNAT --to-source 192.168.0.7:8082When I try to nmap NAS from other node in LAN i got such output:
Code:[maciek@Piotr ~]$ nmap -p8082 192.168.0.7
Starting Nmap 7.70 ( https://nmap.org ) at 2021-03-11 08:57 CET
Nmap scan report for my.NAS.name (192.168.0.7)
Host is up (0.00058s latency).
PORT STATE SERVICE
8082/tcp filtered blackice-alerts
Nmap done: 1 IP address (1 host up) scanned in 0.23 secondsWhats wrong in my entry? Really dont know. Any help?