Thursday, 21 April 2011

linux-configuration-Complete Steps in Setting up UBUNTU Server 10.04 with SQUID 3 as a Transparent Proxy


=> linux-configuration ; Complete Steps in Setting up UBUNTU Server 10.04  with SQUID 3 as a Transparent Proxy.

Step 1. Install the Ubuntu Server 10, include LAMP if you want
Step 2. Change the network interfaces from dhcp to static
sudo vim /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.10.4
netmask 255.255.255.0
network 192.168.10.0
broadcast 192.168.10.255
gateway 192.168.10.10
post-up iptables-restore < /etc/iptables.up.rules
auto eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
Step 3. Install Web Admin (webmin) (Optional)
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.510-2_all.deb
dpkg –install webmin_1.510-2_all.deb
sudo apt-get -f install
https://localhost-IP ADDRES:10000
*Note Make sure you give permission to the IPTABLES ruleset to for you to access webmin over the net.
Step 4. Install ClamAV and ClamAV-freshclam
sudo apt-get install clamav clamav-freshclam
Step 5. The first step is to install squid 3
sudo apt-get install squid3
edit the squid 3 configuration file in your favorite editor
sudo vim /etc/squid3/squid.conf
and set the transparency and the allowed hosts
http_port 3128 transparent
acl our_networks src 192.168.1.0/24
acl localnet src 127.0.0.1/255.255.255.255
http_access allow our_networks
http_access allow localnet
where 192.168.2.0/24 is the IP range of local network. Probably you need to adjust the swap size
cache_dir ufs /var/spool/squid3 7000 16 256
here the first number denotes the size of cache in megabytes. Save you changes and restart the squid proxy by
sudo /etc/init.d/squid3 restart
Step 6. Edit the /etc/sysctl.conf
sudo vim /etc/sysctl.conf
Net.ipv4.ip_forward = 1

Step 7. Edit the IPTABLE ruleset of NAT and FILTER
sudo vim /etc/iptables.up.rules   (make a new file)
*nat
-A PREROUTING –i eth1 –p tcp –m tcp –dport 80 –j DNAT –to-destination 192.168.1.1:3128
-A PREROUTING –i eth1 –p tcp –m tcp –dport 80 –j REDIRECT –to-ports 3128
-A POSTROUTING –s 192.168.1.0/24 –o eth0 –j MASQUERADE
*filter
-A INPUT –i lo –j ACCEPT
-A INPUT –m state –i eth0 –state REALATED,ESTABLISHED –j ACCEPT
-A INPUT eth1 –j ACCEPT
-A INPUT –p tcp –m tcp –dport 22 –j ACCEPT # permit ssh using putty
-A INPUT –p tcp –m tcp –dport 10000 –j ACCEPT # permit webmin access
-A INPUT –j LOG
-A INPUT –j DROP
-A FORWARD –i eth1 –j ACCEPT
-A OUTPUT –o lo –j ACCEPT
-A OUTPUT –o eth1 –j ACCEPT
-A FOWARD –o eth1 –j ACCEPT
-A FORWARD –s 192.168.1.0/24 –o eth0 –j ACCEPT
-A FORWARD –d 192.168.1.0/24 –m state –state ESTABLISHED,REALTED –I eth0 –j ACCEPT
STEP 8. Edit rc.local
sudo vim /etc/rc.local
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 –o eth0 -j MASQUERADE
Step 9. reboot the server
Step 10. Configure the workstation for static IP Address making the LAN IP of the Ubuntu box as the gateway. Make sure that the IP Address of the work station is within the network you setup

Wednesday, 20 April 2011

linux-configuration-UBUNTU Server 10.10 64bit with SQUID as a Transparent Proxy via video caching


# linux-configuration - UBUNTU Server 10.10 64bit  with SQUID  as a Transparent Proxy via video caching

Download Squid Stable # 7 of 9 in here:
tar xvf squid-2.7.STABLE9 + patch.tar.gz
cd squid-2.7.STABLE9

# Do the compilation is:

    . / Configure - prefix = / usr - exec_prefix = / usr - bindir = / usr / sbin - sbindir = / usr / sbin - libexecdir = / usr / lib / squid - sysconfdir = / etc / squid \
    - Localstatedir = / var / spool / squid - datadir = / usr / share / squid - enable-async-io = 24 - with-aufs-threads = 24 - with-pthreads - enable-storeio = aufs \
    - Enable-linux-netfilter - enable-arp-ACL - enable-epoll - enable-removal-policies = heap - with-aio - with-dl - enable-snmp \
    - Enable-delay-pools - enable-htcp - enable-cache-digests - disable-unlinkd - enable-large-cache-files - with-large-files \
    - Enable-err-languages
​​= Bahasa Inggeris - enable-default-err-language = Bahasa Inggeris - with-maxfd = 65536
Later:
make
sudo make install

up here has been installed on the machine squid proxy yukk ok .... More ..

Ready editing Squid.conf
Stop Squid # sudo / etc / init.d / squid stop
for the command sudo / etc / init.d / squid stop street in ubuntu 10.10,
Copy this file under the squid to / etc / init.d /
how to type:

nano / etc / init.d / squid

 PASTE FILE BELOW

     #! / Bin / sh
    #
    # Startup script for the Squid HTTP proxy squid-cache.
    #
    # Version: @ (#) squid.rc 2:20 01-Oct-2001 miquels@cistron.nl
    #
    # # # BEGIN init INFO
    # ORARI: squid
    # Required-Start: $ network $ local_fs
    # Required-Stop: $ network $ local_fs
    # Should-Start: $ named
    # Should-Stop: $ named
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Squid HTTP Proxy
    # # # END init INFO

    NAME = squid
    Daemon = / usr / sbin / squid
    LIB = / usr / lib / squid
    PIDFILE = / var / run / $ NAME.pid
    SQUID_ARGS = "-D-YC"

    [! -F / etc / default / squid] | |. / Etc / default / squid

    . / Lib / LSB / init-functions

    PATH = / bin: / usr / bin: / sbin: / usr / sbin

     $ daemon] | | exit 0

    grepconf () {
    w = "" # space tab
    sq = / etc / squid / squid.conf
    # Sed is cool.
    res = `sed-ne '
    s / ^ '$ 1'['"$ w "'] \ + \ ([^'"$ w" '] \ + \ ).*$/ \ 1 / p;
    t end;
    d;
    : End q '<$ sq `
    [-N "$ res"] | | res = $ 2
    echo "$ res"
    }

after press crtl + x and then yes,
ok the file / etc / init.d / squid we have made, for the file we made earlier can be employed, we must give the file permissions on the directory with the command:

    chown proxy: proxy / etc / init.d / squid
    chmod 777 / etc / init.d / squid

Now the proxy is able to stop the order
sudo / etc / init.d / squid stop
when it is at the stop, its time for us to edit squid.conf ... way
1. Beck up the original squid.conf file with the command
mv / etc / squid / squid.conf / etc / squid / squid.conf.asli
2. Creat a new squid config
nano / etc / squid / squid.conf
Then, paste and adjust with your network config file under the squid
    # # Start of config
    3128 http_port transparent
    server_http11 on
    icp_port 0

    # File Squid
    pid_filename / var / run / squid.pid
    coredump_dir / var / spool / squid /
    error_directory / usr / share / squid / errors / en /
    icon_directory / usr / share / squid / icons
    mime_table / usr / share / squid / mime.conf
    visible_hostname applied rate-dayak

    # Log Squid
    access_log / var / log / squid / access.log
    cache_log / dev / null
    cache_store_log / dev / null

    # Some log opsi2 who was not significant because it is rarely used.
    log_fqdn off
    log_icp_queries off
    buffered_logs off
    emulate_httpd_log off

    ftp_list_width 32
    ftp_passive on
    ftp_sanitycheck on

    ACL localnet src 192.168.10.0/24 # ------>> LAN IP DGN skipper PARTS
    ACL localnet src 192.168.12.0/24
    uri_whitespace strip

    # DNS nameserver
    dns_nameservers 192.168.1.1 192.168.5.1 # ------->> CHANGE HIS PROXY GATEWAI DG

    cache_mem 8 MB
    maximum_object_size_in_memory 100 bytes
    memory_replacement_policy heap GDSF
    cache_replacement_policy heap LFUDA

    cache_dir aufs / cache 30000 70 256         #  swap created command  # squid –z

    minimum_object_size 0 bytes
    maximum_object_size 512 MB
    offline_mode off
    cache_swap_low 98
    cache_swap_high 99

    # Setup some default acls
    src ACL all 0.0.0.0 / 0
    ACL localhost src 127.0.0.1/32
    ACL safeports port 21 70 80 81 210 280 443 488 563 591 631 777 901 3128 1025-65535
    ACL sslports port 443 563 81
    ACL manager proto cache_object
    ACL purge Purge method
    ACL Connect CONNECT method
    dynamic ACL urlpath_regex cgi-bin \?
    http_access allow manager localhost
    http_access deny manager
    http_access allow purge localhost
    http_access deny purge
    http_access deny! safeports
    http_access deny CONNECT! sslports
    # Always allow localhost connections
    http_access allow localhost

    # Allow local network (s) on interface (s)
    http_access allow localnet
    # Default block all to be sure
    http_access deny all
    header_access X-Forwarded-For deny all
    # Follow_x_forwarded_for allow localnet
    # Allow localhost follow_x_forwarded_for
    # Http_gzip on

    # Http_gzip_types text / plain, text / html, application / xml, text / css, application / xml, application / xhtml + xml, application / rss + xml, application / javascript, application / x-javascript

    0x30 tcp_outgoing_tos localnet
    zph_mode tos
    zph_local 0x30
    zph_parent 0
    zph_option 136
 
# DELAY POLL ACL admin src 192.168.88.100/32 # # IP YG TDK TAXABLE LIMIT
# ACL management IP src 192.168.88.101/32 # YG NOT BE LIMIT
# ACL download url_regex-i \. Avi $ \. Mpg $ \. Mpeg $ \. Rm $ \. Iso $ \. Wav $ \. Mov $ \.Dat $ 
#. Mpe $ \. Mid $ \. Flv $ \ .3 gp $ 
# ACL download url_regex-i ftp \. Exe $ \. Mp3 $ \. Mp4 $ \. Tar.gz $ \. Gz $ \. Tar.bz2 $ \. Rpm $ \. Zip $ \. Rar 
#ACL download url_regex-i \. Midi $ \. RMI $ \. Wma $ \. Wmv $ \. Ogg $ \. OGM $ \. M1v $ \. MP2 $ \. Mpa $ \. Wax $
# ACL download url_regex-i \. M3U $ \. Asx $ \. WPL $ \. Wmx $ \. DVR-ms $ \. SND $ \. Au $ \. AIF $ \. Asf $ \. M2V $
# ACL download url_regex-i \. M2p $ \. Ts $ \. Tp $ \. Trp $ \. P $ \. Divx $ \. Mod $ \. Vob $ \. AOB $ \. DTS $
# ACL download url_regex-i \. AC3 $ \. CDA $ \. Vro $ \. Deb $ \. Mkv $
 # Delay_pools 2
 # Delay_class 1 1
 # Delay_parameters a -1/-1
 # Delay_access 1 allow admin 
 # Delay_access 1 allow admin management
 # Delay_access 1 deny all

    # Delay_class 2 1
    # Delay_parameters 2 40000/5000000
    # 2 delay_access allow download
    # Delay_access 2 deny all

    # Caching Youtube
    ACL videocache_allow_url url_regex-i \. youtube \. com \ / get_video \?
    ACL videocache_allow_url url_regex-i \. youtube \. com \ / videoplayback \. youtube \. com \ / videoplay \. youtube \. com \ / get_video \?
    ACL videocache_allow_url url_regex-i \. youtube \. [az] [az] \ / videoplayback \. youtube \. [az] [az] \ / videoplay \. youtube \. [az] [az] \ / get_video \?
    ACL videocache_allow_url url_regex-i \. GoogleVideo \. com \ / videoplayback \. GoogleVideo \. com \ / videoplay \. GoogleVideo \. com \ / get_video \?
    ACL videocache_allow_url url_regex-i \. google \. com \ / videoplayback \. google \. com \ / videoplay \. google \. com \ / get_video \?
    ACL videocache_allow_url url_regex-i \. google \. [az] [az] \ / videoplayback \. google \. [az] [az] \ / videoplay \. google \. [az] [az] \ / get_video \?
    ACL videocache_allow_url url_regex-i proxy [a-z0-9 \ -] [a-z0-9] [a-z0-9] [a-z0-9]? \. Dailymotion \. com \ /
    ACL videocache_allow_url url_regex vid-i \. CMA \. Dailymotion \. com \ /
    ACL videocache_allow_url url_regex-i [a-z0-9] [0-9a-z] [0-9a-z] [0-9a-z] [0-9a-z]? \. xtube \. com \ flv /(.*)
    ACL videocache_allow_url url_regex-i \. Vimeo \. com \ /(.*) \. (flv | mp4)
    ACL videocache_allow_url url_regex-i va \. wrzuta \. pl \ / wa [0-9] [0-9] [0-9] [0-9]?
    ACL videocache_allow_url url_regex-i \. youporn \. com \ /(.*) \. flv
    ACL videocache_allow_url url_regex-i \. msn \. com \. edgesuite #. net \ /(.*) \. flv
    ACL videocache_allow_url url_regex-i \. tube8 \. com \ /(.*) \. (wmv | 3gp)
    ACL videocache_allow_url url_regex-i \. mais \. uol \. com \. br \ /(.*) \. flv
    ACL videocache_allow_url url_regex-i \. blip \. tv \ /(.*) \. (wmv | avi | mov | mp3 | m4v | mp4 | wmv | rm | ram | m4v)
    ACL videocache_allow_url url_regex-i \. break \. com \ /(.*) \. (flv | mp4)
    ACL videocache_allow_url url_regex redtube-i \. com \ /(.*) \. flv
    ACL videocache_allow_dom dstdomain. mccont.com. metacafe.com. cdn.dailymotion.com
    ACL videocache_deny_dom dstdomain. download.youporn.com. static.blip.tv
    ACL dontrewrite url_regex redbot \. org \. php
    ACL getmethod GET method

    Improving storeurl_access dontrewrite
    storeurl_access deny! getmethod
    Improving storeurl_access videocache_deny_dom
    storeurl_access allow videocache_allow_url
    storeurl_access allow videocache_allow_dom
    storeurl_access deny all

    storeurl_rewrite_program / etc / squid / storeurl.pl
    storeurl_rewrite_children 7
    storeurl_rewrite_concurrency 10

    # 1 year = 525600 mins, 1 month = 43,200 mins, 1 day = 1440

    refresh_pattern (get_video \? | videoplayback \? | videodownload \? | \. flv?) 43 200 999 999% 43200 ignore-no-no-cache ignore-private ignore-store override-expire override-lastmod reload-into-IMS-stale store
    refresh_pattern (get_video \? | videoplayback \? id | id .* videoplayback | videodownload \? | \. flv?) 43 200 999 999% 43200 ignore-no-no-cache ignore-private ignore-store override-expire override-lastmod reload- store-into-IMS stale
    refresh_pattern \. (ico | video-stats) 43 200 999 999% 43200 override-expire ignore-reload ignore-no-cache ignore-no-store ignore-private ignore-auth-override-lastmod ignore negative-must-revalidate store TTL = 10080 -stale
    refresh_pattern \. etology \? 43200 999999% 43200 override-expire ignore-reload ignore-no-store cache-stale
    galleries refresh_pattern \. video (\? | sz) 43 200 999 999% 43200 override-expire ignore-reload ignore-no-store cache-stale
    brazzers refresh_pattern \? 43200 999999% 43200 override-expire ignore-reload ignore-no-store cache-stale
    refresh_pattern \. adtology \? 43200 999999% 43200 override-expire ignore-reload ignore-no-store cache-stale
    refresh_pattern ^ .* (utm \. gif | ads \? | rmxads \. com | ad \. z5x #. net | bh \. contextweb \. com | bstats \. adbrite \. com | a1 \. interclick \. com | ad \. trafficmp \. com | ads \. cubics \. com | ad \. xtendmedia \. com | \. googlesyndication \. com | advertising \. com | yieldmanager | game-advertising \. com | pixel \. quantserve \. com | adperium \. com | DoubleClick #. net | adserving \. cpxinteractive \. com | Syndication \. com | media.fastclick.net) .* 43 200 20% 43200 ignore-no-cache ignore-no-store ignore private override-expire ignore-reload ignore-ignore-auth-must-revalidate stale store-negative, TTL = 40320 max-stale = 10
    refresh_pattern ^ .* google .* safebrowsing 43200 999999% 43200 override-expire ignore-reload ignore-no-cache ignore-private ignore-auth-must-revalidate ignore negative, TTL = 10080 store-stale
    refresh_pattern ^ http:// ((CBK | mt | MIC | MLT) [0-9]?) \. google \. co (m | \. uk) 43 200 999 999% 43200 override-expire ignore-reload ignore-private store negative-stale-TTL = 10080
    ytimg refresh_pattern \. com .* \. jpg 43200 999999% 43200 override-expire ignore-reload-stale store
    images refresh_pattern \. friendster \. com .* \. (png | gif) 43 200 999 999% 43200 override-expire ignore-reload-stale store
    garena refresh_pattern \. com 43200 999999% 43200 override-expire reload-into-IMS-stale store
    photobucket refresh_pattern .* \. (jp (e? g | e | 2) | tiff? | bmp | gif | png) 43 200 999 999% 43200 override-expire ignore-reload-stale store
    vid refresh_pattern \. CMA \. Dailymotion \. com .* \. On2 \? 43200 999999% 43200 ignore-no-cache override-expire override-lastmod store-stale
    mediafire.com refresh_pattern \ / images .* \. (jp (e? g | e | 2) | tiff? | bmp | gif | png) 43 200 999 999% 43200 reload-into-IMS override-expire ignore-private store-stale
    refresh_pattern ^ http: \ / \ / images | pics | thumbs [0-9] \. 43200 999999% 43200 reload-into-IMS ignore-no-cache ignore-no-store ignore-reload override-expire stale store-
    refresh_pattern ^ http: \ / \ / www.onemanga.com .* \ / 43200 999999% 43200 reload-into-IMS ignore-no-cache ignore-no-store ignore-reload override-expire stale store-
    http://v refresh_pattern ^ \. okezone \ com / get_video \ / ([a-ZA-Z0-9]) 43 200 999 999% 43200 override-expire ignore-reload ignore-no-cache ignore-no-store ignore- private ignore-auth-override-lastmod ignore-must-revalidate negative TTL = 10080 store-stale

    # ANTI VIRUS
    refresh_pattern avast.com .* \. vpx 40,320 50% 161,280 stale store-reload-into-IMS
    refresh_pattern (avgate | avira) .* \. (IDX | gz) $ 1,440 90% 1440 ignore-reload ignore-no-cache ignore-no-store ignore-stale store-must-revalidate
    refresh_pattern kaspersky .* \. AVC% 5259487 $ 5259487 999999 ignore-reload-stale store
    refresh_pattern kaspersky 1440 50% 161280 ignore-no-store cache-stale
    refresh_pattern mbamupdates.com .* \. ref 1440 50% 161,280 IMS reload-into-store-stale

    refresh_pattern windowsupdate.com / .* \. (cab | exe) 43200 10 080 999 999% ignore-no-cache ignore-no-store ignore-reload reload-into-IMS-stale store
    refresh_pattern update.microsoft.com / .* \. (cab | exe) 43200 10 080 999 999% ignore-no-cache ignore-no-store ignore-reload reload-into-IMS-stale store
    refresh_pattern download.microsoft.com / .* \. (cab | exe) 43200 10 080 999 999% ignore-no-cache ignore-no-store ignore-reload reload-into-IMS-stale store

    # Images facebook
    refresh_pattern-i \. facebook.com .* \. (jpg | png | gif) 129 600 999 999% 129600 ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
    refresh_pattern-i \. fbcdn.net .* \. (jpg | gif | png | swf | mp3) 129 600 999 999% 129600 ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
    static refresh_pattern \. ak \. fbcdn #. net * \. (jpg | gif | png) 129 600 129 600 999 999% ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
    refresh_pattern ^ http: \ / \ / profile \. ak \. fbcdn.net * \. (jpg | gif | png) 129 600 999 999% 129600 ignore-reload override-expire ignore-no-cache ignore-no-store store-stale

    # Games facebook
    refresh_pattern ^ http: \ / \ / apps.facebook.com .* \ / 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
    refresh_pattern-i \. zynga.com .* \ / 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store ignore-store, must-revalidate stale
    refresh_pattern-i \. farmville.com .* \ / 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store ignore-store, must-revalidate stale
    refresh_pattern-i \. ninjasaga.com .* \ / 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store ignore-store, must-revalidate stale
    refresh_pattern-i \. mafiawars.com .* \ / 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store ignore-store, must-revalidate stale
    refresh_pattern-i \. crowdstar.com .* \ / 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store ignore-store, must-revalidate stale
    refresh_pattern-i \. popcap.com .* \ / 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store ignore-store, must-revalidate stale

    # Banner IIX
    refresh_pattern ^ http: \ / \ / OpenX .* \. (jp (e? g | e | 2) | gif | pn [PG] | swf | ico | css | tiff?) 129 600 129 600 99 999% reload-into-IMS ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
    refresh_pattern ^ http: \ / \ / ads (1 | 2 | 3). kompas.com .* \ / 43 200 99 999% 129,600 IMS reload-into-ignore-reload override-expire ignore-no-cache ignore-no-store store -stale
    refresh_pattern ^ http: \ / \ / img.ads.kompas.com .* \ /% 129600 43200 99999 reload-into-IMS ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
    refresh_pattern. kompasimages.com .* \. (jpg | gif | png | swf) 43 200 99 999% 129 600 reload-into-IMS ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
refresh_pattern ^ http: \ / \ / openx.kompas.com .* \ /% 129600 43200 99999 reload-into-IMS ignore-reload override-expire ignore-no-cache ignore-no-store store-stale

    # IIX DOWNLOAD
    refresh_pattern ^ http: \ / \ / \. www [0-9] [0-9] \. indowebster \. com \ /(.*)( mp3 | rar | zip | wmv | wmv | 3gp | sm (4 | 3) | exe | msi | zip) 43 200 99 999% 129,600 IMS reload-into-ignore-reload override-expire ignore-no-cache ignore-no-store ignore stale store-auth-

    # All Files
    # Refresh_pattern-i \. (3gp | 7z | ace | asx | bin | deb | divx | DVR-ms | ram | rpm | exe | inc | cab | qt) 43 200 999 999% 43200 ignore-no-cache ignore-no- store, must-revalidate ignore override-expire override-lastmod reload-into-IMS-stale store
    # Refresh_pattern-i \. (Zip | jar | gz | tgz | bz2 | iso | m1v | m2 (v | p) | mo (d | v) | arj | lha | LZH | zip | tar) 43 200 43 200 999 999% ignore ignore-no-cache ignore-no-store, must-revalidate override-expire override-lastmod reload-into-IMS-stale store
    # Refresh_pattern-i \. (Jp (e? G | e | 2) | gif | pn [PG] | bm? | Tiff? | Ico | swf | dat | ad | txt | dll) 43200 43 200 999 999% ignore-no -cache ignore-no-store ignore-must-revalidate override-expire override-lastmod reload-into-IMS-stale store
    # Refresh_pattern-i \. (Avi | ac4 | mp (e? G | a | e | 1 | 2 | 3 | 4) | mk (a | v) | id (i | u | p) | og (x | v | a | g) | rm | r (a | p) m | SND | vob) 43 200 999 999% 43200 ignore-no-cache ignore-no-store ignore-must-revalidate override-expire override-lastmod reload-into- IMS-stale store
    # Refresh_pattern-i \. (Pp (t! X) | s | t) | pdf | rtf | wax | wm (a | v) | wmx | WPL | cb (r | z | t) | xl (s? X ) | do (c? x) | flv | x-flv) 43 200 999 999% 43200 ignore-no-cache ignore-no-store ignore-must-revalidate override-expire override-lastmod reload-into-IMS-stale store

    # Refresh_pattern-i (/ cgi-bin / | \?) 0 0% 0
    # Refresh_pattern ^ gopher: 1440 0% 1440
    # Refresh_pattern ^ ftp:10080 95% 43200 override-lastmod reload-into-IMS-stale store
    # Refresh_pattern. 2000 95% 43200 override-lastmod reload-into-IMS-stale store

    emulate_httpd_log off
    hosts_file / etc / hosts

    # # # Static objects peyimpanannya time diperlama
    refresh_pattern-i \. (class | css | js | tif) (\ ?.*)?$ 100 000 080 95% 1440 reload-into-IMS-lastmod override
    refresh_pattern-i \. (DES | jpg | jpeg | png | bmp | gif) (\ ?.*)?$ 0 1000000080 95% reload-into-IMS-lastmod override
    refresh_pattern-i \. (tiff | mov | avi | qt | mpeg | 3gp) (\ ?.*)?$ 0 201 600 000 95% reload-into-IMS-lastmod override
    refresh_pattern-i \. (mpg | mpe | wav | au | mid | pdf) (\ ?.*)?$ 0 95% 2016000 IMS reload-into-override-lastmod
    refresh_pattern-i \. (zip | gz | arj | lha | LZH) (\ ?.*)?$ 0 95% 2016000 IMS reload-into-override-lastmod
    refresh_pattern-i \. (rar | tgz | tar | exe | bin) (\ ?.*)?$ 0 95% 2016000 IMS reload-into-override-lastmod
    refresh_pattern-i \. (cab | psf | part | 0 * | swf | gz | grf | GPF) (\ ?.*)?$ 0 95% 2000160 IMS reload-into-override-lastmod
    refresh_pattern-i \. (pdf | rtf | doc | swf | txt | inf) (# 2016000 ?.*)?$ a 95% reload-into-IMS-lastmod override
    refresh_pattern-i \. (inc | cab | ad | hqx | dll) (\ ?.*)?$ 4320000 10 080 95% reload-into-IMS-lastmod override
    refresh_pattern-i \. (asp | acgi | pl | shtml | php3 | php) (\ ?.*)?$ 2 20% 432 000 reload-into-IMS-lastmod override
    refresh_pattern-i \. (is) (\ ?.*)?$ 2 5% 10800 reload-into-IMS-lastmod override
    refresh_pattern ^ ftp:1440 20% 10,080
    refresh_pattern ^ gopher: 1440 0% 1440
    refresh_pattern. 0 40% 40320

    # SNMP
    snmp_port 3401
    ACL snmppublic public snmp_community
    snmp_access snmppublic allow localhost
    snmp_access deny all

    # TAG: Extra Configuration Tuning
    Accept-Encoding deny header_access all
    client_persistent_connections off
    server_persistent_connections on
    half_closed_clients off
    strip_query_terms off
    quick_abort_min 0 KB
    quick_abort_max 0 KB
    quick_abort_pct 100
    vary_ignore_expire on
    reload_into_ims on
    pipeline_prefetch on
    range_offset_limit 512 KB
    read_timeout 30 minutes
    client_lifetime 6 hours
    negative_ttl 30 seconds
    positive_dns_ttl 6 hours
    negative_dns_ttl 60 seconds
    pconn_timeout 15 seconds
    request_timeout 1 minute
    store_avg_object_size 13 KB
    log_icp_queries off
    ipcache_size 1024
    ipcache_low 98
    ipcache_high 99
    log_fqdn off
    fqdncache_size 1026
    memory_pools off
    forwarded_for on
    logfile_rotate 3
    store_dir_select_algorithm round-robin
    cache_effective_user proxy
    cache_effective_group proxy
    max_filedescriptors 8056

    # # End of config

 EDIT ** IP is marked # -------------------- A squid conf IN NETWORK LAN match with the skipper

after press crtl + x and then yes.
ok now your new squid.conf finished

3. storeurl.pl creat file (for video cache)
nano / etc / squid / storeurl.pl

then paste the config below storeurl.pl

    #! / Usr / bin / perl
    # $ Rev $
    # By chudy_fernandez@yahoo.com
    # Updates at http://wiki.squid-cache.org/ConfigExamples/DynamicContent/YouTube/Discussion
    $ | = 1;
    while (<>) {
    @ X = split;
    # $ X [1] = ~ s / & sig =.*//;
    $ X = $ x [0]. "";
    $ _ = $ X [1];
    $ U = $ X [1];

    # Compatibility for old cached get_video? Video_id
    if (m / ^ http: \ / \ / ([0-9.] {4} | .* \. youtube \. com | .* \. GoogleVideo \. com | .* \. video \. google \. com ).*?( videoplayback \? id =.*?| video_id =.*?) \ &(.*?)/) {
    $ Z = $ 2, $ z = ~ s / video_id = / get_video? Video_id = /;
    print $ x. "Http://video-srv.youtube.com.SQUIDINTERNAL/." $ Z. "\ N";

    # Youtube HD itag = 22
    } Elsif (m / ^ http: \ / \ / ([0-9.] {4} | .* \. Youtube \. Com | .* \. GoogleVideo \. Com | .* \. Video \. Google \ . com) .*? \ & (itag = 22) .*? \ & (id = [a-ZA-Z0-9 ]*)/) {
    print $ x. "Http://video-srv.youtube.com.SQUIDINTERNAL/." $ 2. "&". $ 3. "\ N";

    # Youtube Normal HD screens always itag 35, Normal HD screens never itag 34, itag = 18 <- normal?
    } Elsif (m / ^ http: \ / \ / ([0-9.] {4} | .* \. Youtube \. Com | .* \. GoogleVideo \. Com | .* \. Video \. Google \ . com) .*? \ & (itag = [0-9 ]*).*? \ & (id = [a-ZA-Z0-9 ]*)/) {
    print $ x. "Http://video-srv.youtube.com.SQUIDINTERNAL/." $ 3. "\ N";

    } Elsif (m / ^ http: \ / \ / www \. Google-analytics \. Com \ / __utm \. Gif \ ?.*/) {
    print $ x. "Http://www.google-analytics.com/__utm.gif \ n";

    # Cache High Latency Ads
    } Elsif (m / ^ http: \ / \ / ([a-z0-9 .]*)( \. DoubleClick #. Net | \. Quantserve \. Com | \. Googlesyndication \. Com | yieldmanager | cpxinteractive) ( .*)/) {
    $ Y = $ 3, $ z = $ 2;
    for ($ y) {
    s / pixel; .* / pixel /;
    s / activity; .* / activity /;
    s / (imgad [^&]*).*/ \ 1 /;
    s /; Ord = [? 0-9 ]*//;
    s /; & timestamp = [0-9 ]*//;
    s /[&?] correlator = [0-9 ]*//;
    s / & cookie =[^&]*//;
    s / & ga_hid =[^&]*//;
    s / & ga_vid =[^&]*//;
    s / & ga_sid =[^&]*//;
    # S / & prev_slotnames =[^&]*//
    # S / & u_his =[^&]*//;
    s / & dt =[^&]*//;
    s / & DTD =[^&]*//;
    s / & lmt =[^&]*//;
    s / (& alternate_ad_url = http% 3A% 2F% 2F [^ (% 2F )]*)[^&]*/ \ 1 /;
    s / (& url = http% 3A% 2F% 2F [^ (% 2F )]*)[^&]*/ \ 1 /;
    s / (& ref = http% 3A% 2F% 2F [^ (% 2F )]*)[^&]*/ \ 1 /;
    s / (& cookie = http% 3A% 2F% 2F [^ (% 2F )]*)[^&]*/ \ 1 /;
    s /[;&?] Ord = [? 0-9 ]*//;
    s /[;&] mpvid =[^&;]*//;
    s / & xpc =[^&]*//;
    # Yieldmanager
    s / \? clickTag =[^&]*//;
    s / & u =[^&]*//;
    s / & slotname =[^&]*//;
    s / & page_slots =[^&]*//;
    }
    print $ x. "Http://". $ 1. $ 2. $ Y. "\ N";

    # High latency cache ads
    } Elsif (m / ^ http: \ / \ /(.*?) \ / (ads) \ {?(.*?)/)
    print $ x. "Http://". $ 1. "/". $ 2. "\ N";

    # Spicific servers starts here ....
    } Elsif (m / ^ http: \ / \ / (www \. Ziddu \. Com .* \. [^ \ /] {3.4}) \ {/(.*?)/)
    print $ x. "Http://". $ 1. "\ N";

    # CDN, varialble 1st path
    } Elsif (($ u = ~ / filehippo /) & & (m / ^ http: \ / \ /(.*?) \ .(.*?) \ /(.*?) \ /(.*) \. ([a-z0-9] {3.4}) (\ ?.*)?/)) {
    @ Y = ($ 1, $ 2, $ 4, $ 5);
    $ Y [0] = ~ s / [a-z0-9] {2.5} / CDN. /;
    print $ x. "Http://". $ Y [0]. $ Y [1]. "/". $ Y [2]. "." . $ Y [3]. "\ N";

    # Rapidshare
    } Elsif (($ u = ~ / rapidshare /) & & (m / ^ http: \ / \ / (([A-Za-z] + [0-9 -.]+)*?)([ az] * \. [^ \ /] {3} \ / [az] * \ / [0-9] *) \ /(.*?) \ / ([^ \ / \? \ &] {4,}) $ /)) {
    print $ x. "Http://cdn." . $ 3. "/ SQUIDINTERNAL /". $ 5. "\ N";

    } Elsif (($ u = ~ / maxporn /) & & (m / ^ http: \ / \ / ([^ \ /]*?) \ /(.*?) \ / ([^ \ /]*?) (\ ?.*)?$/)) {
    print $ x. "Http://". $ 1. "/ SQUIDINTERNAL /". $ 3. "\ N";

    # Url variables like porn hub and center part of the path, filename etention 3 or 4 with or without? at the end
    } Elsif (($ u = ~ / tube8 | Pornhub | xvideos /) & & (m / ^ http: \ / \ / (([A-Za-z] + [0-9 -.]+)*?) \ . ([az] * [0-9]? \. [^ \ /] {3} \ / [az ]*)(.*?)(( \ / [az ]*)?( \ / [^ \ /]*){ 4} \. [^ \ / \?] {3.4}) (\ ?.*)?$/)) {
    print $ x. "Http://cdn." . $ 3. $ 5. "\ N";
    # ... Spicific end servers here.

    # Photos-X.ak.fbcdn.net where X a-z
    } Elsif (m / ^ http: \ / \ / photos-[az]. Ak.fbcdn.net \ /(.*)/) {
    print $ x. "Http://photos.ak.fbcdn.net/." $ 1. "\ N";

    # General purpose servers for CDN. Above add your specific servers.
    } Elsif (m / ^ http: \ / \ / ([0-9 .]*?) \ / \ /(.*?) \ .(.*) \ ?(.*?)/) {
    print $ x. "Http://squid-cdn-url//." $ 2. "." . $ 3. "\ N";

    # For yimg.com doubled
    } Elsif (m / ^ http: \ / \ /(.*?) \. Yimg \. Com \ /(.*?) \. Yimg \. Com \ /(.*?) \ ?(.*)/ ) {
    print $ x. "Http://cdn.yimg.com/." $ 3. "\ N";

    # For yimg.com with & sig =
    } Elsif (m / ^ http: \ / \ /(.*?) \. Yimg \. Com \ /(.*)/) {
    @ Y = ($ 1, $ 2);
    $ Y [0] = ~ s / [a-z] + [0-9] + / CDN /;
    $ Y [1] = ~ s / & sig =.*//;
    print $ x. "Http://". $ Y [0]. ". Yimg.com /". $ Y [1]. "\ N";

    # Generic http://variable.domain.com/path/filename. "Ext" or "exte" with or withour "?"
    } Elsif (m / ^ http: \ / \ /(.*)([^ \. \ -] *? \ ..*?) \ /(.*) \. ([^ \ / \? \ &] {3.4}) (\ ?.*)?$/) {
    @ Y = ($ 1, $ 2, $ 3, $ 4);
    $ Y [0] = ~ s / (([a-ZA-A-] + [0-9 -]+)|(.* .*)|(.* cache .*))/ CDN CDN /;
    print $ x. "Http://". $ Y [0]. $ Y [1]. "/". $ Y [2]. "." . $ Y [3]. "\ N";

    # Generic http://variable.domain.com/ ...
    } Elsif (m / ^ http: \ / \ / (([A-Za-z] + [0-9 -]+)*?|.* .*|.* CDN cache .*) \. (.* ?) \ .(.*?) \ /(.*)$/) {
    print $ x. "Http://cdn." . $ 3. "." . $ 4. "/". $ 5. "\ N";
 
    # Spicific Extention That ends with?
    } Elsif (m / ^ http: \ / \ /(.*?) \ /(.*?) \. (Jp (e? G | e | 2) | gif | png | tiff? | Bmp | ico | flv | On2) \ {?(.*)/)
    print $ x. "Http://". $ 1. "/". $ 2. "." . $ 3. "\ N";

    # That all ends with;
    } Elsif (m / ^ http: \ / \ /(.*?) \ /(.*?) \ ;(.*)/) {
    print $ x. "Http://". $ 1. "/". $ 2. "\ N";

    Else {}
    print $ x. $ _. "\ N";
    }
    }

after press crtl + x and then yes.

ok now you have finished storeurl.pl
Hmmm Squid.conf And already there are now living Storeurl.pl Squid.conf activate, and creat storeurl.pl rektory the cache in order

    chown proxy: proxy / cache
    chmod 777 / cache

Now squid ok right way
/ Etc / init.d / squid restart

Mikrotik his side:

For example ip proxy with gatway from mikrotik to proxy ip ip 192.168.1.1 and 192.168.1.10

SET nat MASQUERADE to gatway proxy:
 chain = srcnat MASQUERADE action = src-address = 192.168.1.0/24

Transparent proxy:
chain = dstnat action = dst-nat to-addresses = 192.168.1.10 to-ports = 3128 protocol = tcp src-address =! 192.168.1.10 dst-port = 80

  Rebooting the CPU Ubuntu, END.


New! Click the words above to view alternate translations. Dismiss