Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-26-2007, 01:27 PM
|
#1
|
LQ Newbie
Registered: May 2007
Posts: 3
Rep:
|
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
|
|
|
05-26-2007, 11:36 PM
|
#2
|
HCL Maintainer
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450
Rep:
|
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.
|
|
|
05-27-2007, 03:26 AM
|
#3
|
LQ Newbie
Registered: May 2007
Posts: 3
Original Poster
Rep:
|
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.
|
|
|
05-27-2007, 12:33 PM
|
#4
|
HCL Maintainer
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450
Rep:
|
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.
|
|
|
05-28-2007, 12:39 AM
|
#5
|
LQ Newbie
Registered: May 2007
Posts: 3
Original Poster
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 08:12 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|