LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-25-2014, 05:03 AM   #1
lola.hipf
LQ Newbie
 
Registered: Oct 2014
Posts: 1

Rep: Reputation: Disabled
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!
 
Old 10-26-2014, 07:09 PM   #2
ember1205
Member
 
Registered: Oct 2014
Posts: 176

Rep: Reputation: 16
You're trying to perform destination address translation on the packets - you need to redirect them instead. Additionally, you need ensure that you're redirecting to a port of your proxy server that is configured to support transparent proxy. There are some good examples and additional information here:

http://www.tldp.org/HOWTO/TransparentProxy-6.html
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing Virtual Host from my machine on a local network . akamel Linux - Networking 2 11-19-2013 04:17 PM
Easiest way to redirect external web traffic to VMWare web host on same machine? mattp52 Linux - Networking 4 07-16-2009 02:47 PM
iptables: send all incoming traffic to virtual machine jonaskellens Linux - Newbie 3 06-23-2009 02:22 PM
can't access virtual host from local machine curos Linux - Networking 3 02-06-2006 09:18 PM
X11 Tunneling and Web traffic from local Machine anon111 Linux - Networking 2 01-30-2006 09:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration