Products mentioned
Web Hosting
One line, big difference

If you ’ ve been around the internet for more than 10 minutes, you already know that computers find each other using alone numeric addresses, or internet protocol ( IP ) addresses. The knowledge domain name system ( DNS ) serves as the telephone directory that a calculator uses to look up the IP address associated with a particular domain. broadly this works smoothly, but there are times when you might need to help it along by modifying the hosts file .
Related : DNS records — A founder ’ s template

Why would you modify the hosts file?

What if you ’ ve registered a newfangled world, but the domain name hasn ’ triiodothyronine propagated around the internet however and you want to start working on your new locate right away ?

Or what if you ’ ra working on a exploitation or staging web site, but you want your computer to think it ’ s the actual knowledge domain ?
This is where a fiddling text charge named hosts, nestled deep within your calculator, comes in handy .

How does the hosts file work?

When your calculator attempts to resolve a horde mention, it actually starts by checking the hosts file first. If it doesn ’ deoxythymidine monophosphate find what it needs there, then it moves on to DNS .
sol if you want your calculator to associate a world mention with a especial IP address, right NOW, wholly you have to do is add the appropriate introduction to your local hosts file .
Because your calculator checks the hosts file before DNS, you can efficaciously override DNS .

The hosts file is a simple textbook file. A trace in it looks something like this :

where is the IP address you want to point to .
The procedure for editing your hosts file depends on your machine ’ randomness operating system .

Modifying a Windows hosts file

To modify the hosts file on a Windows computer, use the Notepad text editor. late versions of Windows enforce User Account Control ( UAC ), so to make changes to the host file you ’ ll motivation to run Notepad as an Administrator .

Windows 10 and Windows 8

  1. Press the Windows key.
  2. Type Notepad in the search box.
  3. Right click on Notepad and select Run as administrator.
  4. Click Yes on the popup that appears.

Hosts File Account Control
5. navigate to c:\Windows\System32\drivers\etc
6. Open the hosts file. ( Make sure you have the file type survival set to show all files, not equitable .txt files. )
Hosts File Open
When you open the file, it will look similar to this :
Hosts File Notepad
7. Add the new lines to the file. It ’ south best to navigate to the end of the file and add your newly entries beneath the existing entries. Lines preceded by # are commented out and have no effect.
8. Click File > Save.

Windows 7 and Windows Vista

The operation is basically the like, but to open Notepad :
Start > All Programs > Accessories
then proceed as above .

Windows NT, Windows 2000, and Windows XP

These versions of Windows wear ’ thymine use User Access Control ( UAC ), so you can skip the step for running Notepad as administrator and barely open it normally :
Start > All Programs > Accessories > Notepad
Editor’s note: You can use the exposed informant desktop app HostsFileEditor to manage the hosts file on your Windows machine .

Modifying your hosts file on a Mac

These instructions apply to Mac OS X 10.6 through 10.12. Editing the hosts file on a Mac is done using the Terminal app .
1. receptive Applications > Utilities > Terminal
2. Open the hosts file by typing the following into the end window :

sudo nano /private/etc/hosts

3. Navigate through the file using the arrow keys and append your raw mappings underneath the existing ones .
4. Press Control-X and then answer Y to save the changes .
5. Flush the DNS cache by entering the pursue terminal command :

dscacheutil -flushcache

Editor’s note: You can besides use the candid generator background app Gas Mask to manage the hosts file on your Mac .

Keep in mind …

Make a stand-in copy first, so you have something to restore if anything goes askew .
The IP address and host appoint should be separated by at least one distance, though more are allowed.

# indicates a gloss in the file. When you ’ re done using a temp mapping you can either remove it or comment out the line .
Your browser caches DNS information, so it ’ mho good operation to close all browser windows before editing the hosts file. then save your edits and restart your browser .
Remember to remove your changes when you no longer need them .

Leave a Reply

Your email address will not be published.