Guides

Edit & Hack The Hosts File – Part 2

Welcome to the second post in the series “Working with Hosts file” where we are learning to work with the hosts file in our operating system.

[Recommended Reading: Working With Hosts File – Part 1]

[Recommended Reading: Custom Made Hosts File – Part 3]

Hosts File

This is the 2nd post in the series of  Working With Hosts File, we will be discussing the following topics in this post:

  • Working With The Ping Command
  • Editing The Hosts File
  • Hacking The Hosts File

Working with Ping Command

Previously you learned how to locate and open the hosts file; now is the time to enter the host names with IP addresses. We can enter any host name we want in the hosts file, however, how can we enter IP addresses? How to find these IP addresses first of all? Do we need to remember all these IP addresses as well after finding them?

The unanimous answer to all these questions is the Ping command. This command enables you to find the IP address of any domain name you wish.

You must have an Internet connection to work with the ping command

Perform the following steps to work with the ping command to find IP addresses:

  1. Open the Run dialog box, as shown in Fig. Hosts File-1:

Run Command

TIPS: You can open the Run dialog box from the Start menu in Windows 7 or by using the Search bar in Windows 8.

  1. Type cmd in the Open text box (Fig. Hosts File -2).
  2. Click the OK button, as shown in Fig. Hosts File -2:

Run Command

The command prompt opens (Fig. Hosts File-3).

  1. Type ping followed by a domain name in the command prompt. In our case, we have typed ping www.techtricksworld.com (Fig. Hosts File-3).

The IP address 46.30.211.62 of techtricksworld appears in the command prompt, as shown in Fig. Hosts File-3:

Command Prompt

NOTE: The first line in command prompt is always C:\Users\User Name. You have to type the above mentioned command after that.

After finding the IP address, let us now learn about editing the hosts file.

Editing Hosts File

Editing the hosts file in your operating system is both simple and interesting. It can be done both for our own purpose and for playing pranks on others.

Perform the following steps to edit the hosts file:

Open the hosts file from the path C:\Windows\System32\Drivers\etc, as shown in Fig. Hosts File -4:

Hosts File

Type the IP address followed by a domain name at the end. In our case, we have typed 46.30.211.62 www.techtricksworld.com, as shown in Fig. Hosts File-5:

Editing Hosts File

There must be at least one space gap between the IP address and the domain name to separate both.

  1. Save the hosts file to save the changes made in it.

After editing the hosts file, let us now learn about hacking the host file.

Hacking Hosts File

Hacking the hosts file allows you to play with the hosts file. You can play pranks on friends if they use your computer anytime or you can just have fun yourself while doing it.

While hacking the hosts file, you just have to enter a fake entry in the file. In simple words, you can enter an IP address, which is of a different domain name to another domain name. Here is an example to explain it to you properly, suppose the IP address of www.XYZ.com is 123.45.79.89, so you can create an entry in the hosts file as:

123.45.79.89     www.techtricksworld.com

Now, in this case, when you enter www.techtricksworld.com in your web browser, the browser looks for domain name and its IP address in the hosts file. As a result,the browseropens the website www.XYZ.com rather than techtricksworld, which a person was aiming to access.

So, this completes our second post of the series. Hope you understand every concept properly and look forward to the next post. Stay connected to learn about working with custom hosts file in the third post of the series.

NOTE :- Tech Tricks World is the sister blog of Stoogles, thus I have given the example of Tech Tricks World in the posts! 🙂

About the author

Zainil Dedhia

Zainil Dedhia is commerce graduate & is pursuing his further studies in commerce. He loves to write about free software's & social media.

Add Comment

Click here to post a comment

CommentLuv badge