How do I conditionally forward ports depending on whether the package is requested? [closed]

view full story

http://serverfault.com – Situation: The Server is connected to the internet. On the server I have a virtual machine running which should act as a webserver. Another computer is connected to the physical server. That other computer should be able to do http requests and actually get the answer. Now when I just forward port 80 to the virtual machine like this that obviously doesn't work: iptables -t nat -A PREROUTING -p tcp --dport "$2" -j DNAT --to "$1:$2" iptables -I FORWARD -d "$1/32" -p tcp -m state --state NEW -m tcp --dport "$2" -j ACCEPT ($1 ip-address of the vm, $2 port) Question: Is there a way to do some (HowTos)