Friday, August 18, 2006

Konfigurasi Proxy Server Linux

Beberapa waktu belakangan ini saya dibuat pusing dengan konfigurasi Proxy Server. Dari hasil kebingungan tersebut ada beberapa hal yang mesti dicatat sebelum melakukan instalasi dan konfigurasi Proxy server. Untuk yang sempat baca blog ini dan terdapat ada kekurangan atau bahkan kekeliruan mohon dikoreksi.. :) Masih newbie juga sih.

Langkah instalasi :

1. siapkan komputer dengan minimal 2 ethernet card. eth0 untuk koneksi ke jaringan public misalnya lewat ADSL, ASTINET dsb, eth1 untuk koneksi jaringan lokal anda. (192.168.1.0/24)
2. OS Linux ... tentu saja mutlak dibutuhkan, versi berapapun tidak masalah (ini kelebihan linux)

3. Install Linux tersebut dengan minimal paket yang dibutuhkan adalah Squid, Postfix dan beberapa paket server linux.
4. Setelah Terinstall dengan baik coba lihat konfigurasi squid anda, ini adalah contoh konfigurasi squid saya, Anda boleh copy paste disini :


# Edi Widodo PT. GOLDEN MANYARAN
# KONFIGURASI DIBAWAH INI SUDAH ADA DI SQUID TINGGAL CONTO
http_port 192.168.1.254:8080 transparent

hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 16 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 2000 KB
minimum_object_size 0 KB
maximum_object_size_in_memory 10 KB
cache_replacement_policy heap LFUDA
memory_replacement_policy heap GDS
Fauth_param basic children 5
auth_param basic realm
Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
cache_dir ufs /var/spool/squid 100 16 256

access_log /var/log/squid/access.log squid

# BUAT DAFTAR KONEKSI ANDA DISINI
acl all src 0.0.0.0/0.0.0.0
acl kabehbeh src 191.168.1.0/24
acl udanggoreng src 192.168.1.1-192.168.1.5
acl petiskangkung src 192.168.1.16-192.168.1.41
acl gembusrebus src 192.168.1.42-192.168.1.43
acl babyboy src 192.168.1.10
acl qutebebeh src 192.168.1.111
acl berli src 192.168.1.0/24
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


# BUAT WAKTU KONEKSI YANG INGIN ANDA ATUR DISINI
# INGAT WAKTU INI HARUS SESUAI DENGAN HARDWARE CLOCK (BIOS CLOCK)
acl isukisuk time MTWHF 07:45-18:30
acl awanawan time MTWHF 12:00-13:00
acl soresore time MTWHF 15:15-17:00
acl sedino time MTWHF 07:00-19:00

#MTWHF artinya MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY kalo sabtu tambah S SATURDAY

acl SSL_ports port 443 563
acl Safe_ports port 80 8080 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 10000 # https, snews
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

# TULIS KEBIJAKAN ANDA DISINI BISA FULL / JAM TERTENTU
http_access deny manager
http_access allow udanggoreng
http_access allow petiskangkung sedino
http_access allow gembusrebus soresore
http_access allow babyboy sedino
http_access allow qutebebeh
http_access allow manager localhost
visible_hostname proxy.co.id # SESUAIKAN DENGAN HOSTNAME ANDA
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost
http_access deny all
http_reply_access allow all
icp_access allow all


4. Konfigurasi Squid sudah diaktifkan, jangan lupa restart squid

# /etc/rc.c/init.d/squid restart (Saya Pake Mandrake, yang lain sesuaikan sendiri)

5. edit file /proc/sys/net/ipv4/ip_forward gunakan editor sesuai selera. ganti nilai 0 menjadi 1
atau bisa juga anda ketik lewat shell # echo 1 > /proc/sys/net/ipv4/ip_forward

6. Forward paket-paket yang menuju ke eth0 yang konek dengan public, jangan sampai salah penentuan eth nya, harus eth yang konek ke jaringan public yang melakkukan POSTROUTING
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

7. Jangan lupa konfigurasi ethernet addressnya yang eth1 dengan alamat lokal, yang eth0 dengan alamat public (kalo punya) kalo adsl gunakan alamat yang sesuai dengan modem adslnya. Buat konfigurasi ipaddress dengan editor biasa

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.254 # Sesuaikan dengan alamat jaringan anda
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
ONBOOT=yes

buat juga untuk eth1 nya

# vi /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.0.2
NETMASK=255.255.255.0
NETWORK=192.168.0.0
BROADCAST=192.168.0.255
ONBOOT=yes
# Sesuaikan dengan alamat public anda atau dengan alamat ADSL anda


8. Ediit file /etc/resolve.conf

nameserver 202.134.0.155 # sesuaikan dengan dns provider anda , Ini telkom

10. sampai disini harusnya proxy anda sudah bisa koneksi ke internet. dan juga sudah bisa berfungsi sebagai proxy server.


11. Duduk dulu ,.. nikmati dulu internet koneksinya

12. Untuk membaca log squid gunakan,

# tail -f /var/log/squid/access.log

Semoga Membantu...

11 comments:

  1. Anonymous5:16 PM

    Bisa tolong bantuin bikin konfigurasi proxy untuk membatasi download ga,,??

    ReplyDelete
  2. kan udah ada tuh bahasannya di http://ediwe.blogspot.com/2008/05/download-management.html

    ReplyDelete
  3. Anonymous8:47 PM

    nice post....
    ijin copas bos....lagi blajar bikin server nih...

    ReplyDelete
  4. Anonymous1:08 AM

    There is definately a lot to learn about this issue. I like all the points you've made.
    My web page free iphones

    ReplyDelete
  5. Anonymous6:15 AM

    This article is truly a nice one it helps new net people, who are wishing in favor of blogging.
    my web site: my computer is slow

    ReplyDelete
  6. Anonymous4:04 AM

    It's awesome in support of me to have a site, which is good in favor of my knowledge. thanks admin
    Also see my website > property alanya

    ReplyDelete
  7. Anonymous12:53 AM

    Pretty nice post. I just stumbled upon your weblog and wanted
    to say that I have truly enjoyed surfing around your blog posts.
    After all I'll be subscribing to your feed and I hope you write again soon!
    Also visit my web-site - diablo 3 guide

    ReplyDelete
  8. Anonymous4:34 AM

    Thanks for one's marvelous posting! I genuinely enjoyed reading it, you may be a great author.I will always bookmark your blog and will often come back down the road. I want to encourage one to continue your great posts, have a nice weekend!
    my page > amber leaf tobacco

    ReplyDelete
  9. Anonymous3:55 PM

    These are actually enormous ideas in regarding blogging.

    You have touched some nice points here. Any
    way keep up wrinting.
    Here is my blog - get rid of acne scars

    ReplyDelete
  10. Anonymous4:44 PM

    I like the helpful info you provide to your articles.
    I will bookmark your weblog and check once more
    here frequently. I'm slightly sure I'll be informed lots of new stuff proper
    right here! Best of luck for the following!
    My page - get rid of acne

    ReplyDelete
  11. Anonymous3:10 PM

    Very rapidly this website will be famous amid all blog users, due to it's good articles
    My webpage - no more acne

    ReplyDelete