squid – your transparent proxy friend

Still my favourite light and fast web proxy is Squid. Its very easy to setup and get running on almost all flavours of linux. You can find it here http://www.squid-cache.org/ but will probably find it in your local package manager…

This is for more my own reference… as i don’t think too many people have the need for a transparent proxy. You only need one NIC configured on your VM / machine as its most probably on the same subnet as your dsl etc…

1. Setup squid working as a proxy first!

Set the default gateway on the NIC to your router. I also added a default route 0.0.0.0 sub 0.0.0.0 to the router also just in case the default route didn’t work. But seemed to!

Setup DNS! remember you should be able to resolve a name to an IP without issues (can cause most of the problems) Point your default DNS to your router (most have built in DNS forwarders), else you can just use your ISP’s DNS’s

2. Change the squid.config to have the necessary changes to act as a transparent proxy;

nano /etc/squid/squid.conf

http_port 3128 transparent

3. Put this into the startup script; (usually in rc.d under etc) rc.local

iptables -t nat -A PREROUTING -i eth0 -p tcp –dport 80 -j REDIRECT –to-port 3128

This redirects standard tcp requests to 3128 (squid’s port)… transparent to user

4. Ensure that IP forwarding is ENABLED;

change ip_forward from 0 to 1 (usually a txt file somewhere with 0 in it), do a search and you will find it… most probably in the ipv4 directory. This way all 443 (https and other apps) can forward to the web without issue…

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

Should be it…. else good luck!

Update: I have done an updated post about configuring open solaris as a transparent proxy here : http://sigtar.com/2009/04/22/opensolaris-configuring-squid-as-transparent-proxy/

136 Replies to “squid – your transparent proxy friend”

  1. Its wonderful as your other blog posts : D, regards for posting . “Experience is that marvelous thing that enables you to recognize a mistake when you make it again.” by Franklin P. Jones.

  2. I like the valuable info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I’m quite certain I will learn lots of new stuff right here! Best of luck for the next!

  3. Hey would you mind letting me know which webhost you’re working with?
    I’ve loaded your blog in 3 different web browsers and I must say this blog loads a lot quicker then most.
    Can you suggest a good web hosting provider at a reasonable price?
    Thanks, I appreciate it!

  4. I’m really impressed with your writing skills and also with the layout on your blog. Is this a paid theme or did you customize it yourself? Anyway keep up the nice quality writing, it is rare to see a nice blog like this one these days..

  5. I will right away snatch your rss feed as I can not to find your e-mail subscription link or newsletter service. Do you’ve any? Please permit me recognize in order that I may just subscribe. Thanks.

  6. Someone necessarily assist to make critically posts I’d state. This is the very first time I frequented your website page and thus far? I amazed with the research you made to make this particular post amazing. Fantastic activity!

  7. An interesting discussion is worth comment.

    I do believe that you should publish more on this subject
    matter, it may not be a taboo subject but generally people do not talk about such subjects.
    To the next! All the best!!

  8. I want to convey my affection for your kindness for people who need guidance on this situation. Your special commitment to passing the message all around was rather powerful and have in most cases made guys just like me to achieve their desired goals. Your amazing useful guidelines implies a lot to me and a whole lot more to my office workers. Many thanks; from everyone of us.

  9. I do trust all the concepts you’ve offered in your post. They’re very convincing and can certainly work. Nonetheless, the posts are very short for novices. Could you please lengthen them a bit from next time? Thanks for the post.

  10. Generally I do not read post on blogs, but I would like to say that this write-up very forced me to check out and do so! Your writing taste has been surprised me. Thank you, very great post.

  11. Neat blog! Is your theme custom made or did you download it from somewhere?

    A theme like yours with a few simple tweeks would really make my blog stand out.
    Please let me know where you got your theme. Many thanksfast delivery

  12. Thanks for sharing superb informations. Your web site is very cool. I’m impressed by the details that you have on this blog. It reveals how nicely you understand this subject. Bookmarked this website page, will come back for extra articles. You, my pal, ROCK! I found just the information I already searched everywhere and simply could not come across. What a perfect web site.

  13. Hiya, I’m really glad I have found this information. Nowadays bloggers publish only about gossips and net and this is actually irritating. A good blog with exciting content, this is what I need. Thank you for keeping this web site, I will be visiting it. Do you do newsletters? Can’t find it.

  14. you’re truly a good webmaster. The web site loading speed is amazing. It kind of feels that you are doing any unique trick. Also, The contents are masterpiece. you’ve performed a magnificent task on this topic!

  15. You really make it seem so easy together with your presentation but I to find this topic to be actually something that I feel I might by no means understand. It kind of feels too complicated and very wide for me. I’m having a look forward in your subsequent put up, I will attempt to get the hold of it!

Leave a Reply

Your email address will not be published.