Modifying the HOSTS file

Modifying the HOSTS file

Quick Instructions (Windows Only - MAC Instructions below)

http://www.youtube.com/watch?v=dbDSPnsI9bw

Right-click anywhere on the desktop then click on "New" and then "Shortcut"

In the box that appears, enter the following text:

C:\Windows\System32\notepad.exe %windir%\system32\drivers\etc\hosts

Give the shortcut a name (eg. HOSTS) and then save it.

 

Windows 7, 8 and 10 Only

Now, right-click on the shortcut and then click on "Properties"

Click on the Advanced button

Put a tick into the box, "Run as administrator"

 

Editing the HOSTS File

 

Now you can click on the shortcut to open the HOSTS file for editing. After saving the HOSTS file, restart your browser and the destination domain will be resolved to the new IP Address.

 

 

The format for entering IP address in the HOSTS file is "IP Address" followed by a space and the followed by the "Domain Name"

For example:

217.168.156.30 google.com

In the example above, adding this line will make your computer look for google.com on the server with the IP Address 217.168.156.30

 

When you wish to remove the entries from the HOSTS file, you can simply add the # symbol at the start of the line and after saving the HOSTS file, the entries become inactive.

For example:

#217.168.156.30 google.com

 

 

Mac

http://support.apple.com/kb/TA27291?viewlocale=en_US

Mac OS X: How to Add Hosts to Local Hosts File

Mac OS X 10.0, Mac OS X 10.2

Mac OS X 10.2 or later

Edit the /private/etc/hosts file. For more information on how to use the hosts file, open Terminal and type:

man hosts

Note: Editing this file requires root privileges.

Mac OS X 10.0 through 10.1.5

  1. Open /Applications/Utilities/NetInfo Manager.
  2. To allow editing the NetInfo database, click the padlock in the lower left corner of the window.
  3. Enter your Admin password and click OK.
  4. In the second column of the browser view, select the node named "machines." You will see entries for -DHCP-, broadcasthost, and localhost in the third column.
  5. The quickest way to create a new entry is to duplicate an existing one. So select the "localhost" item in the third column.
  6. Choose Duplicate from the Edit menu. A confirmation alert appears.
  7. Click Duplicate. A new entry called "localhost copy" appears, and its properties are shown below the browser view.
  8. Double-click the value of the ip_address property and enter the IP address of the other computer.
  9. Double-click the value of the name property and enter the hostname you want for the other computer.
  10. Click the serves property and choose Delete from the Edit menu.
  11. Choose Save from the File menu. A confirmation alert appears.
  12. Click Update this copy.
  13. Repeat steps 6 through 12 for each additional host entry you wish to add.
  14. Choose Quit from the NetInfo Manager menu. You do not need to restart the computer.

 

 


Explantion

Introduction

When using the Internet most people connect to web sites, ftp servers or other Internet servers by connecting to a domain name, as in www.google.com. Internet applications, though, do not communicate via domain names, but rather using IP addresses, such as 192.168.1.1. Therefore when you type a domain name in your program that you wish to connect to, your application must first convert it to an IP address that it will use to connect to.

The way these hostnames are resolved to their mapped IP address is called Domain Name Resolution. On almost all operating systems whether they be Apple, Linux, Unix, Netware, or Windows the majority of resolutions from domain names to IP addresses are done through a procedure called DNS.

What is DNS

DNS stands for Domain Name System and is the standard domain name resolution service used on the Internet. Whenever a device connects to another device on the Internet it needs to connect to it via the IP address of the remote device. In order to get that IP address, DNS is used to resolve that domain name to its mapped IP address. This is done by the device querying its configured DNS Servers and asking that server what the IP address is for that particular domain name. The DNS server will then query other servers on the Internet that know the correct information for that domain name, and then return to the device the IP address. The device will then open a connection directly to the IP address and perform the desired operation.

 

Was this answer helpful?

 Print this Article

Also Read

Smitfraud Fix

How to Backup your Registry:

How to Backup your Registry:Your registry is the single most important part of your Windows...

How to Change the Licence key of your Microsoft Office 2007 installation:

How to Change the Licence key of your Microsoft Office 2007 installation:You might find yourself...

Clear Browser History

Clear Browser History Sometimes, websites do not appear nor behave exactly as they should....