LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-26-2007, 01:27 PM   #1
tim_24
LQ Newbie
 
Registered: May 2007
Posts: 3

Rep: Reputation: 0
redirect traffic


Hi all,
I have a linux system (2.4), 1 nic.
I have a user level http proxy program that's running and listens on port 9999.

I want to proxy web traffic (still, from same system) without manually config browser to point to my local proxy:9999.

Is it possible to do it with iptable rules?
If so, please give me some details.

If not, what are other solutions for this?

Thanks a lot for any help
Tim
 
Old 05-26-2007, 11:36 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 79
Have you tried something like this:
Code:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 9999
(that way, any traffic destined for tcp port 80 will be redirected to port 9999)

P.S., there are many threads pertaining to this question, and googling is also helpful.
 
Old 05-27-2007, 03:26 AM   #3
tim_24
LQ Newbie
 
Registered: May 2007
Posts: 3

Original Poster
Rep: Reputation: 0
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 9999

I think this rule is for inbound traffic, right?
May be my question was not clear.
I want to redirect outbound traffic from local browser to my program
(same system).

Thanks again for any help.
 
Old 05-27-2007, 12:33 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 79
Quote:
Originally Posted by tim_24
I think this rule is for inbound traffic
What makes you think that?

Take some time to read up () on transparent proxying.
 
Old 05-28-2007, 12:39 AM   #5
tim_24
LQ Newbie
 
Registered: May 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Hi 0sor,
I did read it. May be I'm too dumb or something.

I even try it here on my linux machine by these steps:

1>Add rule: iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 9999

2>running my app listen on tcp port 9999
3>open browser and go to www.yahoo.com

my app doesn't get any connection at all.

Please clarify.
Thanks again.
 
  


Reply


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
Redirect All Traffic Through SSH wwnexc Linux - Networking 2 03-14-2007 06:37 AM
how to redirect traffic from one server to another orko Linux - Networking 1 08-12-2006 09:48 AM
redirect traffic tim24 Linux - Networking 5 04-06-2006 11:45 AM
Traffic redirect friki Linux - Software 2 11-04-2004 05:59 PM
Redirect traffic to internal IP? xmutex Linux - Networking 1 08-13-2001 11:29 AM

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

All times are GMT -5. The time now is 08:12 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