Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Linux Newbie > iptable and redirect

Forgot Password?
 Linux Newbie   If you're new to the wonderful world of Linux, start here!

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 03-27-2003   #1 (permalink)
Just Joined!
 
Join Date: Mar 2003
Posts: 36
iptable and redirect

iptables -t nat -A PREROUTING -p tcp -s 192.168.0.0/16 --dport 80 -j REDIRECT --to-port 3128
ihave added this rule to redirect all my http request to port 3128 but its not working.
plz help.
l_linuxguru is offline  


Reply With Quote
Old 03-28-2003   #2 (permalink)
Linux Enthusiast
 
Join Date: Jun 2002
Location: San Antonio
Posts: 622
Send a message via AIM to wassy121
that probably does exactly what you told it to:
Code:
iptables -t nat
will add this rule to the "nat" table
Code:
-A PREROUTING -p tcp -s 192.168.0.0/16
will make this rule happen before it is routed through the box, and will act on all TCP requests that come from 192.168.0.0/16 (which is your internal network)
Code:
--dport 80 -j REDIRECT --to-port 3128
will assure that packets going to port 80 of the destination will redirect to port 3128.

So you are saying that when an internal client (like the computer you type at) tries to go to "hotmail.com" it is redirected to "hotmail.com:3128". Is this what you want?
__________________
I respectfully decline the invitation to join your delusion.
wassy121 is offline   Reply With Quote
Old 03-29-2003   #3 (permalink)
Just Joined!
 
Join Date: Mar 2003
Posts: 36
Quote:
Originally Posted by wassy121
that probably does exactly what you told it to:
Code:
iptables -t nat
will add this rule to the "nat" table
Code:
-A PREROUTING -p tcp -s 192.168.0.0/16
will make this rule happen before it is routed through the box, and will act on all TCP requests that come from 192.168.0.0/16 (which is your internal network)
Code:
--dport 80 -j REDIRECT --to-port 3128
will assure that packets going to port 80 of the destination will redirect to port 3128.

So you are saying that when an internal client (like the computer you type at) tries to go to "hotmail.com" it is redirected to "hotmail.com:3128". Is this what you want?

my proxy server add is 192.168.23.1(internal) iwant all the client request to redirect to it on port 3128.
l_linuxguru is offline   Reply With Quote
Old 03-30-2003   #4 (permalink)
Linux Guru
 
Join Date: Oct 2001
Location: Täby, Sweden
Posts: 7,578
Quote:
Originally Posted by wassy121
So you are saying that when an internal client (like the computer you type at) tries to go to "hotmail.com" it is redirected to "hotmail.com:3128". Is this what you want?
I think you've misunderstood the REDIRECT target, wassy. It redirects the port _and_ destination address. It's just that the address is changed to that of the interface that the packet came in through, so in that way it should work.

Download ethereal (if it's not already installed) and check some test traffic to see what's wrong. Also, how doesn't it work? Does it have no effect at all (like the client fetching the content directly from hotmail.com) or does the client fail to connect?
Dolda2000 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 05:50 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2