I am using a 3G modem. Unfortunately here it does not work as it should, being unstable and slow, most of time. Only 10% of the full contrated speed is guaranteed. It still is expensive, but for mobility, it is what it is. One other detail: I am always in the same sites. A great number the sites, but usually the same.
A proxy is the best way to make it go faster. According to wikipedia, a proxy is "a server (a computer system or an application program) that acts as a go-between for requests from clients seeking resources from other servers".
Thus, every web access will be requested to the proxy, and it will fetch it in Internet. This web page will remain a little in the system, because if it is requested again, some components will already be downloaded. That means that your browser will show the page faster.
We will see some changes to be made in proxy server, and some others in browser.
We'll be using Squid, a well-known proxy server, famous, free and widely used. This configuration is not difficult, but requires attention. You should know how to use vim.
As usual, installing a sofware in Ubuntu is a breeze. We will work using CLI, instead of GUI. I recommend you to copy the commands written here and paste them in BASH, to avoid typos.
First, let's assure that Ubuntu has informtion about the most recent packages. Open the CLI, and paste the following lines:
sudo aptitude updatesudo aptitude install squid
Remeber that if you want, you can dispose the whole squid configuration with the following lines:
sudo chattr -i /etc/squid/squid.conf.originalsudo rm /etc/squid/squid.conf.original
sudo aptitude purge squid
You need vim to be installed. If you are not sure about it, copy this line and paste it on Bash:
sudo aptitude install vim
First of all, let's do a backup copy of it's configuration file:
sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.originalsudo chattr +i /etc/squid/squid.conf.original
Squid Configuration file has lots of comments. They are really helpful, but can be annoying sometimes. So we will "clean" it all:
sudo egrep -v "^$|^ *#" \/etc/squid/squid.conf.original > /etc/squid/squid.conf
We must know the version of our software. This is how I can identify squid version:
sudo dpkg -p squid
Package: squid
Priority: optional
Section: web
Installed-Size: 1748
Maintainer: Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: i386
Version: 2.7.STABLE3-4.1ubuntu1
Replaces: squid-novm
Depends: libc6 (>= 2.4), libcomerr2 (>= 1.01), libdb4.7, libkrb53 (>= 1.6.dfsg.2), libldap-2.4-2 (>= 2.4.7), libpam0g (>= 0.99.7.1), netbase, adduser, logrotate (>= 3.5.4-1), squid-common (>= 2.7.STABLE3-4.1ubuntu1), lsb-base (>= 3.2-14), ssl-cert (>= 1.0-11ubuntu1)
Pre-Depends: debconf (>= 1.2.9) | debconf-2.0
Suggests: squidclient, squid-cgi, logcheck-database, resolvconf (>= 0.40), smbclient, winbind
Conflicts: sarg (<<>
</ubuntu-devel-discuss@lists.ubuntu.com>
This another way to do te same:
sudo dpkg -l | grep squid
In my system, this was the result:
ii squid 2.7.STABLE3-4.1ubuntu1 Internet object cache (WWW proxy cache)
Note that if your version is different, may ther be some differences.
Finally, let's start with the changes in Squid:
sudo vim /etc/squid/squid.conf -c ":set number"
I did the following changes:
...35 icp_access deny all
36 http_port 127.0.0.1:3128
37 hierarchy_stoplist cgi-bin ?
...
48 extension_methods REPORT MERGE MKACTIVITY CHECKOUT
49 dns_nameservers 200.169.116.23 200.169.116.22
50 hosts_file /etc/hosts
Line 36 makes my Ubuntu more secure. In line 49 I stated both DNS IPs from my provider. acrescentei a linha 49, com os IPs do DNS do meu provedor. If you don't know about these IPs (they should be given by your ISP), you may see them in your Ubuntu system:
sudo cat /etc/resolv.conf
In my system, I had the following:
nameserver 200.255.121.39nameserver 200.169.117.14
After these changes, we need to restart squid. So, let's do it:
sudo /etc/init.d/squid reload
To assure it is working, we can search the open ports. Squid uses port 3128:
sudo netstat -ltnp | grep -i squid
In my system:
tcp 0 0 127.0.0.1:3128 0.0.0.0:* OUÇA 3216/(squid)
What is bold in this line, is the same content of line 36 of squid's configuration file.
The changes in our browser will be much easier. Let's do it in Firefox, which is already present in Ubuntu:
Let's first access Preferences, in edit menu.
After, we need to push Advanced button. In network tab, click on CONFIGURE.
Do the same changes I did in this screen. Mine is in Brazilian Portuguese, but the fields are in the same place.
It is done. Proxy server installed and configured, and browser configured to talk to proxy server. In my computer, in about 8 days of use, I had the folowing use of HD:
sudo du -sh /var/spool/squid/32M /var/spool/squid/
You should always control the space used by squid. If it increases too much, you can empty this cache. Type the following:
sudo squid -z
This article which was retrieved from Postado por, A few drops about Linux, linuxdrops.blogspot.com (last visited Sep. 17, 2009), is licensed under a Creative Commons Atribuição 2.5 Brasil License
1.sudo egrep -v "^$|^ *#" \ what should i do next ?
2.how can i make change after typing this sudo vim /etc/squid/squid.conf -c ":set number" . It should not any matching at your line youre mentioned above, i mean it comes different at all mine.
here is the the result :
69 # not the proxy. This is a limitation of bending the TCP/IP protocol to
70 # transparently intercepting port 80, not a limitation in Squid.
71 #
72 # === Parameters for the basic scheme follow. ===
73 #
74 # "program" cmdline
75 # Specify the command for the external authenticator. Such a program
76 # reads a line containing "username password" and replies "OK" or
77 # "ERR" in an endless loop. "ERR" responses may optionally be followe d
78 # by a error description available as %m in the returned error page.
79 #
80 # By default, the basic authentication scheme is not used unless a
81 # program is specified.
82 #
83 # If you want to use the traditional proxy authentication, jump over to
84 # the helpers/basic_auth/NCSA directory and type:
85 # % make
86 # % make install
87 #
88 # Then, set this line to something like
88,1 1%
and how can i exit from this menu gracefully ???????????
i always use force quit Thanks alot
1.sudo egrep -v "^$|^ *#" \ what should i do next ?
2.how can i make change after typing this sudo vim /etc/squid/squid.conf -c ":set number" . It should not any matching at your line youre mentioned above, i mean it comes different at all mine.
here is the the result :
69 # not the proxy. This is a limitation of bending the TCP/IP protocol to
70 # transparently intercepting port 80, not a limitation in Squid.
71 #
72 # === Parameters for the basic scheme follow. ===
73 #
74 # "program" cmdline
75 # Specify the command for the external authenticator. Such a program
76 # reads a line containing "username password" and replies "OK" or
77 # "ERR" in an endless loop. "ERR" responses may optionally be followe d
78 # by a error description available as %m in the returned error page.
79 #
80 # By default, the basic authentication scheme is not used unless a
81 # program is specified.
82 #
83 # If you want to use the traditional proxy authentication, jump over to
84 # the helpers/basic_auth/NCSA directory and type:
85 # % make
86 # % make install
87 #
88 # Then, set this line to something like
88,1 1%
and how can i exit from this menu gracefully ???????????
i always use force quit Thanks alot
I wrote this post in my blog, originally. There you should see the correct format. What is happening is that "sudo egrep -v "^$|^ *#" \" is the first part of the whole line. The following line is the rest of it (/etc/squid/squid.conf.original > /etc/squid/squid.conf).
Notice that when you want to write a whole line in two you end the first part with a backslash (\), as I did. So, you should write the whole line:
sudo egrep -v "^$|^ *#" /etc/squid/squid.conf.original > /etc/squid/squid.conf
Secondly, it is different because maybe your version of squid is newer. So, forget the number of the lines and look for the line content, okay ?
Any doubts, post them in http://linuxdrops.blogspot.com/2009/05/faster-internet.html, or send me an email: gilva.martins -at- gmail.com
Add comment