0176253552
KeriaCoder
  • Welcome
  • About
  • Blog
  • Contact
  • Search

How to add new hostfile Tutorial

09/18/2015/0 Comments/in Tutorial /by keriacoder

Credit to : How-to-Geek

Modifying your hosts file allows you to override the DNS for a domain, on that particular machine. This is useful when you want to test your site without the test link, prior to going live with SSL; verify that an alias site works, prior to DNS changes; and for other DNS-related reasons. Modifying your hosts file causes your local machine only to look directly at the IP address specified.

 

The following sections provide instructions for locating and editing the hosts file on several operating systems. After you add the domain information and save the file, your system begins resolving to the specified IP address. After testing is finished, remove these entries.

  • Windows 8 or 8.1 or 10
  • Windows 7
  • Ubuntu
  • Mac OS x (any version)

Windows 8 or 8.1 or 10

First, Press the window key. Type notepad in the search field, then right-click on Notepad in the search results list, and choose to run it as administrator. If you’re using Windows 10 this will be on the Start Menu.

If you’re using Windows 10, it’ll look more like this:

Windows_10

Once you’re done, In Notepad, open the following file:

1
c:\Windows\System32\Drivers\etc\hosts

Windows_10

Then you can edit to the file. Once you’re done, Click File > Save or CTRL + S to save.

Windows 7

To access the hosts file in Windows 7 you can use the following command in the Run Line to open Notepad and the file :

1
notepad c:\windows\system32\drivers\etc\hosts

sshot-2010-08-31-[19-41-19]

Once Notepad is open, you can edit the file.

sshot-2010-08-31-[20-51-49]

After you edit your Hosts file make sure to save it by click on File > Save or CTRL + S.

sshot-2010-08-31-[20-54-07]

Ubuntu

In Ubuntu 10.04 and most Linux distro’s you can edit the hosts file directly in the terminal. You can use your favorite editor or even open your favorite GUI text editor. For this example we will use VIM. If you don’t have VIM you can refer from this; How to install VIM. Like Windows 7, Ubuntu’s hosts file is located in the /etc/ folder, though here it is in the root of the drive. In order to edit the file you will need to open it as root which is why we use sudo here.

Now that it is open we can edit it to redirect Facebook into nothing. You will notice that with Ubuntu there is also a section for IP6. For most needs you will only need to edit it the top section and ignore the IP6.

Then save the file.

Mac OS X (Any version)

In OS X, accessing the hosts file is very similar to Ubuntu. Begin in terminal and use your favorite editor, even is you wish to call a GUI text editor, it is easier to do so from terminal.

The file will look a bit more like Windows, only with a little less explanation. We are going to redirect Facebook.

This time it seems that 0.0.0.0 is a loopback and will direct you to the computers Apache test page.

 

Share this entry
  • Share on Facebook
  • Share on Twitter
  • Share on Google+
  • Share on Pinterest
  • Share on Linkedin
  • Share on Reddit
  • Share by Mail
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

You must be logged in to post a comment.

KeriaCoder View Stat

Recent Posts

  • Disable Loopback Check
  • How To – Allow non-admins to start and stop system services
  • How to add new hostfile Tutorial
  • [Powershell] – Import to Sharepoint List from CSV
  • Simple way to move content database of SharePoint 2010

Recent Comments

    Archives

    • January 2016
    • September 2015
    • August 2015
    • July 2015
    • June 2015

    Categories

    • Troubleshoot
    • Tutorial

    Latest Update

    • Disable Loopback Check01/26/2016 - 2:50 am
    • How To – Allow non-admins to start and stop system services01/05/2016 - 1:50 am

    Recent Comments

      Categories

      • Troubleshoot
      • Tutorial

      Archives

      Keria Coder (00208351-W)

      No 4a, Jalan Keluli Aj7/Aj,
      Taman Perindustrian Bukit Raja Selatan,
      40000 Shah Alam

      +60-0176253552
      fahmi@keriacoder.com

      © Copyright - KeriaCoder 2015 - Enfold WordPress Theme by Kriesi
        [Powershell] – Import to Sharepoint List from CSV [Keriacoder] - Powershell How To – Allow non-admins to start and stop system services
        Scroll to top