Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my company, all http and https must connect to a proxy server, which means we must set proxy in our web browser.

Our department has an internal network ( I use a Linux server as router, use iptables to setup NAT.

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

Now, the Linux router works well. We can set proxy to access Internet.

My question is: I want to use the Linux router to connect the proxy server, then the computers in our internal network ( could visit Internet without setting proxy.

Is this possible?

share|improve this question

Try this rule:

iptables -t nat -A PREROUTING -i eth0 -s ! -p tcp --dport 80 -j DNAT --to
iptables -t nat -A POSTROUTING -o eth0 -s -d -j SNAT --to
iptables -A FORWARD -s -d -i eth0 -o eth0 -p tcp --dport 3128 -j ACCEPT

where: - proxy server IP (Squid, etc); - router IP (where started iptables); - your local network

I could be wrong, check carefully.

share|improve this answer

Without having tested it I think the solution @ymn is valid for HTTP, but I don't think you can get around specifying an equivalent line for HTTPS - indeed any such solution should throw up certificate errors etc because you are, in-effect, doing a man-in-the-middle attack on your own network.

(You may be able to get round this - to some degree - but its not a good idea as you are stripping the security SSL gives. Have a look at sslstrip -

Maybe a better middle ground might be to try doing proxy autoconfiguration (WPAD with DHCP) -

share|improve this answer
There is already a squid server on my router now. – siyuan Feb 2 '13 at 7:10
Thank you! There is already a squid server on my router now. Suppose my company's proxy is, we setup a squid Now, we can access Internet by setting proxy as or What I want is to access Internet without setting proxy, because some program can't set proxy, such as some online update. – siyuan Feb 2 '13 at 7:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .