≡ Menu

GuideBook : How to edit your Host file

Seldom due to attack or mishap there arise the need to modify the host file. Thus, to freely control and access websites and network traffic host files requires modification

Host files are needed to resolve host name before DNS, on that particular machine. These are the large massive documents to aid the network name resolution. Modifying your host files causes your local machine to look directly at the IP address specified.

How to add host entry in file

To modify the host file, you add two entries to the file that contains the IP address that you want the site to resolve to and the address. Adding the following two lines, for example, point www.domain.com and domain.com to our current server. www.domain.com domain.com

The preceding section will highlight the how to locate and modify the host file.

  • Windows 10, Windows 8, Windows 7, and Windows Vista
  • Linux
  • Mac OS X 10.0 through 10.1.5
  • Mac OS X 10.6 through 10.11


Since Windows 10, Windows 8, Windows 7, and Windows Vista use User Account Control (UAC), so Notepad must be run as Administrator.

For Windows 10 and 8

  1. Press Windows key.
  2. Search for Notepad in the search field.
  3. As a search result, right-click Notepad and select Run as administrator.
  4. Open the following file: c:\Windows\System32\Drivers\etc\hosts through Notepad.
  5. Make the necessary changes.
  6. Save the file by clicking on File and then selecting Save.

For Windows 7 and Vista

  1. Click Start > All Programs > Accessories.
  2. Select Notepad to run as an administrator by right-clicking on Notepad.
  3. Click continue the Windows needs your permission UAC window.
  4. When Notepad opens, click File > Open.
  5. In the File name field, type C:\Windows\System32\Drivers\etc\hosts.
  6. Click Open.
  7. Make the necessary changes.
  8. Save the file by clicking on File and then selecting Save.


  1. Open a terminal window.
  2. Open the hosts file in a text editor by typing the following line: Sudo nano /etc/hosts
  3. Enter your domain user password.
  4. Make the necessary changes to the file.
  5. Press Control-x.
  6. When prompted to save the changes Select y.

Mac OS X 10.0 through 10.11
Mac OS X 10.0 through 10.1.5

  1. Traverse ->Applications->Utilities->NetInfo Manager.
  2. To grant access to edit NetInfo database, click the padlock in the lower-left corner of the window.
  3. Enter your domain user password and click OK.
  4. In the second column of the browser view, select the node named machines.
  5. The third column contains entries for -DHCP-, broadcasthost, and localhost.
  6. In the third column, select localhost.
  7. From the Edit menu, select Duplicate, It is the easiest way to create any new entry.
  8. An alert will appear asking for confirmation.
  9. Select Duplicate.
  10. A new entry called localhost copy appears, and its properties are shown below the browser view.
  11. Double-click the value of the ip_address property and enter the IP address of the other computer.
  12. Double-click the value of the name property and enter the hostname you want for the other computer.
  13. Click the serves property and select Delete from the Edit menu.
  14. From the File menu, select Save.
  15. A confirmation alert appears.
  16. Click Update this copy.
  17. Repeat steps 6 through 12 for each additional host entry that you want to add.
  18. From the NetInfo Manager menu, select Quit.
  19. You do not need to restart the computer.

Mac OS X 10.6 through 10.11

  1. Traverse the path Applications -> Utilities-> Terminal.
  2. Open the hosts file by typing the following line in the terminal window: sudo nano /private/etc/hosts
  3. Type your domain user password when prompted.
  4. Edit the hosts file.
  5. The file contains some comments (lines starting with the # symbol), and some default hostname mappings (for example, – local host). Add your new mappings after the default mappings.
  6. Save the hosts file by pressing Control+x and answering y.
  7. Make your changes take effect by flushing the DNS cache with the following command: dscacheutil -flushcache

The new changes shall now be reflected.

Contact our support executive working for round the clock with immediate and proactive support services contact us at [email protected], 040-44254242.