Fun with the hosts file

The hosts file is a file in an operating system that is used to map hostnames to IP addresses. It is a plain text file and can be found in the Windows\System32\drivers\etc\ directory in a windows system and in /etc in Linux. Windows users can simply use notepad to edit it and Linux users can run sudo gedit /etc/hosts to edit it.

When you open the file you might see something like this-

#This is an example of the hosts file
127.0.0.1 localhost
::1 localhost

You can add lines to the file by writing an IP address followed by a hostname. The first line associates the IP address 127.0.0.1 to the hostname localhost. If you enter localhost or 127.0.0.1 into your browser's address bar, you'll see an error page unless you have a LAMP(or WAMP in case of windows) server installed. The most common application of the hosts file is that it is used to block websites on a computer.

Now, how do you block a website on your computer? It's no big deal. All you need to do is add a line to the hosts file. Lets suppose you want to block Facebook. Add the following line to the hosts file-

127.0.0.1 facebook.com

This will associate the hostname facebook.com with the IP address 127.0.0.1 and you won't be able to access the site now. You may also add lines for subdomains like www.facebook.com if you wish to block certain subdomains only. Note that you can't block a certain directory of a website like www.google.com/adsense/. Blocking a website can be handy at times and very effective if you have only noobs accessing the computer.

Almost every Indian student who has attended computer lab classes in school or at college would have felt bored and jobless at some instance. We all would admit we've considered messing with the school/college computers a bit as a cure for our boredom 😛 . I've used the hosts file to have my share of fun in my college's computer lab. We were told that the only website we were allowed to access was Google(read as search engines). I used my jobless mind to experiment around with the hosts file and redirected google.com to a lets say, NSFW website 😀 . Not that I'm suggesting anything (innocently blinking eyes), but if you ever feel like redirecting a domain to some other site, here's what you need to do:

1. First of all decide the the site to which you want to redirect the site. Now you need to find the IP address for that domain. Note that if the site is hosted on a shared host, it won't have a dedicated IP address associated with it. So its always a good idea to pick a famous website that is more likely to be on a dedicated server. Lets take the example of facebook for instance. Suppose I want to redirect google.com to facebook. Use any online service to get the IP address for facebook.com. You'll get 69.63.189.11. This is the IP address you want to redirect the hostname google.com to.

2. Add a line for the IP and the hostname you want to redirect to the hosts file. In this case, it would be 69.63.189.11 google.com. Mischief managed, you're done.

Needless to say, try stuff at your own risk and stay out of trouble at school/college. There was one more occasion when I used the hosts file in college. We were supposed to launch the website for Technosearch 2011 on the stage and we had no internet access there. I used the hosts file to point technosearch.net to 127.0.0.1 to make the launch look better. Hope this post helped you understand the purpose of the hosts file better and helps you use it for your work.

Update

First things first. Apologies to my regular readers for not being able to update my blog too often. I owe you guys an explanation and hence this post. I also regret not being able to help my entrance-exam traffic this year as much as I've done in the past years. I'll try to be more regular with my blog updates from now. ( Yes I know this is not the first time I've said this 😛 )

My last post dates back to January which was a very ordinary month. Just the usual college life, early morning lectures, which for a change, I did manage to attend. Then came the very busy month of February. I spent most of my time working either for Technosearch and Maffick 2011 or Excelsior 2011, the college magazine. The magazine was a big success. You can download an e-copy if you haven't checked it out yet. March was the month when life started getting easier. After Techo-Maffick '11 was over, the focus shifted completely to Excelsior '11. Being involved in designing it was a great experience. It was fun working with my buddy Anupum Pant who also happened to be the Chief Designer. Learnt quite a lot of new stuff in Corel Draw. March was also the month when I actually had to study a bit too 😛 . Moving on to the release of Excelsior '11 that was early in the month of April. Along with it came the realisation that the magazines are heavier than they look, specially when they are in bundles of 25. The month of April also meant that it was exam time. I completed my minor project on Building a home security surveillance system using the Lego Mindstorms NXT successfully but making the project report and getting it printed turned out to be a big PITA. The project coordinator literally made us work (for her) for extra credits; result to be out soon, hope it pays off. My exams and practicals were over in the first week of May and I've been in Delhi for last 12 days or so. I'll be here till the end of June before the commencement of my final year in college.

That's all about what I've been up to for the past few months. Now, I'll get to what I'm into right now. This weekend seems to have a lot of sporting events lined up. I've been following the 4th edition of the Indian Premier League and am supporting the Mumbai Indians as always. They have a big match tomorrow against RCB. Hope they manage to pull off a victory. I've also been following the French Open. Hope to see another Federer-Nadal final resulting in favour of Federer. I've been following Formula 1 a lot more ever since Michael Schumacher has come back from retirement. Sadly he doesn't have a car good enough to support his potential and he hasn't been in performing that well. Hope to see a better performance in the Monaco Grand Prix scheduled for this weekend. Needless to say the Indian in me supports Narain Karthikeyan too but again wish he had a better car to drive. Just to add to the list of sporting events this weekend, the UEFA Champions League final is also a big event to look forward too. I'm not much of a fan but I'll be supporting Barcelona for the final.

It feels good to rediscover the joy of blogging after a long break. It can be tough to get your mind working at times but once you get past that stage, its pure joy. I could go on and on about anything and everything and make this post look like it would never end but its getting really late so I should get some sleep now.

My first mobile post

<blowing away the cobwebs> I'm back again. This is my first post from my new phone, the HTC Desire Z. Just wanted to test the wordpress app for android. More posts to follow soon. I'll also be publishing a few mobile posts occasionally.

Next up: A post about where I've been for the last few months and my 6th semester at college.

Yaptime – Your Private Social Network

This is a Sponsored post written by me on behalf of YapTime. All opinions are 100% mine.

YapTime is an interesting new free service for social groups. Group members communicate via YapRooms, which are

private gathering places for the important groups in your life to have discussions, share photos, videos, and plan events using group calendars.

Social networking sites have gained immense popularity lately. Most social networking websites these days deviate from the basic purpose of their creation. The popular social networking sites like Facebook, Myspace etc have turned into much more than just social networks as a result of the addition of new features to deal with the competition. As a result, all you can see on social networks is cluttered game and application updates that almost always make no sense to anyone and defeats the basic purpose of social networking.

In the present situation with all these complicated social networks gaining popularity, people with little or no knowledge of computers like grandparents don't have many options in terms of user friendly social networking websites. This is where YapTime is a really good means to satisfy this end. It can be used to share your thoughts with your social groups with complete privacy and security. With YapTime, you don't need to worry about social engineering or identity theft as your information is completely private.

YapTime surely is something to look out for. It just might be the next big thing when people get fed up of all these social networks. Getting started with YapTime is simple, users select a room name and invite members from their online address book to their newly created YapRoom – no complicated privacy settings to figure out, no complex features to learn, no unnecessary friend requests. Yaptime supports login through your facebook and twitter ids too so it would definitely be worth spending a few minutes to have a look and add your friends to your YapRoom.

Visit Sponsor's Site