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


  Search this Thread
Old 03-23-2010, 06:08 PM   #1
LQ Newbie
Registered: Mar 2010
Posts: 1

Rep: Reputation: 0
Setting up a transparent proxy with only one box.

I am playing around with transparent proxies, unfortunately I do not have two machines to test it out with. The current way I am doing things is the program makes a request to a computer on port 80, I use
iptables -t nat -A OUTPUT -p tcp --destination-port 80 -j REDIRECT --to-port 1234
to redirect to my proxy that is listening on port 1234. The proxy will send out a request to port 81 (as all outbound port 80 are being fed back in to the proxy and if it sent out to port 80 it would just be a infinite loop) so I want to do something like
iptables -t nat -A OUTPUT -p tcp --destination-port 81 -j DNAT --to-destination xxxx:80
The problem lies with the xxxx part. How do I change the destination port without changing changing the destination ip? Or am I doing this setup completely wrong, I am learning after all and constructive criticism is definitely appreciated.

The machine I am using is pretty low end so I would like not not have to create a VM with a second box unless absolutely necessary.
Old 03-23-2010, 06:32 PM   #2
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 96
To avoid the cycle
iptables -t nat -A OUTPUT -p tcp --destination-port 80 -m owner --gid-owner your_gid -j REDIRECT --to-port 1234

or you can mark packets

Last edited by troop; 03-23-2010 at 06:36 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
setting up dansguardian as a transparent proxy for hosts dcordina Ubuntu 3 03-02-2009 08:57 AM
setting up transparent proxy tsaravan Linux - Networking 4 03-30-2007 07:44 AM
Setting up transparent router box after m0n0wall GUIPenguin Linux - Networking 3 05-21-2006 04:28 PM
Setting up a Linux box for layer 2, transparent bridging GUIPenguin Linux - Networking 2 05-20-2006 04:15 PM
Can my Linux box be used as a transparent proxy on the LAN side of my router? Steve2001 Linux - Networking 5 02-01-2005 11:12 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:51 AM.

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