≡ Menu

Install the Transparent Proxy in Ubuntu

first you must login as root. After that you must connect to the Internet. because we install the package from the Internet package. After that update repository

apt-get update

let the update process runs until completion.

then lived in his squid install 

apt-get install squid

let the install process runs to completion ….

after finishing install it in the configuration file edit 

nano /etc/squid/squid.conf

paste and edit according to the needs of each 

# So that the transparent proxy
http_port 3128 transparent
icp_port 3130
udp_incoming_address 0.0.0.0
udp_outgoing_address 255.255.255.255
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin ?
no_cache deny QUERY
cache_mem 64 MB
#kalo memory kamu gede boleh pake 128 ato lebih
cache_swap_low 90
cache_swap_high 95
connect_timeout 1 minutes
negative_ttl 5 minutes
read_timeout 15 minutes
request_timeout 5 minutes
persistent_request_timeout 1 minutes
client_lifetime 5 day
pconn_timeout 120 seconds
shutdown_lifetime 30 seconds
maximum_object_size 20480 KB
minimum_object_size 0 KB
maximum_object_size_in_memory 4096 KB
ipcache_size 1024
ipcache_low 90
ipcache_high 95
fqdncache_size 1024
cache_replacement_policy lru
memory_replacement_policy lru
cache_dir ufs /var/spool/squid 15000 16 256
#direktori buat chace nya
cache_access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
log_ip_on_direct on
debug_options ALL,1
client_netmask 255.255.255.255
ftp_user [email protected]
ftp_list_width 32
ftp_passive on
ftp_sanitycheck on
ftp_telnet_protocol on
redirect_children 10
auth_param basic children 10
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
quick_abort_min 16 KB
quick_abort_max 16 KB
quick_abort_pct 95
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
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563 6667 7000
acl Safe_ports port 80
acl Safe_ports port 81
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 1025-65535
acl Safe_ports port 280
acl Safe_ports port 488
acl Safe_ports port 591
acl Safe_ports port 777 110
acl Safe_ports port 4461
acl Safe_ports port 5050
acl CONNECT method CONNECT
http_access allow manager localhost
acl jaringan src 192.168.10.0/24
# This can be changed according to local ip which is used
http_access allow jaringan
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny all
http_reply_access allow all
icp_access allow all
miss_access allow all
cache_mgr [email protected] #Type your name here.
visible_hostname domainkamu.com
# whatever you want to be given anything because they do not influence
logfile_rotate 10
buffered_logs off
snmp_port 3401
snmp_access allow localhost
snmp_access deny all
snmp_access deny all
coredump_dir /var/spool/squid
ie_refresh on
##Delay pools
acl download url_regex -i ftp .exe$ .mp3$ .mp4$ .tar.gz$ .gz$ .tar.bz2$ .rpm$ .zip$ .rar$
acl download url_regex -i .avi$ .mpg$ .mpeg$ .rm$ .iso$ .wav$ .mov$ .dat$ .mpe$ .mid$
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$ .div$ .divx$ .mod$ .vob$ .aob$ .dts$
acl download url_regex -i .ac3$ .cda$ .vro$ .deb$
delay_pools 1
delay_class 1 1
delay_parameters 1 6000/32000
delay_access 1 allow download
delay_access 1 deny all

save by pressing ctrl + x and y and then enter [ordinary …]

start service squidnya 

/etc/init.d/squid start

but wait, not yet finished nih. because earlier in the set transparent. hence all packages via http which should be directed to the first proxy port

/sbin/iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-ports 3128
/sbin/iptables -t nat -A PREROUTING -i eth1 -p udp --dport 80 -j REDIRECT --to-ports 3128

but, so squid and transparent proxy always run every machine ubuntu server you in turn. had been added before the script rc.local

add on the bottom row, before exit = 0

/sbin/iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-ports 3128
/sbin/iptables -t nat -A PREROUTING -i eth1 -p udp --dport 80 -j REDIRECT --to-ports 3128

Save use ordinary command ….

ctrl + x, y. enter

finished the transparent proxy

Start browsing now will feel tighter.

source: http://www.kaskus.us/showpost.php?p=137288629&postcount=5

Other squid configuration from http://www.kaskus.us/showthread.php?t=7068510

########################################
############ CREATE BY cadel2710 ############
########################################

http_port 3128 transparent
visible_hostname CADEL_PROXY
cache_mgr [email protected]

acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl server src 192.168.1.0/24
acl warnet src 192.168.10.0/24
acl client src 192.168.10.101-192.168.10.254
acl client src 192.168.10.4-192.168.10.99
acl operator src 192.168.10.100
acl server src 192.168.10.1
acl fadhel src 192.168.10.2
acl adhyeSU src 192.168.10.3
acl jam_dilarang_porno time SMTWHFA 07:00-23:30

acl all src 0.0.0.0/0

acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT

#------LIMIT DOWNLOAD------#

acl streaming dstdomain "/etc/stream.txt"

acl download url_regex -i ftp .exe .mp3 .vqf .tar.gz .gz .tar .rpm .zip .rar .avi .mpeg .mpe .mpg .qt .ram .rm .iso .raw .wav .mov .msi .mp4 .flv .3gp .pdf

delay_pools 2


delay_class 1 2
delay_parameters 1 -1/-1 -1/-1
delay_access 1 allow fadhel
delay_access 1 allow server
#delay_access 1 allow adhyeSU
#delay_access 1 allow operator
delay_access 1 deny all

delay_class 2 2
delay_parameters 2 -1/1024000 15000/1025000
delay_access 2 allow download client
delay_access 2 allow download operator
delay_access 2 allow streaming client
delay_access 2 allow streaming operator

acl porno url_regex "/etc/porno.txt"
http_access deny client jam_dilarang_porno porno
http_access deny operator jam_dilarang_porno porno

http_access allow localhost
http_access deny manager
http_access allow manager localhost
http_access allow server
http_access allow warnet
http_access deny !Safe_ports
http_access allow CONNECT !SSL_ports
http_access allow SSL_ports

cache_mem 64 MB
maximum_object_size 8192 KB
minimum_object_size 0 KB

store_dir_select_algorithm round_robin

cache_dir aufs /var/cache/squid 5000 11 256

access_log /var/log/squid/access.log squid
cache_store_log /var/log/squid/store.log
cache_log /var/log/squid/cache.log
#pid_filename /var/run/squid.pid

memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA
maximum_object_size_in_memory 64 KB
offline_mode off

#memory_pools off
logfile_rotate 100

#quick_abort_min 0 KB
#quick_abort_max 0 KB
#quick_abort_pct 98

#reload_into_ims on
#pipeline_prefetch on
#vary_ignore_expire on
#store_avg_object_size 10 KB
#hierarchy_stoplist cgi-bin ?

cache_swap_low 95
cache_swap_high 99

ipcache_size 8192
ipcache_low 95
ipcache_high 99

#fqdncache_size 4096

acl xyz dstdom_regex nude porn xyz bypass proxy anonymous
http_access deny client xyz

shutdown_lifetime 30 seconds

refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|?) 0 20% 0
refresh_pattern . 0 20% 4320


refresh_pattern /.gif 4320 50% 43200
refresh_pattern /.png 4320 50% 43200
refresh_pattern /.jpg 4320 50% 43200
refresh_pattern /.jpeg 4320 50% 43200
refresh_pattern /.bmp 4320 50% 43200
refresh_pattern /.tif 4320 50% 43200

refresh_pattern ^http://*.google.*/.* 720 100% 10080
refresh_pattern ^http://*.facebook.*/.* 720 100% 10080
refresh_pattern ^http://*.yahoo.*/.* 720 100% 10080
refresh_pattern ^http://*.zynga.*/.* 720 100% 10080
refresh_pattern ^http://*.youtube.*/.* 720 100% 10080
refresh_pattern ^http://*.kaskus.*/.* 720 100% 10080
refresh_pattern ^http://*.indowebster.*/.* 720 100% 10080
refresh_pattern ^http://*.gstatic.*/.* 720 100% 10080
refresh_pattern ^http://*.vivanews.*/.* 720 100% 10080
refresh_pattern ^http://*.fbcdn.net/.* 720 100% 10080
refresh_pattern ^http://*.detik.*/.* 720 100% 10080
refresh_pattern ^http://*.kendariweb.*/.* 720 100% 10080
refresh_pattern ^http://*.blogspot.com/.* 720 100% 10080
refresh_pattern ^http://*.wordpress.com/.* 720 100% 10080
refresh_pattern ^http://*.twitter.com/.* 720 100% 10080 reload-into-ims override-lastmod
refresh_pattern ^http://*.nai.com/.* 720 100% 10080
refresh_pattern ^http://profile.ak.fbcdn.net/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://*.google-analytics.*/.* 720 90% 4320 reload-into-ims override-lastmod
refresh_pattern ^http://*.google.co.id/.* 720 100% 10080
refresh_pattern ^http://*.facebook.com/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://.detik/*.com/.* 720 90% 28800
refresh_pattern ^http://creative.ak.fbcdn.net/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://statics.poker.static.zynga.com/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://statics.ak.fbcdn.net/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://safebrowsing-cache.google.com/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://update.nai.com/.* 720 90% 28800
refresh_pattern ^http://apps.facebook.com/.* 720 90% 28800
refresh_pattern ^http://au.download.windowsupdate.com/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://www.google.co.id/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://static.kaskus.us/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://upgrade.bitdefender.com/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://photos-e.ak.fbcdn.net/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://external.ak.fbcdn.net/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://vthumb.ak.fbcdn.net/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://downloadmirror.intel.com/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://*.mediafire.com/.* 720 90% 28800
refresh_pattern ^http://file.pb.gemscool.com/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://graph.facebook.com/.* 720 80% 28800 reload-into-ims override-lastmod
refresh_pattern ^http://*.ak.fbcdn.net/.* 720 80% 28800 reload-into-ims override-lastmod
{ 0 comments… add one }

Leave a Comment

*