How to update DNS for a domain on a particular machine?

This example illustrates the way to modify your hosts file which allows you to override the DNS for a domain, on a particular machine.

This is very useful when you want to test the site without any test link before going live.

Some interesting facts of this example:
1. Test website with actual links without going live.
2. To verify the working of an alias site prior to any DNS changes.
3. Modifying the host file allows the local machine to perform look up at only specified ip location.

ADD THE FOLLOWING TWO LINES AT THE END OF THE HOST FILE:


0.0.0.1 www.xyz.com
0.0.0.1 xyz.com

Steps for Windows:
1. Press the Windows key.
2. Type Notepad in the search field.
3. In the search results, right-click Notepad and select Run as administrator.
4. In Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts
5. Make the necessary changes to the file.
6. Click File > Save to save your changes.

Steps For Windows 7 and Windows Vista:

1. Click Start > All Programs > Accessories.
2. Right-click Notepad and select Run as administrator.
3. Click Continue on 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 to the file.
8. Click File > Save to save your changes.

Steps for Linux
1. Open a terminal window.
2. Open the hosts file in a text editor (you can use any 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 asked if you want to save your changes, answer y.

Hope this example was useful for you.

Thanks!!

Related Post

Advertisements

Yuvraj has written 39 articles

"Learn & Share" - I believe in this. What about you?