Assume there are two servers 192.168.1.1 as the tester, and 172.16.8.1 as the target. We will test which open inbound ports on the target server.
iptables -t nat -A PREROUTING -s 192.168.1.1/32 -p tcp -m tcp --dport 80 -j RETURN
iptables -t nat -A PREROUTING -s 192.168.1.1/32 -p tcp -j DNAT --to-destination :80
iptables -I INPUT -s 192.168.1.1/32 -p tcp -m tcp -m state --state NEW -j LOG --log-level 1 --log-prefix "New Connection "
