Posts Tagged ‘ubuntu

09
Oct
08

Menyiapkan Proxy Server dengan Menggunakan 1 NIC

Situasi yang ada di tempat gw kurang lebih begini :
 * Koneksi internet Speedy
 * Satu Modem ADSL
 * Satu Switch atau Hub
 * PC yang difungsikan sebagai server
 * Tentunya PC Client

Konfigurasinya kurang lebih gini :

Lakukan instalasi squid di server yang akan dijadikan sebagai proxy server dan persiapkan konfigurasinya (squid.conf).

$ sudo apt-get install squid
$ sudo mv /etc/squid/squid.conf /etc/squid/squid.conf.orig
$ sudo vi /etc/squid/squid.conf

Isi konfigurasi dengan konten berikut atau sesuaikan dengan kebutuhan, silahkan refer dokumentasi yang ada di squid.conf.orig :

# OPTIONS FOR AUTHENTICATION
# Recommended minimum configuration for basic scheme
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

# ACCESS CONTROLS
##Memblock Domain/Kata terlarang
acl blockdomain dstdomain “/etc/squid/blockdomain.txt”
acl blockword url_regex -i “/etc/squid/blockword.txt”

acl unduh url_regex -i ftp \.exe$ \.mp3$ \.mp4$ \.tar.gz$ \.gz$ \.tar.bz2$ \.rpm$ \.zip$ \.rar$
acl unduh url_regex -i \.avi$ \.mpg$ \.mpeg$ \.rm$ \.iso$ \.wav$ \.mov$ \.dat$ \.mpe$ \.mid$
acl unduh url_regex -i \.midi$ \.rmi$ \.wma$ \.wmv$ \.ogg$ \.ogm$ \.m1v$ \.mp2$ \.mpa$ \.wax$
acl unduh url_regex -i \.m3u$ \.asx$ \.wpl$ \.wmx$ \.dvr-ms$ \.snd$ \.au$ \.aif$ \.asf$ \.m2v$
acl unduh url_regex -i \.m2p$ \.ts$ \.tp$ \.trp$ \.div$ \.divx$ \.mod$ \.vob$ \.aob$ \.dts$
acl unduh url_regex -i \.ac3$ \.cda$ \.vro$ \.deb$

## Recommended minimum configuration
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 perusahaan src 192.168.1.0/24
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
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 Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT

http_access deny blockdomain
http_access deny blockword
http_access deny manager

http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports

http_access allow manager localhost
http_access allow perusahaan

http_access deny all

http_reply_access allow all
icp_access allow all
miss_access allow all

# NETWORK OPTIONS
http_port 3128 transparent

# OPTIONS WHICH AFFECT THE NEIGHBOR SELECTION ALGORITHM
hierarchy_stoplist cgi-bin ?

# MEMORY CACHE OPTIONS
cache_mem 64 MB
maximum_object_size_in_memory 4096 KB
memory_replacement_policy lru

# DISK CACHE OPTIONS
cache_replacement_policy lru
cache_dir ufs /var/spool/squid 15000 16 256
minimum_object_size 0 KB
maximum_object_size 20480 KB
cache_swap_low 90
cache_swap_high 95

# LOGFILE OPTIONS
access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
logfile_rotate 10
log_ip_on_direct on
debug_options ALL,1
client_netmask 255.255.255.255
buffered_logs off

# OPTIONS FOR FTP GATEWAYING
ftp_user Squid@
ftp_list_width 32
ftp_passive on
ftp_sanitycheck on
ftp_telnet_protocol on

# OPTIONS FOR TUNING THE CACHE
## We recommend you to use the following two lines.
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY

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
negative_ttl 5 minutes

# HTTP OPTIONS
ie_refresh on
header_access Via deny all

# TIMEOUTS
connect_timeout 1 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

# ADMINISTRATIVE PARAMETERS
cache_mgr myserver
visible_hostname myserver

# DELAY POOL PARAMETERS
delay_pools 1
delay_class 1 1
delay_access 1 allow unduh
delay_access 1 deny all
delay_parameters 1 1000/16000

# SNMP OPTIONS
snmp_port 3401
snmp_access allow localhost
snmp_access deny all

# ICP OPTIONS
icp_port 3130
udp_incoming_address 0.0.0.0
udp_outgoing_address 255.255.255.255

# DNS OPTIONS
ipcache_size 1024
ipcache_low 90
ipcache_high 95
fqdncache_size 1024

# MISCELANEOUS
coredump_dir /var/spool/squid

Bikin direktori cache yang telah kita buat, dan bikin juga file-file terkait yang akan berisi daftar domain dan daftar kata yang akan di blok oleh server.

$ sudo squid -z

$ sudo vi /etc/squid/blockdomain.txt
http://www.rapidshare.com
http://www.playboy.com
http://www.situsporno.com
http://www.situslainnya.com

$ sudo vi /etc/squid/blockword.txt
adult
sex
lesbian
homo
porn
porno
katakatalainnya

Aktifkan penerusan paket (packet forwarding) dengan menghapus tanda # pada bagian enable packet forwarding for IPv4, simpan dan selanjutnya tambahkan routing IP Tables. Arahkan gateway ke IP Modem. Restart networking dan restart squid-nya.

$ sudo vi /etc/sysctl.conf
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1

$ sudo iptables -A PREROUTING -t nat -p tcp –dport 80 -j REDIRECT –to-port 3128

$ sudo vi /etc/network/interfaces
Ubah gateway menjadi alamat IP Modem (192.168.1.1)

$ sudo /etc/init.d/networking restart
$ sudo /etc/init.d/squid restart

Langkah-langkah diatas dilakukan di PC yang akan dijadikan sebagai proxy server.  Selanjutnya, atur gateway pada setiap PC Client agar mengarah ke IP proxy server (192.168.1.2).
Jika PC Client anda ubuntu linux, ada 2 cara untuk mengganti IP Gateway.
Cara pertama dengan GUI.

 * Klik icon bergambar monitor di panel atas sebelah kanan.
 * Klik Manual Configuration
 * Klik unlock, lalu masukkan password
 * Klik Wired / Wireless connection, Lalu klik properties
 * Ubah gateway address menjadi alamat IP proxy server (192.168.1.2)
 * Klik OK – CLOSE

Cara kedua dengan terminal.

$ sudo vi /etc/network/interfaces
Ubah gateway menjadi alamat IP proxy server (192.168.1.2)
$ sudo /etc/init.d/networking restart
$ ping http://www.google.com
PING http://www.l.google.com (64.233.189.104) 56(84) bytes of data.
64 bytes from hk-in-f104.google.com (64.233.189.104): … dst

Yups… jika ping berhasil, maka proxy server telah berfungsi dengan baik…
😀

Namun ada satu kelemahan, jika Gateway PC Client di set ke alamat IP Modem (192.168.1.1) maka si PC Client pun masih bisa browsing tanpa melalui proxy, untuk itu rubahlah IP Modem dari defaultnya (192.168.1.1) menjadi terserah sang admin. Lalu sesuaikan gateway proxy ke IP Modem. Beres dah… 😀 tapi kalo IP Modem ketauan lagi, ya gituuu deh… muter terussss hehehe 😀
Seharusnya si Modem bisa disetting agar hanya bisa diakses oleh IP Server, tapi gw belum tau caranya, bisa beda-beda tergantung jenis modemnya… So silahkan dioprek tuh modem…
Selamat ngoprek modem…
😀

ref:
http://myamin.net/index.php/linux/proxy-server-on-ubuntu-hardy-heron-2.html

31
Jul
08

Mempercepat koneksi ke FTP Server

Well, setelah melakukan pengaturan FTP server agar bisa digunakan oleh para programmer untuk mengupload web application yang udah dibikin, ternyata timbul kendala baru… Koneksinya lambat banget…
Ternyata solusinya mudah… cukup matikan fitur UseReverseDNS dan IdentLookups di konfigurasi proftpd. Lengkapnya begini :

sudo vi /etc/proftpd/proftpd.conf
UseReverseDNS off
IdentLookups off

Coba tes koneksi dari PC Client…
Wuzzz… Wuzzz… Mantabs coy…
😀

ref:
http://www.techmongrel.com/31/fixing-a-slow-handshake-connection-to-proftpd-on-ubuntu-710/
http://trinityhome.org/Home/index.php?wpid=100&front_id=18




Smiling Calendar

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Smiling Archives

Smiling Stats

  • 6,428 hits

Smiling Categories

Smiling Tags