Patch Hosts File



  1. Patch Hosts File Windows
  2. Windows Host File Entries
  3. Patch Hosts File Adobe
  4. Hosts File Examples

Drag the Hosts file from the Finder window onto your desktop. Open the Hosts file from your desktop. It should open to TextEdit by default. Delete the content of the Hosts file. Paste the following into the same file: ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Lisa, updating the host file is about the worst way to go about this. Trying to keep host files up to date is the whole reason that DNS and WINS were born. Go that route instead. Just put the host name in the forward lookup zone for your domain, wait 10 minutes then test by pinging the name.

Modify your hosts file in Windows 10

Here’s how you can modify Hosts files in Windows 10, and map domain names to server IP addresses of your choice.

  1. Open Notepad with administrator privileges
  2. Browse to C:WindowsSystem32driversetchosts (Or paste this into the address bar)
  3. Open the file
  4. Make your changes

Applies to All Windows 10 Versions

Patch Hosts File Windows

Windows 10 still retains the old computing standard of having a hosts file for rudimentary hostname mapping. In simpler terms, the hosts file provides a mechanism to map domain names (such as “onmsft.com”) to server IP addresses of your choice.

Windows refers to the hosts file each time it connects over a network using a hostname. If it finds an entry for the hostname in the hosts file, it will contact the server specified in the file. Otherwise – and in the vast majority of cases – it will resolve the hostname using DNS (domain name service), which is the process used on the Internet to obtain the server IP address behind a domain name.

While it may sound technical, the hosts file is a really simple approach to network routing – and it’s easy to add your own entries. To get started, you just need to open the file. It resides in Windows’ internal “System32” folder, so to save your edits you’ll need administrator access.

The quickest way to open the file is using Notepad with administrator privileges. Search for Notepad (press the Start button and type its name) and right-click the app to display the context menu. Click “Run as administrator” to launch a privileged instance of the app. Note you may need to reauthenticate yourself or get an administrator’s password if you’re not already logged in as one.

With Notepad open in administrator mode, you’re ready to open the file. Click File > Open and browse to the file at C:WindowsSystem32driversetchosts (you can copy and paste this into the address bar at the top of the Open window). If you do browse through the folders graphically, remember to change the file type filter to “All Files” so the hosts file shows up.

Now you’re ready to edit the file. If you’ve never opened the hosts file before, all you’ll see is a short section of text describing its purpose and how to make edits. The introduction provides a useful overview of how the file is structured, but we’ll cover the basics here.

The hosts file is a simple mapping of IP addresses and hostnames. Each entry goes on a newline, with the IP address (that’s the numerical address) first, followed by a space or tab character and then the hostname (or domain). You can add comments to the file by placing a “#” character at the start of the line – this will make Windows ignore the line when reading the file.

Therefore, if you want to point “microsoft.com” to the IP 1.2.3.4, you’d write “1.2.3.4 microsoft.com” on a new line. Each time you try to visit microsoft.com, you’ll find yourself instead at the (non-existent) 1.2.3.4 website.

At this point, you may be wondering why you’d ever need to edit the hosts file. While it is more useful to technical users, there are also a few more general cases in which it might have value. One example is if you wanted to block a certain website, for example Google. By adding an entry for “google.com” to the hosts file, you can force Windows to point the address to a different location – so users won’t be able to visit the site.

To achieve this example, add a line such as “0.0.0.0 www.google.com” to the file. Save the file and try and visit Google in your browser. You should find the site fails to load.

Remember that this is a far from infallible way to block a site – another user could simply reverse the hosts file edit themselves. In addition, some software may employ its own techniques to lookup hostnames which might ignore the hosts file.

One far more realistic application of the hosts file is to block websites which serve up ads or spyware. Although we won’t be listing any here, if you map the addresses of prominent ad providers to an unused internal IP address (such as 127.0.0.1), you’ll suddenly be browsing an ad-free internet – in every browser.

Windows will resolve the ad URLs to an address that no longer points to the providers’ servers. Just remember that every address you add must be the hostname only (example.com), not the full web address (http://www.example.com).

That’s all about the hosts file. While you’re unlikely to use it outside of a development or network environment, it does have practical applications which could be of use to every PC consumer. You should also know that the hosts file also exists on Mac and Linux systems with the same syntax, albeit in a different location.

Share This Post:

Modify your hosts file

Authored by: Rackspace Support

Modifying your hosts file enables you to override the domain name system(DNS) for a domain on a specific machine. DNS managementis 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.For information about changing your DNS settings, see Changing DNS settings on Linux.

Modifying your hosts file causes your local machine to look directly atthe Internet Protocol (IP) address that you specify. Rackspace offersmanaged hosting solutions to assist withthe handling of these resources.

Modifying the hosts file involves adding two entries to it. Each entrycontains the IP address to which you want the site to resolve and a version ofthe Internet address. For example, add the following two entries points,www.domain.com and domain.com, to Rackspace’s current refreshed PHP5(PHP5-ITK) cluster:

This article provides instructions for locating and editing the hosts fileon the following operating systems:

  • Microsoft® Windows® 10, Windows 8, Windows 7, andWindows Vista™
  • Microsoft Windows NT™, Windows 2000, and Windows XP
  • Linux®
  • MacOS® X versions 10.0 through 10.1.5
  • MacOS X versions 10.6 through 10.12

After you add the domain information and save the file, your system begins toresolve to the IP address that you specified. When testing is complete, removethese entries.

Windows

If you are using a Microsoft operating systemlike Windows 10, Windows 8, Windows 7, and Windows Vista you must run Microsoft Notepadas an administrator.

Windows 10 and Windows 8

Use the following instructions if you’re running Windows 10 or Windows 8:

  1. Press the Windows key.

  2. Type Notepad in the search field.

  3. In the search results, right-click Notepad and select Run asadministrator.

  4. From Notepad, open the following file:

    c:WindowsSystem32Driversetchosts

  5. Make the necessary changes to the file.

  6. Select File > Save to save your changes.

Windows 7 and Windows Vista

Use the following instructions if you’re running Windows 7 or Windows Vista:

  1. Select Start > All Programs > Accessories.

  2. Right-click Notepad and select Run as administrator.

    The Windows needs your permission UAC window appears.

  3. Click Continue to grant permission.

    Notepad opens.

  4. In Notepad, select File > Open.

  5. In the File name field, enter the following path:

    C:WindowsSystem32Driversetchosts

  6. Select Open.

  7. Make the necessary changes to the file.

  8. Select File > Save to save your changes.

Windows NT, Windows 2000, and Windows XP

Use the following instructions if you’re running Windows NT, Windows 2000, orWindows XP:

  1. Select Start > All Programs > Accessories > Notepad.
  2. Select File > Open.
  3. In the File name field, enterC:WindowsSystem32Driversetchosts.
  4. Select Open.
  5. Make the necessary changes to the file.
  6. Select File > Save to save your changes.

Linux

Use the following instructions if you’re running Linux:

  1. Open a Terminal window.

  2. Enter the following command to open the hosts file in a text editor:

  3. Enter your domain user password.

  4. Make the necessary changes to the file.

  5. Press Control-X.

  6. When you are asked if you want to save your changes, enter y.

MacOS X versions 10.0 through 10.12

This section provides instructions for modifying your hosts file if you arerunning MacOS X 10.0 through 10.12.

Windows Host File Entries

MacOS X 10.0 through 10.1.5

Use the following instructions if you’re running MacOS X 10.0 through 10.1.5:

  1. Open /Applications/Utilities/NetInfo Manager.

  2. To enable editing of the Network Information database (NetInfo), click thepadlock icon in the lower-left corner of the window.

  3. Enter your domain user password and select OK.

  4. In the second column of the browser view, select the node namedmachines.

  5. In the third column, select the entry named localhost.

  6. From the Edit menu, select Duplicate.

    A confirmation alert appears.

  7. Click Duplicate.

    A new entry named localhost copy appears and its properties aredisplayed below the browser view.

  8. Double-click the value of the ip_address property and enter the IPaddress of the other computer.

  9. Double-click the value of the name property and enter the host name thatyou want use for the other computer.

  10. Click the serves property and select Delete from the Edit menu.

  11. From the File menu, select Save.

    A confirmation alert appears.

  12. Click Update this copy.

  13. Repeat steps 6 through 12 for each additional host entry that you want toadd.

  14. From the NetInfo Manager menu, select Quit.

    You do not need to restart the computer.

MacOS X 10.6 through 10.12

Use the following instructions if you’re running MacOS X 10.6 through 10.12:

  1. On your computer, select Applications > Utilities > Terminal to open aTerminal window.

  2. Enter the following command in the Terminal window to open the hostsfile:

  3. When you are prompted, enter your domain user password.

  4. Edit the hosts file.

    The file contains comments (lines that begin with the # symbol) and somedefault host name mappings (for example, 127.0.0.1 – local host). Addyour new mappings after the default mappings.

  5. To save the hosts file, press Control+X.

  6. When you are asked if you want to save your changes, enter y.

  7. To force your changes to take effect, flush the DNS cache by entering thefollowing command:

Patch Hosts File

Patch Hosts File Adobe

©2020 Rackspace US, Inc.

Hosts File Examples

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License