Assuming my Windows (xp, vista, 2003, 2008, or windows 7) computer is connected directly to the internet and has no router in between...

Is there a way to filter all traffic going TO port 80, so that it instead goes to 3128 (squid HTTP proxy)?

I found this port mapping software, but you need another computer because it can't redirect outgoing requests.

link|improve this question
Even if not native, please let me know a program that can do it instead – Net Citizen Jan 10 '10 at 1:59
There's this really sweet program called Linux that would fix this in a heartbeat. ;) – ErikA Jan 10 '10 at 2:05
1  
In this network arrangement, where does the proxy server live? Is the Windows machine the web server or client? BTW, there is always a router between you and the "Internet". Just as Soilent Green is made of people, the Internet is made of routers. – pcapademic Jan 10 '10 at 9:44
feedback

6 Answers

The product you are looking for is NetCat and does exactly what you need. Check the Wikipedia page. The specific command line you want is

nc -l -p 80 | nc localhost 3128

link|improve this answer
This allows me to receive any traffic on port 80 (incoming). What I need to do is redirect any outgoing traffic on port to go to 127.0.0.1 3128. – Net Citizen Jan 10 '10 at 13:24
feedback

I don't believe this can be done natively in windows. Why don't you just set Squid to listen on port 80?

link|improve this answer
1  
Because I want to transparently router all web page traffic through squid. I don't think setting squid to listen on port 80 has anything to do that. Am I maybe missing something in the understanding of squid? – Net Citizen Jan 10 '10 at 2:00
feedback

This article from Microsoft ( http://support.microsoft.com/kb/819961 ) discusses configuring a proxyserver for the system. For other browsers, such as firefox, you may need to configure the proxy settings independently.

link|improve this answer
I need to do this in a transparent way – Net Citizen Jan 10 '10 at 13:24
feedback

I recognize this doesn't answer your question, but you should really put a real firewall/router appliance in place to do this: I would recommend either pfSense or Smoothwall.

If it has to be a Windows box for whatever reason, your best bet is ISA Server - though typically it handles in-bound routing better so this may not even be possible. As far as I know, Microsoft has not exposed the IP stack in such a way you can add custom routes/translations without writing a custom driver to sit in the network stack.

Excellent ISA resource: http://www.isaserver.org/

link|improve this answer
feedback

If you are using Linux, the best way to do this would be iptables.

Make sure ip_forward is on

echo 1 >/proc/sys/net/ipv4/ip_forward

Replace IP_ADDRESS with your destination IP address

iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination IP_ADDRESS

iptables -t nat -A POSTROUTING -p tcp -d IP_ADDRESS --dport 80 -j MASQUERADE

I use it regularly to redirect all traffic from one server to another server, usually after a server migration into another datacenter.

link|improve this answer
feedback

You can do what you're looking for with SoftPerfect Bandwidth Manager and Squid on a single server.

If you can't handle the cost of SoftPerfect Bandwidth Manager you'd probably do well to get any one of the "canned" Linux distributions that come with Squid pre-installed and just use that.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.