Windows host file

Source: Internet
Author: User

What is a host file?


The simple answer is: the host file is like an address book. when you type a URL in your browser, the host file will be queried to see if you have set an IP address for that site. if you set it, your computer will use this IP address to open the site. if no, the computer will go back to your Internet Service Provider (ISP) computer to find the IP address. most of the time, there will be no IP addresses in the host file. most of the time, the computer queries the ISP to obtain the IP address.


The longer answer is: windows and other operating systems use the host file to map the Host Name and IP address.


The following steps are required to find the IP address corresponding to the Host Name:

First query your local host file. the host file will tell you the IP address corresponding to the Host Name of your computer, so that your computer will stop querying and directly open the site. however, if it cannot be found, it will ask the DNS server for information.

Host File Location


Windows 95/98/me

C: \ windows \ hosts

Windows NT/2000/XP Pro

C: \ winnt \ system32 \ drivers \ etc \ hosts

Windows XP Home/Windows 7/Windows Server 2008

C: \ windows \ system32 \ drivers \ etc \ hosts


Host is the name of the file, not the name of the folder. There is no extended name for this file (for example, .exe,. txt,. Doc, etc)


If you do not have a host file, you can create one by yourself and put it in the folder listed above.


If you find that you already have the host file, we recommend that you back up it and copy it to another hard disk partition so that you can recover it.


Host file example

# Copyright (c) 1993-2009 Microsoft Corp.
# This is a sample hosts file used by Microsoft TCP/IP for Windows.
# This file contains the Mappings of IP addresses to host names. Each
# Entry shoshould be kept on an individual line. The IP address shold
# Be placed in the first column followed by the corresponding host name.
# The IP address and the host name shocould be separated by at least one
# Space.
# Additionally, comments (such as these) may be inserted on individual
# Lines or following the machine name denoted by a' # 'symbol.
# For example:
# # source server
# # X client host

# Localhost name resolution is handled within DNS itself.
# localhost
#: 1 localhost alternative80






Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.