Showing posts with label proxy. Show all posts
Showing posts with label proxy. Show all posts

Sunday, August 27, 2017

Tutorial Setting Mikrotik dan Proxy Server Squid di Virtual Box

Tutorial Setting Mikrotik dan Proxy Server Squid di Virtual Box


Sebelum kita bahas ke tutorial instalasi, sebelumnya saya asumsikan bahwa anda sudah bisa install dan konfigurasi mikrotik di virtual box, atau pun install ubuntu server di virtual box, supaya memudahkan kita dalam persiapan implementasi, bisa anda baca lagi di artikel bahasan sebelumnya mengenai Cara Install dan Konfigurasi Mikrotik di Virtual Box , untuk peralatan-peralatann yang harus kita siapkan adalah sebagai berikut dibawah :
  • Virtual Box 
  • Mikrotik routerOS.iso
  • Ubuntu Server.iso
Jika sudah siap semua peralatan, sekarang kita buat 2 machine di virtual box ( 1 untuk mirotik, dan 1 untuk ubuntu servernya ). 


Topologi Jaringan Sederhana


Planing Network Instalasi
Setting network sesuaikan adapternya :

Virtual Mikrotik :
Adapter1 : Bridge ( interface mengarah ke modem/internet )
Adapter2 : Internal network
Adapter3 : host-only adapter

Virtual Squid :
Adapter1 : Internal network

Ilustrasinya seperti gambar dibawah :


Keterangan :
  • PC master adalah PC yang di install Virtual box.
  • Pada eth0 di PC master, saya beri tanda X karna eth0(PC) hanya akan menjadi jembatan eth0 (mikrotik) dengan demikan agar PC master dapat mengakses internet melewati eth2 (mikrotik) sebagai Client dari mikrotik walaupun pada eth0 (PC) adalah client dari internet/setara dengan mikrotik

  • Hilangkan centang pada TCP/IPv4 pada adapter yang digunakan untuk mengakses inter pada PC master untuk mendapatkan tanda X di eth0(PC) tadi.
Dalam praktek ini saya menggunakan jaringan wireless rumahan wifi (speedy) namun sama saja setinggannya untuk kabel LAN. 
Setting IP masing-masing Machine nya seperti dibawah :


PC master

adapter 1 = <kosong>

adapter 2 = 192.168.3.2


virtual mikrotik

adapter 1 = 192.168.1.1

adapter 2 = 192.168.2.1

adapter 3 = 192.168.3.1


virtual squid

adapter 1 = 192.168.2.2


untuk adapter 2 pada PC, adalah adapter virtual yang telah di buat secara default oleh virtualbox agar PC master dapat terkoneksi dengan mesin virtual, lihat gambar untuk lebih jelasnya :


Topologi dengan IP

Dapat disimpulkan bahwa :

# Jaringan 192.168.1.0 adalah jaringan internet

# Jaringan 192.168.2.0 adalah jaringan proxy

# Jaringan 192.168.3.0 adalah jaringan client

Untuk settingan mikrotik saya seperti ini :



Setting client agar dapat redirect ke proxy : tambahkan NAT rules

## Firewall => Nat
action : dst-domain

src address : !192.168.2.2

protocol : tcp

dst port : 80

action  : dst-nat

to adresses : 192.168.2.2

to ports : 3128
Copy - Paste di New Terminal
    Untuk Konfigurasi Squid, Sesuaikan dengan gambar dibawah ini :

    Silahkan dikembangkan lagi materi diatas, karna konfigurasi squid nya masih default, semoga bermanfaat. 

    Source/Reference :
    - http://mikrotik.co.id
    - https://www.facebook.com/groups/Mikrotik.Squid.Indonesia/files/


    BACA JUGA : ARTIKEL TENTANG SETTING MIKROTIK DIBAWAH INI :
    1. Tutorial Setting Mikrotik dari Awal/Dasar Sampai Terkoneksi Dengan Internet
    2. Tutorial Upgrade RouterOS Mikrotik ke Versi Terbaru
    3. Tutorial Setting Hotspot Mikrotik
    4. Setting Mikrotik Sebagai Bandwitdh Limiter Jaringan Internet
    5. Tutorial Manajemen Bandwitdh Sama Rata Secara Otomatis Dengan Metode PCQ Mikrotik
    6. Tutorial Cara Meremote Winbox Mikrotik Dari Luar Jaringan
    7. Cara Mengalihkan Pelanggan Hotspot Mikrotik Yang Expired Ke Halaman Isolir
    8. Cara Menghapus (Delete) Log Mikrotik dari Terminal
    9. Tutorial Memisahkan Bandwitdh Lokal (iix) dan Internasional (ix) di Mikrotik
    10. Menghubungkan Kantor Pusat dengan Kantor Cabang dengan EOIP Mikrotik [VPN]

    ARTIKEL MIKROTIK : KUMPULAN TUTORIAL SETTING MIKROTIK LANJUT

download file now

Read more »

Sunday, August 20, 2017

Unable to add ppa behind proxy

Unable to add ppa behind proxy


While trying to add softwares from sources other than the central debian repository, we may have to add a PPA (Personal Package Archive), so that the software(apt or aptitude) which installs other softwares fetches packages for us from the new location.

The default or normal method to add a PPA via command line is as follows:

sudo add-apt-repository ppa:something

However, if you are behind a proxy, you may not be able to add this way and when you try to do something like this:

sudo add-apt-repository ppa:gnome3-team/gnome3

you may get an error like this:

Cannot access PPA (https://launchpad.net/api/1.0/~gnome3-team/+archive/gnome3) to get PPA information, please check your internet connection.

This may happen even if you have added your proxy using System Settings -> Network -> Network proxy or in /etc/apt/apt.conf or even in /home/$USER/.bashrc. This is because the sudo user is not aware of the proxy set in the places above. This tutorial explains how to make this work to add a PPA the terminal way.

So lets get started. Please note that all commands and text hereon are case-senstive, take care not to make any typos hereon, to avoid messing up your system):

  • Open a terminal using Ctrl + Alt + t
  • Type
    export http_proxy="http://username:password@your proxy":"port"
    export https_proxy="https://username:password@your proxy":"port"
    Remember to replace "username" by your username and "password" by your password, if applicable, "your proxy" by your proxy address like 10.1.101.150 or proxy.college and "port" by something like 3128.
  • Now we have two methods to export these parameter to "sudo" user:
    Method 1:
  • Type sudo visudo
  • Add Defaults env_keep="https_proxy" to the end of the file. (Note that Defaults has a capital "d")
  • Type Ctrl + x and yto save and exit.
    Method 2:
  • Whenever you use sudo command, export the environment variables of the user you are currently using. To do this, when you use sudo, use sudo -E

You are now ready to add PPA using the terminal. Please let me know, via comments, if you face any issues while doing this.
Source: The bug filed regarding this at launchpad.

download file now

Read more »

Saturday, August 19, 2017

Ubuntu Reverse Proxy Dockerized Websites

Ubuntu Reverse Proxy Dockerized Websites


This post has moved. You will be automatically redirected in 3 seconds.

download file now

Read more »

Friday, August 11, 2017

Transparent Proxy on Linux using redsocks

Transparent Proxy on Linux using redsocks



  Adapted form    http://pritambaral.com/2012/04/transparent-proxy-on-linux/ 

This post is targeted at those Linux users behind a network proxy   but cannot set it in an app, or are just plain lazy to go about telling every app to use a proxy. I�ll give a quick rundown of the instructions for those in haste, with geeky details following towards the end. I�m assuming a fairly recent distro here, and I�m targeting the Ubuntu 12.04 release.

What we�ll need:

  • A Linux OS (obviously!)
  • redsocks (an app, check in your repos, or compile it yourself)
  • a text-editor
 On Ubuntu, we have another package that we�ll need, iptables-persistent. But before we install it, let�s set some rules (iptables rules.) Don�t worry, it�s nothing but a bunch a lines in a text file.
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A OUTPUT -d 10.0.0.0/8 -j RETURN
-A OUTPUT -d 127.0.0.0/8 -j RETURN
-A OUTPUT -d 192.168.0.0/16 -j RETURN
-A OUTPUT -o eth0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 127.0.0.1:5123
-A OUTPUT -o eth0 -p tcp -m tcp --dport 443 -j DNAT --to-destination 127.0.0.1:5124
-A OUTPUT -o wlan0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 127.0.0.1:5123
-A OUTPUT -o wlan0 -p tcp -m tcp --dport 443 -j DNAT --to-destination 127.0.0.1:5124
COMMIT
I saved it as redirect.rules and ran this command:
sudo iptables-restore ./redirect.rules
Now we shall install the package iptables-persitent. During the installation, it will ask you whether you want to save the current rules. Yes, you do. The redirection�s been set-up. Time to get the juicer running.
Install redsocks (if you haven�t already.) Save this in the file /etc/redsocks.conf
base {
log_debug = off;
 log_info = off;
 log = "stderr";
 daemon = on;
 user = redsocks;
group = redsocks;
 redirector = iptables;
}
redsocks {
/* `local_ip defaults to 127.0.0.1 for security reasons,
* use 0.0.0.0 if you want to listen on every interface.
* `local_* are used as port to redirect to.
*/
local_ip = 127.0.0.1;
local_port = 5123;
// `ip and `port are IP and tcp-port of proxy-server
ip = 10.201.13.50;
port = 80;
// known types: socks4, socks5, http-connect, http-relay
type = http-relay;
login = "LDAP ID HERE";
password = "LDAP PASSWORD HERE";
}
redsocks {
local_ip = 127.0.0.1;
local_port = 5124;
ip = 10.201.13.50;
port = 80;
type = http-connect;
login = "LDAP ID HERE TOO";
password = "LDAP PASSWORD HERE TOO";
}
Make sure you feed your own LDAP IDs and passwords. AT BOTH LOCATIONS. Feed your password as-it-is, no matter what special character it has. (Unless, of course, it�s a double-quote itself! Bit of a soup there.)
Now either restart your system, or run sudo service redsocks start
Voila! You have the ultimate solution to proxy! You may (or may-not) set a proxy in Gnome, Firefox, wget, gedit, whatever; it will work. This will not interfere with what you have set in Chrome/Firefox/whatever. In fact, I recommend that you explicitly set a proxy wherever you can. You see, redsocks has a knack of getting in a bundle sometimes (too many pending requests�,) in which case, a simple sudo service redsocks restart should suffice.

This also �fixes� those apps which provide no method of setting a proxy whatsoever, e.g, Gwibber. Sadly, unsupported protocols still won�t work. Sorry, no Thunderbird, no torrents, no irc.
PS: This is the exact same method used by the Android app ProxyDroid to provide system-wide proxy on rooted Android devices.

download file now

Read more »