Modify Hosts File - Change Your Local DNS

You have a hosts file on your computer (/etc/hosts) that your DNS server checks before it sends a request to the remote server. If you want to override an address to block ads or setup a server before it’s resolving to the Internet you can modify the hosts file.

Picture 4
The Easy Way:
Open NetInfo Manager (Applications -> Utilities) and select machines. Click the lock icon and enter your password to modify the list.

Select localhost and click Duplicate. Change the ip_address field to the address you want and the name field to the hostname you want the ip to resolve to.

Go to Domain -> Save or hit to save the changes. You can now enter the hostname into your browser and it should direct you to the ip address.

Picture 3
The Other Way:
I say the other way because it’s just about as easy, just requires a little terminal work. Open Terminal and type sudo su to gain root access. Now you can edit /etc/hosts and add the line you need.

pico or vi /etc/hosts and add the following line: 127.0.0.1 example.domain.com. Replacing the values as you see fit.

Exit out of your editing program and save the changes. You should be all ready to access your domain now.

On Windows the file is located:

Windows 95/98/Me c:\windows\hosts

Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts

Windows XP Home c:\windows\system32\drivers\etc\hosts

Technorati Tags: ,


 
 

3 Responses to “Modify Hosts File - Change Your Local DNS”


  1. Trackback
    Save On Hosting Costs With Add-On Domains | Tubetorial

    [...] Do not wait until the next DNS update and change your host file in Mac OS X [...]


  2. NteInfo manager doesn't exist in 10.5, and terminal yields sh-3.2# after entering the password.


  3. Trackback
    A programmer’s rants » Blog Archive » Warehouse installation tutorial

    [...] like. Afterwards, add that host to your hosts file. Here’s how to do it in Windows, Linux or Mac OS X. If all goes well, enter the new URL (including /install in the end) in your browser, and you [...]


Post a comment to "Modify Hosts File - Change Your Local DNS"



Support MacTips

MacTips Newsletter


Random Popular Tips

Recent Comments

Recent Discussions

MacTips Poll

What level of tips would you like to see?

View Results

Loading ... Loading ...

Friends of MacTips

Subscribe to MacTips

Site Links