nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Problem with squid

This is a discussion on Problem with squid within the Linux software forums, part of the Linux Getting Started category; I am using Kanotix 2.6.17, KDE 3.5.2, iptables, and a stand alone behind a router. I am trying to get ...

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
  #1 (permalink)  
Old 06-07-2006, 07:15 AM
LRC LRC is offline
Junior Member
User
 
Join Date: Jun 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
LRC
Default Problem with squid

I am using Kanotix 2.6.17, KDE 3.5.2, iptables, and a stand alone behind a router. I am trying to get squid to work and have spent 2-3 weeks browsing dozens of sites asking for help, and have gotten nowhere. Here is what I have done.
# iptables -F
# iptables -X
# iptables -t nat -F
# iptables -t nat -X
# iptables -t mangle -F
# iptables -t mangle -X
# iptables -t nat -A OUTPUT -p tcp --dport 80 -m owner --uid-owner squid -j ACCEPT
# iptables -t nat -A OUTPUT -p tcp --dport 3128 -m owner --uid-owner squid -j ACCEPT
# iptables-save > /etc/sysconfig/iptables
# /etc/init.d/squid restart
Restarting Squid HTTP proxy: squid.

squid.conf uncomented lines

http_port 127.0.0.1:3128
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
maximum_object_size 32768 KB
maximum_object_size_in_memory 8 KB
cache_dir ufs /var/spool/squid 1400 16 256
refresh_pattern Release$ 0 41% 720
refresh_pattern Packages\.gz$ 0 41% 720
refresh_pattern Sources\.gz$ 0 41% 720
refresh_pattern \.orig.tar.gz$ 525600 0% 525600 override-lastmod ignore-reload
refresh_pattern \.diff.gz$ 525600 0% 525600 override-lastmod ignore-reload
refresh_pattern \.deb$ 525600 0% 525600 override-lastmod ignore-reload
refresh_pattern \.dsc$ 525600 0% 525600 override-lastmod ignore-reload
refresh_pattern ^ftp: 0 50% 43200
refresh_pattern ^gopher: 0 50% 720
refresh_pattern \.shtml$ 0 10% 720
refresh_pattern \.html$ 0 50% 720
refresh_pattern \.htm$ 0 50% 720
refresh_pattern \.php.$ 0 10% 720
refresh_pattern \.img$ 0 50% 720
refresh_pattern \.jpeg$ 0 50% 720
refresh_pattern \.jpg$ 0 50% 720
refresh_pattern . 0 20% 720
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255 192.168.7.0/255.255.255.0
acl SSL_ports port 443 563
acl Safe_ports port 80
acl Safe_ports port 21
acl Safe_ports port 443 563
acl Safe_ports port 70
acl Safe_ports port 210
acl Safe_ports port 280
acl Safe_ports port 488
acl Safe_ports port 591
acl Safe_ports port 777
acl Safe_ports port 901
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
icp_access allow all
cache_mgr admin
cache_effective_user squid
cache_effective_group squid
visible_hostname BRYANCLIENT
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on

Two thoughts come to mind. I got something wrong in the squid.conf (even though that is what I was to put), or there is something in the kernel that is blocking what I am trying to do, and if there is I have no clue as to how to get at it. Access.log and cache.log are both empty. I really would like to know how to get this sorted out as so much of what you can do to controll the internet via other packages are depended upon squid.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-07-2006, 11:19 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

Quote:
I am using Kanotix 2.6.17, KDE 3.5.2, iptables, and a stand alone behind a router. I am trying to get squid to work and have spent 2-3 weeks browsing dozens of sites asking for help, and have gotten nowhere
No problem will sort out your problem.

However, let us know your setup. To troubleshoot your problem we need to know exact setup.

Do you want to configure your squid server as a router and proxy server for rest of lan?
Do you have two lan cards in your squid linux server? If so an you specify the IP address for both ?

By looking your iptables rules and squid.conf both configurations are not correct at the movment?

Gives us as much as background and your problem will be sorted out
Reply With Quote
  #3 (permalink)  
Old 06-07-2006, 06:13 PM
LRC LRC is offline
Junior Member
User
 
Join Date: Jun 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
LRC
Default

I have two independent boxes inbehind an off the shelf router. They both are connected to each other and the internet through eth0 with each assigned one IP (I have preassigned for simplicity). One box is run with WinXP and this box with Linux. The Linux box can see the XP (still have to figure out the XP to Linux side) can get on the internet no prob, so my IP is fine. The problem I am having is that there are so many sites dealing with so many ways of setting up squid that as a newbie I have no way of deciphering what applys to me and what does not. Hope that is enough info.
Reply With Quote
  #4 (permalink)  
Old 06-07-2006, 07:19 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
Posts: 586
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 8
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

You have forced squid to accept request from localhost only (127.0.0.1) so it will never ever work with Windows XP or other Lan computer.

First, remove all iptables rules with following command (later we will setup iptables, once squid started to work):
Code:
# service iptables stop
Open squid.conf file:
Find out line that read as follows:
Code:
http_port 127.0.0.1:3128
Replace it:
Code:
http_port 3128
Save the file and restart squid:
Code:
# service squid restart
Now go to Windows box and setup proxy IP and 3128 port.

And test it and it should work.
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #5 (permalink)  
Old 06-07-2006, 09:32 PM
LRC LRC is offline
Junior Member
User
 
Join Date: Jun 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
LRC
Default

For those commands, one problem. I am using the kanotix distro (its debian based) which does not use service or chkconfig commands. I have been using a couple of commands that you can use with /etc/rc.d/init.d/*.*, but I do know that you can't do the same things as service or chkconfig. Do you know what their equivalent commands are or the pack that will allow me to use those?
Reply With Quote
  #6 (permalink)  
Old 06-08-2006, 01:20 AM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
Posts: 482
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 6
monk will become famous soon enough monk will become famous soon enough
Default

Heh, to stop firewall:
create a script and put following lines:

Code:
vi /root/firewall.stop
Append following
Code:
#!/bin/bash
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
Save the script and setup executable permissions:
Code:
chmod +x /root/firewall.stop
Now run script and your firewall will stop:
Code:
/root/firewall.stop


To start/stop/restart squid (Debian and others do not use service command):
Code:
/etc/init.d/squid restart
Rest stuff is same
Reply With Quote
  #7 (permalink)  
Old 06-08-2006, 02:16 AM
LRC LRC is offline
Junior Member
User
 
Join Date: Jun 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
LRC
Default

Thank you. Will have to wait until I get off work to work on it. That is basically what I have been doing all along except the script I have been using shell one line at a time. Sure will simplify things.
Reply With Quote
  #8 (permalink)  
Old 06-08-2006, 02:09 PM
LRC LRC is offline
Junior Member
User
 
Join Date: Jun 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
LRC
Default

I did the firewall.stop and madethe changes to squid and restarted, I have gone no farther because now I am concerned about something else. I am getting an eth0: Tx timeout -reset. I ran ifconfig with this result:
$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:01:53:00:9F:17
inet addr:192.168.7.151 Bcast:192.168.255.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:5 Base address:0xe400

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:130 errors:0 dropped:0 overruns:0 frame:0
TX packets:130 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11224 (10.9 KiB) TX bytes:11224 (10.9 KiB)

Is this happening because squid is finally kicking in and do I then go back and do what you told me to do in the first place, or do I need to make other changes first.
Reply With Quote
  #9 (permalink)  
Old 06-08-2006, 02:26 PM
LRC LRC is offline
Junior Member
User
 
Join Date: Jun 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
LRC
Default

Also what about the line
acl localhost src 127.0.0.1/255.255.255.255 192.168.7.0/255.255.255.0
And that 192.168.7.0 the 0 isn't my IP, but when I did put in the IP squid came back with a warning and on some site it said to just putting a 0 was fine. I am having real difficulty of making any sence as to how squid works.
Reply With Quote
  #10 (permalink)  
Old 06-08-2006, 03:36 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
Posts: 1,521
Thanks: 2
Thanked 16 Times in 13 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

192.168.7.0/255.255.255.0 is your network address/id - It means squid will work with all your network computers including windows XP.

You need to run all commands as the root user.

Replace
Code:
acl localhost src 127.0.0.1/255.255.255.255 192.168.7.0/255.255.255.0
With
Code:
acl localhost src 127.0.0.1/255.255.255.255
Add one more acl called lan
Code:
acl lan src 192.168.7.0/255.255.255.0
And find line that read as:
Code:
http_access allow localhost
Below that append following line:
Code:
http_access allow lan
Restart squid:
Code:
/etc/init.d/squid restart
See if port 3128 is open or not with following of command (paste output here):
Code:
netstat -vat | grep 3128
If port 3128 is open then you can connect from windows XP to linux squid.
__________________
Vivek | My personal blog
Linux Evangelist
+ ADD [SOLVED] thread prefix to your thread when your problem is sorted out by editing your thread.
+ Always use CODE tags for posting system output and commands!
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
Squid configuration problem jhn_daz@yahoo.com Networking, Firewalls and Security 1 06-29-2007 01:58 AM
Squid Problem B!n@ry Linux software 3 04-15-2007 03:36 PM
problem with Squid puppen Linux software 4 01-04-2007 02:45 PM
squid problem dev_dks Linux software 1 08-01-2006 01:42 PM
SQUID ACL Problem kasimani Linux software 15 07-13-2006 05:29 PM


All times are GMT +5.5. The time now is 06:23 AM.


Powered by vBulletin® Version 3.8.3 - Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
©2005-2009 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