nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Problems With SQUID Proxy

This is a discussion on Problems With SQUID Proxy within the Linux software forums, part of the Linux Getting Started category; Cool. All you need to do is modify your iptables rules. Following rules will forward all http requests (coming to ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Linux software

Linux answers from nixCraft.


Linux software General questions and discussion about Redhat/Fedora Core/Cent OS, Debian and Ubuntu Linux related to softwares should go here.

Reply

 

LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 17-06-2006, 12:19 AM
rockdalinux's Avatar
Is that all you got?
User
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 708
Thanks: 15
Thanked 19 Times in 18 Posts
Rep Power: 10
rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light
Default

Cool. All you need to do is modify your iptables rules. Following rules will forward all http requests (coming to port 80) to the Squid server port 3128. Assuming that eth1 connected to linux router for rest of lan and IP is 10.10.1.1, then rule should be:
Code:
iptables -t nat -A PREROUTING -i eth1 -p tcp –dport 80 -j DNAT –to 10.10.1.1:3128
This is for eth0
Code:
iptables -t nat -A PREROUTING -i eth0 -p tcp –dport 80 -j REDIRECT –to-port 3128
Remember 10.10.1.1 should be set as the router for all Windows XP/Linux desktop. If your network is big then use DHCP to send router address.
__________________
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...

Never send a boy to do a mans job.
Reply With Quote
  #12 (permalink)  
Old 19-06-2006, 07:14 PM
Member
User
 
Join Date: Jun 2006
Location: Aveiro, Portugal
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
rcordeiro
Default thanks

well thanks u helped a lot, routing of ports works fine, transparent proxy aswell, only have one last problem, i can't access internal websites with the transparent proxy, dont know whats happening..
i,e: when i go to www.ua.pt it gives me the squid access restriction error msg,
aswell as when i go to www.av.it.pt
(both these sites are internal websites (www.ua.pt is my provider and www.av.it.pt is my company site)
it seems like the routing isnt letting me access internal websites, only external ones.
Reply With Quote
  #13 (permalink)  
Old 19-06-2006, 08:52 PM
rockdalinux's Avatar
Is that all you got?
User
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 708
Thanks: 15
Thanked 19 Times in 18 Posts
Rep Power: 10
rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light
Default

Just do not forward (DNAT) port 80 to 3128 request for www.ua.pt (193.136.173.1 www.av.it.pt (193.136.92.50) IPS. Use following IPTABLES rules:
Code:
iptables -t nat -A PREROUTING -i eth1 -p tcp -s \! 193.136.173.18 --dport 80 -j DNAT --to 192.168.1.1:3128
OR
Code:
iptables -t nat -A PREROUTING -i eth1 -p tcp -s ! 193.136.173.18 --dport 80 -j DNAT --to 192.168.1.1:3128
A "!" argument before the IP address 193.136.173.18 specification inverts the sense of the address i.e. skip this ip from DNAT

Chk out above rules and let me know since i don't have setup like you, i cannot verify it right now.
__________________
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...

Never send a boy to do a mans job.
Reply With Quote
  #14 (permalink)  
Old 19-06-2006, 09:16 PM
Member
User
 
Join Date: Jun 2006
Location: Aveiro, Portugal
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
rcordeiro
Default

hey, thanks.
is it possible for the squid to do that automatically? for example if ur trying to access any .ua.pt or .av.it.pt it would not redirect?
i've read something about never_direct do u know anything about that?
Reply With Quote
  #15 (permalink)  
Old 20-06-2006, 12:08 AM
tom tom is offline
Contributors
User
 
Join Date: Jun 2005
Location: London, UK
Posts: 213
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 5
tom is on a distinguished road
Default

Squid is proxy and redirection is done by Iptables. So you cannot do anything at squid level,IMPO.
Reply With Quote
  #16 (permalink)  
Old 20-06-2006, 03:00 PM
Member
User
 
Join Date: Jun 2006
Location: Aveiro, Portugal
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
rcordeiro
Default

ok. so what does never_direct do ?
sorry for asking,
Reply With Quote
  #17 (permalink)  
Old 20-06-2006, 07:00 PM
Member
User
 
Join Date: Jun 2006
Location: Aveiro, Portugal
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
rcordeiro
Default

ok, the lastest.
i've tried working with the never_direct option from squid, wont work.
i've tried working the iptables but stupidly enough it works when i try lynx www.ua.pt on my core router (previsouly stated as stan), but on a computer connected to that router it wont connect (previously stated as my laptop), no clue why (only way it might work is that the core router has an external ip, so its routing is own requests through that nic and not the internal requests from the lan)
any ideas?
Reply With Quote
  #18 (permalink)  
Old 20-06-2006, 09:24 PM
rockdalinux's Avatar
Is that all you got?
User
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 708
Thanks: 15
Thanked 19 Times in 18 Posts
Rep Power: 10
rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light
Default

Iptables should work with all LAN system, I am not sure what iptables rules you are using. Also make sure iptables is not blocking lan access for your site.
__________________
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...

Never send a boy to do a mans job.
Reply With Quote
  #19 (permalink)  
Old 20-06-2006, 09:32 PM
Member
User
 
Join Date: Jun 2006
Location: Aveiro, Portugal
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
rcordeiro
Default

Ok, it works and through squid, thanks for the help guys

Here's how its done for future reference.

1st. create an acl for the domains that u dont want to go through the proxy

acl directdomains dstdomain .av.it.pt
acl directdomains dstdomain .ua.pt
acl directdomains dstdomain .ieeta.pt

2nd. now lets deny access to the proxy for those domains

never_direct deny directdomains

restart squid

and voilá
we've got transparent proxying for both internal and external websites, via another proxy-server from our isp.

took a week but got it done

thanks again

any questions let me know, if i need help i will surely post here
Reply With Quote
  #20 (permalink)  
Old 20-06-2006, 11:45 PM
tom tom is offline
Contributors
User
 
Join Date: Jun 2005
Location: London, UK
Posts: 213
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 5
tom is on a distinguished road
Default

Cool

It is nice to know that it is working for you. I do keep visiting this forum as I learn something new everyday.

Thanks for sharing back solution.

Just one more question did you used iptables rules mentioned by rocky jr?
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 On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
How to Squid 2.6 transparent proxy? alex.inoa Networking, Firewalls and Security 5 30-10-2007 03:41 AM
Restrict number of simultaneous proxy connections in SQUID proxy pkvmreddy Getting started tutorials 1 15-06-2007 03:52 PM
How to allow MSN messenger through squid proxy bubloob_13 Linux software 4 08-04-2007 09:37 AM
Squid Proxy bubloob_13 Linux software 4 03-12-2006 11:26 PM
problems starting squid for a rank newbie scarletlancer Linux software 1 02-11-2006 04:20 PM


All times are GMT +5.5. The time now is 12:57 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38