Kali ini kita akan belajar tentang jaringan internet yang menggunakan sistem operasi freebsd untuk mengoperasionalkan
biasanya setelah instalasi dan penggunaan proxy dengan freebsd sebagai operating systemnya tentu anda harus tau juga bagaimana settingnya di sini saya akan berbagi bagaimana configurasi squid menggunakan freebsd di sini kami menggunakan freebsd 9
pertama ekstrak terlebih dulu... dan ikuti perintah di bawah ini step by step
# tar zxvf squid-2.7.STABLE9.tar.gz
# cd squid-2.7.STABLE9
# ./configure \'--sysconfdir=/etc/squid\' \'--enable-storeio=diskd,ufs,aufs\' \'--enable-delay-pools\' \\
\'--enable-pf-transparent\' \'--enable-ipf-transparent\' \'--disable-ident-lookups\' \\
\'--enable-removal-policies\'
# make
# make install
Keterangan
- Enable-delay-pools - Enable delay pools untuk membatasi penggunaan bandwidth.
Anda harus mengaktifkan pilihan untuk menggunakan Squid untuk membatasi penggunaan bandwidth. Ini akan memberikan penggunaan bandwidth yang adil untuk semua orang. Dalam kasus saya, saya tidak mau satu orang mengisap semua bandwidth yang tersedia dengan men-download film besar, menyebabkan orang lain lemot.
- Enable-IPF-transparent
Transparent Proxy Mengaktifkan dukungan untuk sistem yang menggunakan IP Filter network address redirection. Dengan pilihan ini, Anda tidak harus mengkonfigurasi pengaturan proxy browser klien. Juga merupakan cara yang baik untuk memaksa klien untuk menggunakan setiap proxy.
- Enable-storeio = diskd, ufs - Enable diskd
Disk Meningkatkan performa I / O. Menurut FAQ squid, jika Anda mengaktifkan diskd Anda dapat memperoleh peningkatan 400% dari kinerja.
Namun, Anda perlu mengkompilasi ulang kernel karena sistem operasi Anda harus mendukung antrian pesan dan memori bersama.
-enable-removal-policie
Membangun dukungan untuk daftar list decesion delete Secara default, Squid menggunakan LRU, tapi ada dua kebijakan yang lebih baik: GDSF dan LFUDA. Lihat Squid config untuk penjelasan lebih rinci.
- Disable-ident-lookups -
ini memungkinkan Anda untuk menghapus kode yang melakukan ident (RFC 931) lookup. Tidak benar-benar penting. By the way, jika Anda transparent proxy, ident lookups tidak akan bekerja.
- Enable-snmp
Opsional: fitur ini dan Anda dapat memonitor squid dengan MRTG atau RRDTool. Cara melakukan ini adalah di luar lingkup artikel ini. Mungkin dalam satu berikutnya.
squid.conf
#Transparent Proxy
http_port 127.0.0.1:8080 transparent
http_port 192.168.100.2:8080
dead_peer_timeout 30 seconds
peer_connect_timeout 30 seconds
icp_query_timeout 5000
#Regex for download-file
acl download-file urlpath_regex -i \"/etc/squid/download-file\"
acl download-spesial urlpath_regex -i \"/etc/squid/download-spesial\"
acl QUERY urlpath_regex cgi-bin \\? \\.php$ \\.asp$ \\.shtml$ \\.cfm$ \\.cfml$ \\.phtml$ \\.php3$
acl nocache-domain dstdomain .mail.yahoo.com .login.yahoo.com .gmail.com .rapidshare.de .rapidshare.com
no_cache deny QUERY
no_cache deny nocache-domain
acl myself dst 127.0.0.1 192.168.100.2
always_direct allow myself
always_direct allow nocache-domain
always_direct allow QUERY
cache_mem 96 MB
#How many squid will use space of harrdisk.
#You can use my formula, use 80% from free space of harddisk use for cache
#64 Number of directory
#128 Number of sub-directory for each directory
cache_dir aufs /cache 20000 64 128
maximum_object_size 4096 KB
minimum_object_size 4 KB
maximum_object_size_in_memory 16 KB
ipcache_size 4096
fqdncache_size 4096
logformat custom %{%Y-%m-%d %H:%M:%S}tl %03tu %>a %tr %ul %ui %Hs %mt %rm %ru %rv %st %Sh %Ss
#cache_access_log /var/squid/logs/access.log custom
cache_access_log none
cache_log /var/squid/logs/cache.log custom
cache_store_log none
pid_filename /var/squid/logs/squid.pid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i \\.gif$ 10080 100% 43200
refresh_pattern -i \\.jpg$ 10080 100% 43200
refresh_pattern -i \\.jpeg$ 10080 100% 43200
refresh_pattern -i \\.bmp$ 10080 100% 43200
refresh_pattern -i \\.mid$ 10080 100% 43200
refresh_pattern -i \\.wav$ 10080 100% 43200
refresh_pattern -i \\.ico$ 10080 100% 43200
refresh_pattern -i \\.yim$ 10080 100% 43200
refresh_pattern -i \\.jar$ 10080 100% 43200
refresh_pattern -i \\.ldict$ 10080 100% 43200
refresh_pattern -i \\.swf$ 10080 100% 43200
refresh_pattern -i \\.class$ 10080 100% 43200
refresh_pattern -i \\.cab$ 10080 100% 43200
refresh_pattern . 10 100% 10080
negative_ttl 5 minutes
positive_dns_ttl 6 hours
negative_dns_ttl 1 minute
connect_timeout 60 seconds
request_timeout 3 minutes
persistent_request_timeout 1 minute
read_timeout 15 minutes
client_lifetime 1 day
half_closed_clients off
pconn_timeout 2 minutes
shutdown_lifetime 1 seconds
#Access List
#I have two subnets, one for \'user\' and another one for \'spesial\'
acl all src 0.0.0.0/0.0.0.0
acl localhost src 127.0.0.1/255.255.255.255
acl user src 192.168.200.0/255.255.255.0
acl spesial src 192.168.200.102 192.168.200.103
http_access allow user
http_access deny all
http_reply_access allow user
http_reply_access deny all
icp_access allow user
icp_access deny all
miss_access allow user
miss_access deny all
cache_mgr nofee26@mustnofee.com
cache_effective_user squid
cache_effective_group squid
visible_hostname Proxy
coredump_dir /cache
forwarded_for off
log_icp_queries off
delay_pools 2
#Bandwidth for \'spesial\'
#When file more than 512KB, then \'spesial\' will get 20KB = 160kbps
delay_class 1 2
delay_parameters 1 -1/-1 20000/512000
delay_access 1 allow spesial download-spesial
delay_access 1 deny all
#Bandwidth for \'user\'
#When file more than 256KB, then \'user\' will get 8KB = 64kbps
delay_class 2 2
delay_parameters 2 -1/-1 8000/256000
delay_access 2 allow user download-file
delay_access 2 deny all
via off
server_persistent_connections off
client_persistent_connections off
lalu jangan lupa buat konfig cache direktory,swap,dan log file
# mkdir -p /var/squid/logs
# chmod 777 /var/squid/logs/
# chmod 777 /cache
# chmod 777 /etc/squid/
# chmod 777 /dev/pf/
# /usr/local/squid/sbin/squid -z
jangan lupa edit file pf.conf sebagai transparent proxy
#add this line after nat :
rdr on $user_if proto tcp from 192.168.200.0/24 to any port 80 -> 127.0.0.1 port 8080
copy paste script di bawah ini dengan ekstensi .sh
simpan di /usr/sbin/squid
jadinya...
nano /usr/sbin/squid
#!/bin/sh
# By No Fee (c) 2007
case \"$1\" in
start)
echo \"Starting Squid...\"
/usr/local/squid/sbin/squid -D
;;
stop)
echo \"Stoping Squid...\"
/usr/local/squid/sbin/squid -k shutdown
;;
restart)
echo \"Restarting Squid...\"
/usr/local/squid/sbin/squid -k reconfigure
;;
rotate)
echo \"Rotating Squid Log...\"
/usr/local/squid/sbin/squid -k rotate
;;
ver)
echo \"You\'re using : \"
/usr/local/squid/sbin/squid -v
;;
*)
echo \"Usage: `basename $0` {start|stop|restart|rotate|ver}\" >&2
exit 64
;;
esac
rubah file permission, chmod 755 /usr/sbin/squid/fileanda.sh
kemudian execute saja dan ikuti langkah selanjutnya