I have set apache webserver in debian host with debian guest with virtualbox port forwarding.
- Code: Select all Expand viewCollapse view
# iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.0.0.1:8888
$ VBoxManage modifyvm "webserver" --natpf1 "guestwww,tcp,,8888,10.0.2.15,80"
Whenever I access my webserver I can see in apache logs that all packets are coming from source IP 10.0.2.2.
So any log analyzing is pretty useless because apache thinks that all visitors are coming from the same source!
- Code: Select all Expand viewCollapse view
10.0.2.2 - - [29/Jul/2011:00:37:18 +0300] "GET / HTTP/1.1" 304 212 "-" "Mozilla/5.0 (X11; U; Linux x86_64; lt; rv:1.9.1.19) Gecko/20110701 Iceweasel/3.5.19 (like Firefox/3.5.19)"
10.0.2.2 - - [29/Jul/2011:00:37:35 +0300] "GET / HTTP/1.1" 200 486 "-" "Opera/9.80 (BlackBerry; Opera Mini/6.24209/25.692; U; en) Presto/2.5.25 Version/10.54"
As you can see in the apache log source IP is always 10.0.2.2. First log line if from browser in the host machine and the second log line is from my mobile blackberry.
How can I get original source IP address back?
Is there a better way to do port forwarding?