Breaking News

Minggu, 24 Februari 2013

Konfigurasi router dan proxy


ROUTER

  • ·         apt-get install vim squid
  • ·         vim .bashrc
  • ·         vim /etc/vim/vimrc (syntax on)
  • ·         cd /etc/network
  • ·         vim interfaces
  • ·         copy the primary network  interfaces sampai broadcast (perintah v blok kemudian y)
  • ·         lalu pastekan dibawah tulisan dns name server (perintah p)
            # The loopback network interfaces
          auto lo
          iface lo inet loopback

          # The Primary network interfaces
          allow-hotplug eth0
          iface eth0 inet static
                   address  192.168.1.1 (sesuai ISP)
                   netmask  255.255.255.0
                   network  192.168.1.0
                   broadcast  192.168.1.255
                   gateway  192.168.1.1

            # The Secondary network interfaces
          allow-hotplug eth1
          iface eth1 inet static
                   address  192.168.55.x  (disesuaikan )
                   netmask  255.255.255.0
                   network  192.168.55.0
                   broadcast  192.168.55.255
                   gateway  192.168.55.1


  • ·         selesai ketik :wq kemudian restart “/etc/init.d/networking restart”
  • ·         edit file sysctl.conf dengan perintah “ vim /etc/sysctl.conf”
  • ·         lalu “:set number” cari pada nomor :28 hapus tanda pagar “# net ipv4_forward = 1”
  • ·         kemudian edit file rc.local dengan perintah “vim /etc/rc.local”
  • tulis script seperti ini

# By default this script does nothing
Echo 1 > /proc/sys/net/ipv4/ip_forward
iptables –t nat –A POSTROUTING –j MASQUERADE
iptables –t nat –A PREROUTING –i eth0 –p tcp --dport 80 –j REDIRECT --to-port 3128
iptables –t nat –A PREROUTING –i eth1 –p tcp –dport 80 –j REDIRECT --to-port 3128
exit 0

  • ·         kemudian simpan :wq dan reboot
  • ·         masuk root lalu ketik perintah “iptables –t nat –nL” (perintah untuk melihat tablel routing)
  • ·         apabila SOURCE dan DESTINATION pada MASQUERADE dan REDIRECT muncul 0.0.0.0/0 berarti router berhasil mengalihkan

  • ·         coba melalui Client dengan mengatur ip
          • ·         Apabila client dapat koneksi dengan internet     berarti router sukses










PROXY


  • ·         Masuk ke direktori squid dengan perintah “cd /etc/squid”
  • ·         Buat cadangan squid.conf dengan cara “cp squid.conf  squid.conf.cadangan”
  • ·         Edit file squid.conf  ketik vim squid.conf
  • ·         Kemudian atur menjadi :set number (untuk memudahkan pencarian dengan perintah “: no perintahcontoh :1110)
  • ·         yang perlu diubah
1110    http_port 3128
            (ganti menjadi http port 3128 transparent)
674      # http_access allow localnet
            (hilangkan tanda #)
675       http_access allow localhost
            (ganti localhost menjadi all)
1999    # cache_swap_low 90
            (hilangkan tanda #)
2000    # cache_swap_high 95
            (hilangkan tanda #)
1750    #memory_replacement_policy lru
            (hilangkan tanda #)
1732    #cache_mem 8 MB
            (hilangkan tanda # dan ganti 8 MB menjadi 32 MB)
3321    #cache_mgr webmaster
           
(hilangkan tanda # dan ganti webmaster menjadi nama_peserta@smk.sch.id (sesuai soal) )
3381    #none
            (ganti menjadi visible_hostname www.smk.sch.id (sesuai soal) )
629      tulis script ini :
            acl q dstdomain “/etc/squid/blok.txt
          http_access deny q
          acl local src 192.168.55.0/24
          http_access allow local
          http_access allow all


  • ·         simpan konfigurasi dengan perintah :wq
  • ·          kemudian ketik vim blok.txt  dan buat daftar url yang ingin di blok. Contoh : www.facebook.com dan simpan ketik :wq
  • ·         Restart squid.conf dengan ketik “/etc/init.d/squid restart” tekan enter
  • ·         Cek squid dengan perintah “squid status”
  • ·         Untuk membelokan permintaaan client ketik
iptables –t nat –A PREROUTING –i eth0 –p tcp --dport 80 –j REDIRECT --to-port 3128

  • ·         tekan enter dan ketik
iptables –t nat –A PREROUTING –i eth1 –p tcp –dport 80 –j REDIRECT --to-port 3128

  • tekan enter dan cek konfigurasi squid di client dengan cara browsing di website yang diblok tadi



  •        apabila proxy tidak berjalan maka ada keterangan :

 This request appears NOT to have come via a proxy


  • ·         apabila proxy berjalan  maka ada keterangan :
Proxy detected
This request appears to have come via a proxy.



Sekian terimakasih


Kejujuran awal dari ilmu yang bermanfaat
Thanks For Visiting