2.2.10

Membuat Server Centos Menjadi Gateway dan Transparent Proxy dengan Squid

0 comments

Dalam hal ini tersedia :

  1. Server Linux Centos dengan 2 NIC
    - eth0 : 192.168.200.200 terhubung ke internet melalui proxy (gateway 192.168.200.1)
    - eth1 : 192.168.210.1 terhubung dengan client di ruangan
  2. Proxy server menggunakan Squid
    - setup awal squid dengan –> http://kusprayitna.staff.uii.ac.id/2008/08/29/setup-proxy-squid-di-centos/

Tujuan :

  1. Komputer di dalam ruangan bisa melakukan koneksi ke jaringan luar akan tetapi komputer di jaringan luar tidak bisa masuk ke komputer yang ada di ruanga




Tahapan yang dilakukan yaitu :

  1. Membuat Centos agar menjadi routerDisini disiapkan router ang bersifat Masquerading, maksudnya yaitu, semua komputer yang ada di ruangan (yang terhubung melalui gateway eth1) akan bisa melakukan koneksi ke luar melalui eth0 dan mengatas namakan eth0. Misalnya komputer di ruangan IPnya adalah 192.168.210.12 melakukan browsing ke server 192.168.220.5 (komputer di LAN lain yang bisa diakses melalui eth0), maka komputer server 192.168.220.5 akan membaca yang akses ke servernya adalah 192.168.200.200 bukannya 192.168.210.12. Atau dengan kata lain masquerading bermaksud membungkus alamat IP asli menjadi alamat IP yang Masquerading.Scrip yang disiapkan yaitu

    # Hapus semua seting yang sudah ada.
    iptables –flush
    iptables –table nat –flush
    iptables –delete-chain
    iptables –table nat –delete-chain

    # Set up IP FORWARDing and Masquerading
    iptables –table nat –append POSTROUTING –out-interface eth0 -j MASQUERADE
    iptables –append FORWARD –in-interface eth1 -j ACCEPT

    # Aktifkan packet forwarding di kernel
    echo 1 > /proc/sys/net/ipv4/ip_forward

    # routing
    route add -net 192.168210.0 netmask 255.255.255.0 gw 192.168.200.1 dev eth1

  2. Setup squid agar support transparent proxyYang dimaksud transparent proxy yaitu secara mudahnya adalah agar browsing di browser tidak usah melakukan seting proxy (tanpa proxy atau default port 80).Di Squid bisa dicek di data berikut :

    # TAG: http_port
    # Usage: port [options]
    # hostname:port [options]
    # 1.2.3.4:port [options]
    #
    # The socket addresses where Squid will listen for HTTP client
    # requests. You may specify multiple socket addresses.
    # There are three forms: port alone, hostname with port, and
    # IP address with port. If you specify a hostname or IP
    # address, Squid binds the socket to that specific
    # address. This replaces the old ‘tcp_incoming_address’
    # option. Most likely, you do not need to bind to a specific
    # address, so you can use the port number alone.
    #
    # The default port number is 3128.
    #
    # If you are running Squid in accelerator mode, you
    # probably want to listen on port 80 also, or instead.
    #
    # The -a command line option will override the *first* port
    # number listed here. That option will NOT override an IP
    # address, however.
    #
    # You may specify multiple socket addresses on multiple lines.
    #
    # options are:
    # transparent Support for transparent proxies
    # vhost Accelerator using Host directive
    # vport Accelerator with IP virtual host support
    # vport= As above, but uses specified port number
    # rather than the http_port number.
    # defaultsite= Main web site name for accelerators.
    # urlgroup= Default urlgroup to mark requests
    # with (see also acl urlgroup and
    # url_rewrite_program)
    # protocol= Protocol to reconstruct accelerated
    # requests with. Defaults to http.
    # no-connection-auth
    # Prevent forwarding of Microsoft
    # connection oriented authentication
    # (NTLM, Negotiate and Kerberos)

    # tproxy Support Linux TPROXY for spoofing
    # outgoing connections using the client
    # IP address.
    #
    # If you run Squid on a dual-homed machine with an internal
    # and an external interface we recommend you to specify the
    # internal address:port in http_port. This way Squid will only be
    # visible on the internal address.
    #
    # Squid normally listens to port 3128
    http_port 3128 transparent

    Disini kita set proxy aktif di port 3128 dan transparent.
    Langkah yang disiapkan yaitu :
    1. Lakukan redirect akses yang bertujuan di port 80 ke port 3128 (port proxy)

    iptables –table nat –append PREROUTING -i eth1 -p tcp –dport 80 -j REDIRECT –to-port 3128

    printah ini bermaksud melakukan aturan dalam iptable agar paket tcp yang tujuannya port 80 diarahkan ke port 3128 (proxy server). Perintah ini bisa di tambahkan dalam scrip di pembuatan gateway diatas.

    2. Uji coba proxy
    2.1. Ujicoba dengan browser

    Dari browser di komputer client dengan isian proxy di kosongkan (tanpa proxy) lakukan browsing ke www.uii.ac.id

    2.2. Apabila gagal, coba lakukan pengujian dengan telnet, “telnet 192.168.210.1 80″

    telnet 192.168.210.1 80
    Trying 192.168.210.1…
    Connected to 192.168.210.1.
    Escape character is ‘^]’.

    kemudian tuliskan alamat website yang akan dibuka, misalnya www.uii.ac.id
    get http://www.uii.ac.id

    maka berikutnya akan muncul isi text dari www.uii.ac.id

  3. 2.3. Apabila 2.2 berhasil membuka alamat website dengan port 80 akan tetapi 2.1 gagal, maka perlu diperhatikan sebagai berikut :
    - Alamat gateway komputer client harus ke 192.168.210.1
    - Alamat DNS server harus betul dan bisa berfungsi, apabila kosong/ tidak berfungsi maka tidak akan bisa browsing


Selengkapnya...

Setup Proxy SQUID di Centos

0 comments

Dalam hal ini tersedia :

1. Server Linux Centos dengan 2 NIC
- eth0 : 192.168.1.1 terhubung ke internet melalui proxy (gateway 192.168.200.1)
- eth1 : 192.168.10.1 terhubung dengan client di ruangan
2. Proxy server menggunakan Squid

Tahapan setup squid:

  1. Setup squid.conf
    Edit file squid.conf di /etc/squid/squid.conf

    # nano /etc/squid/squid.conf


    Contoh squid.conf -->> file
  2. Buat swap

    # /ect/squid/squid -z

  3. Buat otomatis jalan

    # chkconfig –level 235 squid on

  4. Start squid

    # service squid start

  5. selesai

Selengkapnya...

Install Squid Proxy Server on CentOS using yum install

0 comments

Step by Step Install Squid Proxy Server on CentOS using yum install Command.

The step by step article below show how to install Squid Proxy Server on CentOS using yum install command. The example below show the step by step install squid sever using the CentOS installation DVD as the source of squid software package. To install squid from CentOS installation DVD, first you need to setup the CentOS installation DVD as the source of installation software. If your CentOS have the connection to the internet, you may execute the yum command (as show on command example below) to start to install Squid Proxy Server on CentOS system but if you want to install Squid from the installation DVD, you must make some yum configuration adjustment to enable you to install software package from CentOS installation DVD.


Install Squid Proxy Server on CentOS.


Execute yum install squid, then type in y key (when ask) and hit Enter button to start Squid proxy installation process.

Install Squid Proxy Server on CentOS


[root@pc13 ~]# yum install squid

Setting up Install Process

Parsing package install arguments

Resolving Dependencies

--> Running transaction check

---> Package squid.i386 7:2.6.STABLE6-5.el5_1.3 set to be updated

--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================

Package Arch Version Repository Size

=============================================================================

Installing:

squid i386 7:2.6.STABLE6-5.el5_1.3 c5-media 1.2 M

Transaction Summary

=============================================================================

Install 1 Package(s)

Update 0 Package(s)

Remove 0 Package(s)

Total download size: 1.2 M

Is this ok [y/N]: y <-- Type in 'y' and hit 'Enter' key to proceed with squid proxy server installation

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing: squid ######################### [1/1]

Installed: squid.i386 7:2.6.STABLE6-5.el5_1.3

Complete!


[root@pc13 ~]#

Note: You still have to connect to internet to update squid proxy server, and to update your CentOS entirely ;-) happy install


Keywords: install squid proxy server centos, centos install squid proxy server, install squid centos, squid proxy server installation centos, squid proxy server centos, centos install squid


Sumber: http://www.labtestproject.com
Selengkapnya...

6.7.09

Setting Router dengan CentOS

2 comments

Pembuatan PC Linux sangatlah mudah dengan beberapa sintaks saja sudah dapat berjalan dengan semestinya. Pada tutorial ini PC Router hanya menggunakan 2 ethernet
eth0 digunakan untuk koneksi dengan LAN
eth1 berfungsi untuk koneksi dengan internet
Dengan asumsi bahwa PC telah terinstall system operasi Linux Centos.

Kumpulkan data-data untuk membuat server. Data-data berikut ini akan digunakan sampai terakhir dalam tutorial ini.
Data IP Address eth0
IP Address 192.168.10.1

Data IP Address eth1
IP Address 192.168.1.2

DNS 1 201.xxx.xxx.xxx
DNS 2 202.xxx.xxx.xxx

Setelah anda mendapatkan data tersebut segera kita dapat melakukan konfigurasi pada PC Router yang dikehendaki sesuai dengan data yang ada.

1.Login dengan user root

2. Edit file konfigurasi untuk eth0 yaitu file ifcfg-eth0
[root@centos]#nano /etc/sysconfig/network-scripts/ifcfg-eth0
Kemudian isikan dengan skrip berikut ini :
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.10.255
IPADDR=192.168.10.1
NETMASK=255.255.255.0
NETWORK=192.168.10.0
ONBOOT=yes
TYPE=Ethernet
Setelah anda tulis, kemudian simpan dan keluar

2. Selanjutnya edit file konfigurasi eth1 yaitu file ifcfg-eth1
[root@centos]#nano nano /etc/sysconfig/network-scripts/ifcfg-eth1
Kemudian isikan dengan skrip berikut ini :
DEVICE=eth1
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
TYPE=Ethernet
Setelah anda tulis, kemudian simpan dan keluar

3.Edit file konfigurasi default gateway yang ada pada folder /etc/syconfig
[root@centos]#nano /etc/sysconfig/network
Kemudian isikan dengan skrip berikut ini
NETWORKING=yes
HOSTNAME=localhost.localdomain
GATEWAY=192.168.1.1
Setelah anda tulis, kemudian simpan dan keluar

4.Edit file resolv.conf yang digunakan untuk menyimpan data dns
[root@centos]#nano /etc/resolv.conf
Kemudian isikan dns atau seperti berikut ini
nameserver 201.xxx.xxx.xxx
nameserver 202.xxx.xxx.xxx
Setelah anda tulis, kemudian simpan dan keluar

5.Restart network anda.
[root@centos]#/etc/init.d/network restart

6.Cek IP yang sudah terinstall pada Ethernet
[root@centos etc]#ifconfig
eth0 Link encap:Ethernet HWaddr 00:30:18:A4:E0:6F
inet addr:192.168.10.1 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::230:18ff:fea4:e06f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:81548 errors:0 dropped:0 overruns:0 frame:0
TX packets:74945 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:68397087 (65.2 MiB) TX bytes:8293763 (7.9 MiB)
Interrupt:201 Base address:0×6000

eth1 Link encap:Ethernet HWaddr 00:E0:4D:48:B6:06
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:4dff:fe48:b606/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:521469 errors:0 dropped:0 overruns:0 frame:0
TX packets:572347 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:411351695 (392.2 MiB) TX bytes:517878843 (493.8 MiB)
Interrupt:169 Base address:0xfc00

Cocokkan dengan data yang ada apakah sama atau tidak.

7.Cek default gateway
[root@centos]#route –n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
0.0.0.0 192.168.10.1 0.0.0.0 UG 0 0 0 eth1

Jika seperti diatas maka routing telah diarahkan ke default gateway

8. Konfigurasi iptables dengan perintah :
[root@centos]#iptables -t nat -A POSTROUTING -j MASQUERADE

9. Enable IP Forwarding Permanent setting
Edit file konfigurasi untuk mengaktifan IP Forwarding /etc/sysctl.conf
[root@centos]nano /etc/sysctl.conf
/etc/sysctl.conf:
net.ipv4.ip_forward = 1

Simpan dan keluar
[root@centos]service network restart

Kemudian
[root@centos]/etc/init.d/iptables save

10.Cek dengan koneksi dengan perintah ping
[root@centos]#ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=0 ttl=255 time=0.925 ms
64 bytes from 192.168.1.1: icmp_seq=1 ttl=255 time=0.588 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=255 time=0.603 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=255 time=0.569 ms

[root@centos]#ping www.telkom.net
PING www.telkom.net (203.130.196.201) 56(84) bytes of data.
64 bytes from 203.130.196.201: icmp_seq=0 ttl=55 time=52.2 ms
64 bytes from 203.130.196.201: icmp_seq=1 ttl=55 time=108 ms
64 bytes from 203.130.196.201: icmp_seq=2 ttl=55 time=50.7 ms


Setting client dengan menggunakan IP yang satu kelas dengan eth0, misalkan
IP Address 192.168.10.2
Subnet mask 255.255.255.0
Gateway 192.168.10.1
DNS 1 201.xxx.xxx.xxx
DNS 2 202.xxx.xxx.xxx

Tes koneksi dari client dengan melakukan ping
a. Ping ke gateway 182.18.2.1
b. Ping ke eth0, 192.168.10.1
c. Ping ke default gateway router 192.168.1.1
d. Ping ke DNS 1 dan DNS 2

- Jika ping (a) dan (b) tidak sukses maka kemungkinan kesalahan pada seting ip address client dan
kabel.
- Jika ping (c) tidak sukses maka kesalahan pada masquerading-nya, cek table routing dan file
rc.local
- Jika ping (d) terutama pada DNS2 tidak sukses maka kemungkinan jaringan internet mungkin sedang dalam keadaan down.
13.Jika sukses dalam ping, coba gunakan browsing ke suatu website, misalkan ww.google.com
Selengkapnya...

3.7.09

0 comments

Selengkapnya...

0 comments

, Selengkapnya...

1.7.09

Info Linux

2 comments

Sedang dalam tahap pengumpulan tulisan Selengkapnya...

Advertisement

Powered By Blogger

 

Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Magazine Template by Bloganol dot com