How to Install Transparent Proxy on Ubuntu

Now, I want to share my experience to install squid server on Ubuntu as transparent proxy. One important thing you need is install Ubuntu Server edition, Just install basic package than configure the server to connected to internet properly. If needed, set the /etc/apt/sources.list to link to local repository server which near with your location for new version of package or just installed from your CD/DVD installer. For this tutorial, I’m using squid 2.6. Let’s go to run.

me@simplyeko:~$ sudo apt-get install squid

After all finished, edit the file configuration. Use your favorite editor. For this tutorial, I’m using “vi” as my favourite editor

me@simplyeko:~$ sudo vi /etc/squid/squid.conf

Find this in squid.conf and change it

visible_hostname proxy.simplyeko.com
cache_mgr admin@simplyeko.com
http_port 3128 transparent
always_direct allow all


That’s all you need to change on squid.conf, but if you want more configuration file for squid.conf you can use this setting in here as comparison. The keyword for transparent proxy configuration on squid.conf is http_port 3128 transparent.

Now create the cache directory by typing

me@simplyeko:~$ sudo squid -z

Now you can run the squid

me@simplyeko:~$ sudo /etc/init.d/squid start

Transparent proxy already set. Transparent proxy means that we don’t have to enter any proxy address on browser. If you browse a website, you are going to port 80. But with this tutorial, we’re forwarding any connection that’s going to port 80 to our squid server automatically. So let’s start setting this.

me@simplyeko:~$ sudo echo 1 > /proc/sys/net/ipv4/ip_forward

This method is to enabling ip forwarding

Put that script in your startup scripts.

Now you have to put masquerading method so you can forward the connection

me@simplyeko:~$ sudo apt-get install ipmasq

The last..

me@simplyeko:~$ sudo iptables -A PREROUTING -t nat -p tcp –dport 80 -j REDIRECT –to-port 3128

This command is for forward any request on port 80, will be forwarded to port 3128 (our squid port)

Now you can run transparent squid proxy

me@simplyeko:~$ sudo /etc/init.d/squid start

Congratulations….!!! You have Transparent Proxy on your server and ready for production.

Comments

  1. seting iptables biar permanent disimpan di /etc/rc.local, jadi waktu restar ngak balik ke awal lagi :)

  2. berat mainannya euy :D

    WatchUOnlines last blog post..mike golic

  3. hey, nice article

  4. mas… saya sudah cobe, ikutin cara di atas tapi kok pas waktu jalankan perintah
    sudo squid -z

    kok malah ada yang muncul tulisan permiss denied, apa emang gak ada file ataupun folder yang di chmod ???

    mohon tanggapannya nih, trimakasih.

  5. Eko Prasetyo says:

    # Edi
    iya…tempat dimana cache di store harus dikasih akses ke squid

  6. Mas, artikelnya bagus2. tapi sayang anda tidak mencantumkan penulis aslinya. Sebab kebanyakan artikel anda hanya COPY PASTE SAJA. Saya sudah sering membaca artikel anda dan ternyata pengarang aslinya bukan anda. Hargai dong jerih payah penulis lain dengan cara mencantumkan sumbernya.

  7. Eko Prasetyo says:

    # rafi
    yg mana?
    tutorial emang begitu sifatnya..hampir sama semua.
    saya hanya menuliskan apa yg saya kerjakan.
    tutorial bikin proksi dimana-2 sama mas…hanya beda-2 dikit ajah.

  8. Ini blog gak mutu banget…. dah aksesnya lama lagi… Pake domain apa sih??? kuburan kali ya..

  9. Ya…emang ini blog cuma bikin buntu pikiran. Bukan ngajarin tapi cuma show “other people” force.

    Kalau mau ngajarin itu yang bener tho….mas..mas..

  10. Eko Prasetyo says:

    # Sulis
    jangan cuman bisa komplain ah.
    transparent proxy emang gitu doang..
    baca kalimat pertamanya dong ah.

    klo kesasar kemari jangan salahkan saya…dan kok ya sempet-2nya komentar..hehe

  11. Eko Prasetyo says:

    # sulung
    bisa bedain domain ama hosting gak? :)
    klo domain ya pakenya simplyeko.com
    klo hosting?..cari tahu sendiri ya…hehe
    tebakannya salah tuh.

  12. mas mau tanya nih. linksys wrt54gl punya saya bermasalah udah di reset tapi ngga mau juga sudah di browser 192.168.1.1 ,tapi tidak bisa konek kalau pakai CD softwarenya gimana? apa linksysnya rusak tapi kalau di hidupin signal wi-fi nya terdeteksi laptop

  13. jefri, do you try to connect through the wifi?, hopefully your LAN port still okay.

Trackbacks

  1. [...] cara instalasi atau setting proxy squid server di postingan ini karena kamu bisa baca semuanya di sini dan di sini. Untuk memberikan gambaran juga sedikit mengingatkan apa sih squid proxy server itu?, [...]

Speak Your Mind

*

Must Readclose