0 down vote favoriteI have two interfaceseth0 (192.168.1.95) and eth0:1 (10.0.0.100)i wantall packet for 192.168.1.95:9900 (from any 192.168/24) will be redirect/forward to 10.0.0.100:9900 and to back (from 10.0.0.100:9900 to 192.168/24).Help me make it with iptables.*nat-A PREROUTING --dst 192.168.1.95 -p tcp --dport 9900 -j DNAT --to-destination 10.0.0.100COMMIT
iptables | redirect from local [interface:port] to local [interface:port]
linux;iptables
The question/favor was clear enough. I can accept recommendations, but this is how I would do it. Run both commands as root, then leverage iptables-save.From 192.168.1.95iptables -t nat -A PREROUTING -s 192.168.1.95 -p tcp --dport 9900 -j DNAT --to-destination 10.0.0.100:9900From 10.0.0.100iptables -t nat -A PREROUTING -s 10.0.0.100 -p tcp --dport 9900 -j DNAT --to-destination 192.168.1.95:9900