Membuat Proxy Server Dengan CENTOS 5 / FEDORA 7.0

11:57 AM / Diposting oleh Sharing IT /

Siapkan 1 CPU server untuk internet, dengan menggunakan 2 LANCARD

Biasanya sebuah mainboard hanya di siapkan satu LANCARD onboard, bearti anda harus memnambahkan satu buah lancard lagi di dalamnya. Saat ini saya menggunakan 1 lancard dengan merk D-Link DFE – 528 TX.

Setelah di plug in dan OS nya sudah ready, pada terminal ketikkan :

[root@misdept /]# dmesg ax |grep eth

eth0: SiS 900 PCI Fast Ethernet at 0xa800, IRQ 217, 00:50:8d:c3:39:7d.

eth1: RealTek RTL8139 at 0xffffc20000022000, 00:1e:58:31:b3:eb, IRQ 209

eth1: Identified 8139 chip type 'RTL-8100B/8139D'

eth0: Media Link On 100mbps full-duplex

eth1: link up, 100Mbps, full-duplex, lpa 0x45E1

eth0: no IPv6 routers present

eth1: no IPv6 routers present

eth0: Media Link On 100mbps full-duplex

eth1: link up, 100Mbps, full-duplex, lpa 0x45E1

eth0: no IPv6 routers present

eth1: no IPv6 routers present

Tampak hasil yang di tampilkan ada 2 ethernet card yaitu eth0 dan eth1. Dimana yang eth0 adalah ethernet onboard pada mainboard saya, dan untuk eth1 adalah lancard tambahan yang saya berikan kedalam PC tsb. Dari hasil tampilan di atas, menunjukkan kalau OS diatas sudah berhasil mendeteksi adanya LANCARD baru, tapi belum aktif.

Bila di lakukan pengecekan IP : maka :

[root@misdept /]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:50:8D:C3:39:7D

inet addr:192.168.0.105 Bcast:192.168.0.255 Mask:255.255.255.0

inet6 addr: fe80::250:8dff:fec3:397d/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:44415 errors:0 dropped:0 overruns:0 frame:0

TX packets:148493 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:4944199 (4.7 MiB) TX bytes:143933894 (137.2 MiB)

Interrupt:217 Base address:0xa800

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:1251 errors:0 dropped:0 overruns:0 frame:0

TX packets:1251 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:2074128 (1.9 MiB) TX bytes:2074128 (1.9 MiB)

Yang aktif tampak hanya eth0 saja, untuk mengaktifkan nya, pakai perintah :

[root@misdept/]# ifconfig eth01 up.

Setelah aktif, buatlah ip address pada NIC yang baru ini, sebagai contoh saya buat ip address 192.168.100.96. dan saya cek dengan ifconfig, hasilnya :

[root@misdept /]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:50:8D:C3:39:7D

inet addr:192.168.0.105 Bcast:192.168.0.255 Mask:255.255.255.0

inet6 addr: fe80::250:8dff:fec3:397d/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:44415 errors:0 dropped:0 overruns:0 frame:0

TX packets:148493 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:4944199 (4.7 MiB) TX bytes:143933894 (137.2 MiB)

Interrupt:217 Base address:0xa800

eth1 Link encap:Ethernet HWaddr 00:1E:58:31:B3:EB

inet addr:192.168.100.96 Bcast:192.168.100.255 Mask:255.255.255.0

inet6 addr: fe80::21e:58ff:fe31:b3eb/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:69669 errors:0 dropped:0 overruns:0 frame:0

TX packets:592 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:6868331 (6.5 MiB) TX bytes:87821 (85.7 KiB)

Interrupt:209 Base address:0x2000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:1251 errors:0 dropped:0 overruns:0 frame:0

TX packets:1251 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:2074128 (1.9 MiB) TX bytes:2074128 (1.9 MiB)

Untuk LAN CARD sudah selesai, dan fungsi dari 2 LAN Card ini adalah, salah satu dari LAN Card ini di hubungkan ke LAN, dan satunya lagi di hubungkan ke Modem ADSL.

Saat nya aktifkan squid anda, dengan cara ketik Setup pada terminal, pilih System Service, dan centang Squid. Tekan OK dan Quit.

Lakukan setting ini pada root :

Konfigurasi dari root:
1.cd /etc/squid
2.backup configurasi squidnya : dengan perintah #cp squid.conf squid.conf.backup

3. Buat folder dan buat folder yangbaru menjadi owner dari user squid

[root@misdept /]# mkdir -p /home/cache/squid

[root@misdept /]# chown -R squid:squid /home/cache/squid

4.Buatlah folder spool

[root@misdept/]# mkdir /home/cache/squid/spool

[root@misdept/]# chown -R squid:squid /home/cache/squid

5. Selanjutnya adalah mengconfigurasi squid.conf dan bagian2 yang perlu di edit dari squid.conf adalah
a. edit http_portnya yaitu bagian

# http_port 3128

menjadi

http_port 3128

b. edit cache lognya

# cache_log /var/log/squid/cache.log

menjadi

cache_log /home/cache/squid/cache.log

c. edit cache_store_log

# cache_store_log /var/log/squid/store.log

menjadi

cache_store_log /home/cache/squid/store.log

d. Edit memori yang dialokasikan buat menjalankan squidnya, sesuaikan dengan kemampuan squid servernya. :)

# cache_mem 8 MB

menjadi

cache_mem 16 MB

e. Edit cache dir nya, arahkan sesuai dengan langkah no 5 dan juga space alokasinya yaitu

3072 M

# cache_dir ufs /var/spool/squid 100 16 256

menjadi

cache_dir ufs /home/cache/squid/spool 3072 16 256

f. Tinggal tambahin network yang mau di allowed untuk access proxy servernya
cari bagian :

#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 to_localhost dst 127.0.0.0/8

acl SSL_ports port 443 563

acl Safe_ports port 80 # http

acl Safe_ports port 21 # ftp



acl Safe_ports port 443 563 # 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

dibawah acl localhost src 127.0.0.1/255.255.255.255, tambahkan network yang akan di allowed

acl net1 src 172.17.3.0/255.255.255.0

acl net2 src 192.168.0.0/255.255.255.0

setelah itu supaya net1 dan net2 td bisa mengakses squid maka tambahkan http_access allow
cari baris :

#And finally deny all other access to this proxy

http_access allow localhost

http_access deny all

diantar http_access allow localhost dan http_access deny all tambahkan :

http_access allow net1

http_access allow net2

baris ini bisa taruh di atas http_access allow localhost atau dibawah http_access allow localhost yang penting diatas http_access deny all

6. Simpan dan start Squid nya

[root@misdept /]# /etc/init.d/squid start

7.Gunakan testing squidnya menggunakan browser sambil di lihat acess log nya

[root@misdept /]# tail -f /home/cache/squid/access.log

8. Ok thx itu dulu dari saya.

Label:

1 komentar:

Comment by IndoIT™ on March 14, 2012 at 3:55 PM

Sedikit sharing gan buat temen2 yg lg cari tutorial install proxy server (khususnya squid), berikut instalasi lusca squid (tunnelling, high cache, youtube cache) di mesin ubuntu via virtual box. lihat di sini gan: Super Proxy with Squid + Ubuntu Server

Post a Comment