Iptables: route web traffic of virtual machine through local proxy of host machine
Hi all,
so basically, I want to route all the web traffic (anything going to 80,443,8080) of a virtual machine through a proxy on the linux host machine. (burp invisible proxy on 127.0.0.1:8080).
setup:
virtual windows 7
- virtualbox
- host-only adapter w/o dhcp
- interface: vboxnet0
- ip: 192.168.56.2/24
- gw: 192.168.56.1
- dns: 192.168.1.1
vm runs on linux host
- vboxnet0
-- ip: 192.168.56.1
- wlan0
-- ip: 192.168.1.100/24
-- gw: 192.168.1.1 (router providing internet+dns)
-- dns: 192.168.1.1
- ip-forwarding enabled
- iptables rules:
1) iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
(successfully provides internet to virtual windows)
2) iptables -t nat -A PREROUTING -i vboxnet0 -p tcp -m multiport \
--dports 80,8080,443 -j DNAT --to-destination 127.0.0.1:8080
default policy of all chains is ACCEPT, no other rules
Iptables rule 2 does not achieve my goal, but causes the virtual machine's traffic to the respective ports to be lost somewhere. Nothing arrives at the proxy.
My question is:
What iptables rule(s) can achieve my goal of routing all 80,443,8080 traffic from vboxnet0 through the proxy on 127.0.0.1:8080 of the host machine?
Thanks a lot in advance!
|