E-Mail:
Author Avatar

Browser Speed

Browser Speed

If you’re like me, much of your daily surfing involves the same sites. Linux is, for the most part, faster at reaching those sites. However, a fundamental element of the Linux OS can make your surfing slower than it might normally be.

Your browser uses the Domain Name Server (DNS) you listed in your network settings to resolve common domain names (yadda.com - no “www”) to IP addresses, the real address of a web site. However, this DNS server may be a few hops away from your location on the Internet. That means it takes a bit more time to reach the site you want to surf than it might take if, say, the IP address was listed somewhere on your machine. That’s exactly what this tweak does - adds the IP address of your most surfed sites directly a file on your machine, the /etc/hosts file.

First, open a console window, and ping your favorite site:

    ping lockergnome.com

You’ll see output similar to this:

PING lockergnome.com (216.246.17.205) from 192.168.1.100 : 56(84) bytes of data.
64 bytes from mdr.lockergnome.com (216.246.17.205): icmp_seq=0 ttl=240 time=64.586 msec
64 bytes from mdr.lockergnome.com (216.246.17.205): icmp_seq=1 ttl=240 time=59.460 msec
64 bytes from mdr.lockergnome.com (216.246.17.205): icmp_seq=2 ttl=240 time=59.952 msec
64 bytes from mdr.lockergnome.com (216.246.17.205): icmp_seq=3 ttl=240 time=59.920 msec

In Linux, this output will continue to print to your screen until you stop it. To do so, use [ctrl]C. Or, you can use the ping command with the -c 5 option. That will send five pings and stop. From the output, you’ll need the IP address enclosed in parentheses - in this case, 216.246.17.205.

Now, change the user in your open console screen to root and open the /etc/hosts file for editing.

    su
    [your root password]
    vi /etc/hosts

Add a line to /etc/hosts that looks something like this:

216.246.17.205    lockergnome.com  lg

Then, save the file and close.

    :wq

Let’s test your tweak, then I’ll tell you what you actually accomplished. Open your browser. In the address bar type the letters lg and press [enter]. You should see the Lockergnome site in all it’s glorious green and peach - and very quickly, too.

So what did you accomplish? You circumvented the process of checking your network DNS for the IP address for Lockergnome. Your Linux system checks the /etc/hosts file first for IP information, before it looks to a network DNS. Since you added the IP address, the common domain name and an alias to the /etc/hosts file, your machine didn’t need to make those few extra queries to know where to point your browser to find Lockergnome. And, since you added and alias (lg) to the hosts entry, that’s all you’ll ever need to enter in order to access the Lockergnome site. Best of all, you can speed up access to all your most frequently visited sites with this tweak.

This whole process is scriptable, as well. I’ll create a ready-made script to add these entries to the /etc/hosts file in the next few weeks. Or, who knows? Maybe I’ll be able to include one from a reader in the GnomeVOICE.

What Do You Think?

 


Anti-Spam Image

Want to Start a Blog Here for Free?

Are you an expert in one subject or another? If your goal is to help others and dispense hard-earned information back to the community, stake a claim on your very own Lockergnome blog today! You can write about anything - no matter the topic. Sign-up to start blogging!