About Me

My photo
Hi Friends, I am Sandeep CC and some people know me as System Administrator. I have started my professional career from 2008. I have been working as System Administrator on Linux Server and Windows Client. I am here to share my Knowledge in which I have experienced and which I have come across till now, It could be help to you people. In case anything wrong or any improvements in my post steps, Please comment to the post, Feel free to contact me by posting comments on this blog. Thanks and Regards, Sandeep CC

Monday, September 23, 2013

SPLIT INTERNET SPEED/BANDWIDTH IN SQUID REDHAT LINUX-5

        Split Internet Speed/Bandwidth Limit on Squid REDHAT LINUX -5

Requirements :
1. Squid Installed and configured on Linux Machine.

2. --enable-delay-pools (This is mandatory, To check its enabled or not)
[[root@proxy1 ~]# squid -v
Squid Cache: Version 2.6.STABLE21
configure options:  '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--exec_prefix=/usr' '--bindir=/usr/sbin' '--libexecdir=/usr/lib/squid' '--localstatedir=/var' '--datadir=/usr/share' '--sysconfdir=/etc/squid' '--enable-epoll' '--enable-snmp' '--enable-removal-policies=heap,lru' '--enable-storeio=aufs,coss,diskd,null,ufs' '--enable-ssl' '--with-openssl=/usr/kerberos' '--enable-delay-pools' '--enable-linux-netfilter' '--with-pthreads' '--enable-ntlm-auth-helpers=SMB,fakeauth' '--enable-external-acl-helpers=ip_user,ldap_group,unix_group,wbinfo_group' '--enable-auth=basic,digest,ntlm' '--enable-digest-auth-helpers=password' '--with-winbind-auth-challenge' '--enable-useragent-log' '--enable-referer-log' '--disable-dependency-tracking' '--enable-cachemgr-hostname=localhost' '--enable-underscores' '--enable-basic-auth-helpers=LDAP,MSNT,NCSA,PAM,SMB,YP,getpwnam,multi-domain-NTLM,SASL' '--enable-cache-digests' '--enable-ident-lookups' '--with-large-files' '--enable-follow-x-forwarded-for' '--enable-wccpv2' '--enable-fd-config' '--with-maxfd=16384' 'build_alias=i686-redhat-linux-gnu' 'host_alias=i686-redhat-linux-gnu' 'target_alias=i386-redhat-linux-gnu' 'CFLAGS=-D_FORTIFY_SOURCE=2 -fPIE -Os -g -pipe -fsigned-char' 'LDFLAGS=-pie'
[root@proxy1 ~]#]


3. Check internet is working fine in client side..

4. As per your requirement make different groups...

Scenario : I have installed Squid in RHEL-5 and given internet access to 172.16.4.X subnet... We have Lease line 4Mbps line. I have made 4 groups for different speed limit. This group can access internet speed max what we have assigned speed limit...
Group-1 : 172.16.4.1 to 172.16.4.51 (Unlimited Speed) /etc/squid/unlimited.txt
Group-2 : 172.16.4.51 to 172.16.4.100 (1Mbps) /etc/squid/our_1.5mbps.txt
Group-1 : 172.16.4.101 to 172.16.4.150 (1.5Mbps) /etc/squid/our_1mbps.txt
Group-1 : 172.16.4.151 to 172.16.4.240 (512Kbps) /etc/squid/our_512kbps.txt

Modify : /etc/squid/squid.conf file (Before modification take one backup copy for your safer side...) and enter given dalay_pools details after ACL entries...For group IP entries create 4 files in /etc/squid/ by speed limit as given above names...


##INTERNET SPEED LIMIT###
#Internet Speed Limit Define
acl all src 0.0.0.0/0.0.0.0 ##(Here you can define your Network)
acl unlimited src "/etc/squid/unlimited.txt"
acl our_1.5mbps src "/etc/squid/our_1.5mbps.txt"
acl our_1mbps src "/etc/squid/our_1mbps.txt"
acl our_512kbps src "/etc/squid/our_512kbps.txt"
http_access allow unlimited
http_access allow our_1.5mbps
http_access allow our_1mbps
http_access allow our_512kbps
http_access deny all
delay_pools 4
delay_class 1 2
delay_access 1 allow unlimited
delay_access 1 deny all
delay_parameters 1 -1/-1 -1/-1

delay_class 2 2
delay_access 2 allow our_1.5mbps
delay_access 2 deny all
delay_parameters 2 -1/-1 196608/196608

delay_class 3 2
delay_access 3 allow our_1mbps
delay_access 3 deny all
delay_parameters 3 -1/-1 131072/131072

delay_class 4 2
delay_access 4 allow our_512kbps
delay_access 4 deny all
delay_parameters 4 -1/-1 65536/65536

Save file and Restart Squid Service..

Above given details is 4 pools entry's... Here we have used dalay_class 2 for all 4 pools, as we have allowed dalay_parameters 4 65536/65536 (its in bytes for 512kbps) user can get max speed 512kbps only...as per your requirement you can change with speed limit...


Thanks and Regards,
Sandeep CC

1 comment:


  1. You have shared a great information about Speed Limiter and Economy Remapping. Which are very informative for

    us.Thanks

    ReplyDelete