How would you setup iptables to generically send packets of some port say tcp port 80 to the correct machines (which are not all in the same subnet)?
iptables -t nat -A PREROUTING -s 0.0.0.0//0 -p tcp -d $NATIP -j DNAT --to-destination $machineIP
iptables -t nat -A POSTROUTING -s $machineIP -p tcp -d 0.0.0.0//0 -j SNAT --to-source $NATIP
The above would send packets correctly to and from a single machine, but how would you do this for n machines. As I don't believe a generic destination such as 192.168.1.0/25 would work.
Do you somehow tag the packets so when they comeback you can send them to the correct IP?
Is this done with some other command?