Monday, November 9, 2015

Squid Proxy on Ubuntu - speed up your internet

Now that you have introduced a Ubuntu box in your home environment, now lets make a proxy which does some acceleration via caching.

For your initial setup of the env - follow this....

Now go for saving your internet bandwidth (caching) and also acceleration


Installing and Configuring Squid Server
Installing Squid server on Ubuntu/Debian machines is very easy, all what you have to do is, just run the following simple command in the terminal.

$ sudo apt-get install squid

The default configuration file for squid is located under ‘/etc/squid3/squid.conf‘ or ‘/etc/squid/squid.conf‘. This file contains some configuration directives that needs to be configured to affect the behavior of the Squid.
Now open this file for editing using Vi editor and make changes as shown below.

$ sudo vi /etc/squid3/squid.conf

Now, you may search about the following lines and change them as requested, in the Vi editor, you may search about those lines by hitting the ‘ESC’ and typing “/” key to writing the specific lines to look for.
  1. http_port : This is the default port for the HTTP proxy server, by default it is 3128, you may change it to any other port that you want, you may also add the “transparent” tag to the end of the line like http_port 8888 transparent to make Squid proxy act like a transparent proxy if you want.
  2. http_access deny all : This line won’t let anybody to access the HTTP proxy server, that’s why you need to change it to http_access allow all to start using your Squid proxy server.
  3. visible_hostname : This directive is used to set the specific hostname to a squid server. You can give any hostname to squid.

After making above changes, you may restart the Squid proxy server using the command.

$ sudo service squid3 restart
$ sudo service squid restart

Now to test that your proxy server is working or not, you may open Firefox and go to Edit –> Preferences –> Advanced –> Network –> Settings and select “Manual proxy configuration” and enter your proxy server IP address and Port to be used for all connection as it follows.

Once you fill all the required proxy details, you will be able to surf the Web using your Squid proxy server, you may do the same thing in any other browser or program you want.
To make sure that you are surfing the web using your proxy server, you may visit, in the right top corner you must see the same IP address as your server IP address.

The default log file for Squid server is in ‘/var/log/squid3/access.log’ or ‘/var/log/squid/access.log‘ , you may check this file if you faced any errors or if you want to know which websites are being visited by people using Squid proxy settings.

Check Squid Logs
If you want, you can change the default log file path by editing the ‘squid.conf‘ file and searching for the line which starts with “access_log daemon” and uncomment it and change the default log file path, it must be something like this.
$ access_log daemon:/var/log/squid3/newfilename.log squid
For further configuration settings and for further details about Squid, you may check the official documentation at:

To confirm that your Squid Proxy is operation - run the following command
Also gives you and idea of how your devices are accessing internet.

sudo tail -f /var/log/squid3/access.log

Convert your spare netbook into a Ubuntu Video Streaming box

Have a spare pc ? Want to watch movies/tv over network ?

How I converted a spare netbook into ubuntu video streaming box

Ingredients :

1 android device
2 Apps - ES file Explorer [google playstore] + uTorrent
1 wifi + internet
1 sparingly used computer - laptop/netbook/notebook/desktop
1 smart TV [access to wifi and DLNA]

Netbook Configuration ::
500 gb storage + 2 gb ram

Initial Setup ::
  1. Secure wifi setup
  2. Connect your smart tv to wifi, make sure DLNA is available
  3. Install uTorrent on your android device - could be your tablet or phone
  4. Install ES File Explorer on your android device [link]
  5. The spare netbook is what I chose - due to its low power consumption - you can opt for a desktop or laptop etc.
  6. You have two choices of Operating Systems on your netbook - Windows or Ubuntu - I chose Ubuntu

Configuration on Ubuntu ::

  1. Samba Server setup + read/write permissions to everyone [link]
  2. Mini-DLNA server setup with folders just created/shared via samba server [link]

Configuration on Windows [Windows 7 and up] ::

  1. Folder share with read/write permissions to everyone
  2. Home Sharing for media

Downloads and Dumping ::

By now your so called server share will be available as a dumping ground for media
Download your content via uTorrent and utilize ES Explorer to browse the local network for your share
Dump off the downloaded content to the network share

TV ::

On your smart TV - get into the DLNA application and wait for a couple of seconds till the DLNA server shows up
Browse through the folders and voila - now play your videos over the network.

No more pen drives and cables required.

Questions ?
Why ubuntu - free, light, highly customizable, modular.
Can you watch movies from your iphone/ipad ? - yes [link]
Can you watch 1080p movies over wifi on tv ? yes with ease
My Smart TV does not resume from where i left off ? right - bookmarks are kept for USB media - not network streams.