Functions of the hosts file

Source: Internet
Author: User

Source:

I modified the hosts file to access the company's Intranet, but an error occurred. I couldn't find the server or the DNS error. I couldn't even access the company's system one afternoon.

What is hosts? Hosts is a file in the window system directory. Its function can be large or small.

Simply put, the domain name resolution data is saved here. When you connect to the network (browse the Web page, FTP, and receive emails), the System
The IP address of the domain name to be accessed from this file. Therefore, hosts can

I. Speed up website connection
Saves the link to the DNS server, especially when the DNS server itself is not stable, the domain is saved in hosts in advance.
Name resolution will greatly speed up.
Applications: frequent websites and foreign websites

Ii. Blacklist Function
The principle is very simple. Modify the IP address corresponding to the domain name. For example, in my hosts, there is such a line "www.3721.com ".
127.0.0.1 ", so any access to 3721 actually accesses your computer, so that the browser can clear
It's much quieter.

Iii. Local website debugging
It is also used to modify domain name resolution, debug the function locally, and upload it to the network server, or download the website content.
Local browsing and debugging. Application Example: the LB forum will save you a lot of time by installing and setting it locally before uploading.

Iv. False Certificates
For example, if I want to trick yiman into a page on your website, I will do this:
1. Image your website
2. Add a trap page
3. Modify the hosts to point to the IP address on the framed page.
4. Ask the notaries to visit your website on my computer.
As long as the notaries do not ping your website domain name or forget the real IP address of your domain name, it is successful!

5. Steal your bank password or other important data
Step :........ (Why, what do you want to see ???)
Fortunately, this requires certain prerequisites. I hope such a virus or Trojan will never appear.

Hosts file storage path:
Win9x: Windows Directory
Win2k, XP: winnt \ system32 \ drivers \ etc
There will be two similar files. One file is "hosts" without a suffix, and the other is with the suffix ". Sam.
Note that "hosts" without a suffix is the active master, and ". Sam" is just an example file.

The hosts file has a certain format,
1. ";" starts with a comment.
2. The resolution line consists of three parts: <Specific Domain Name> <several spaces or tabs> <IP address>
Take a closer look at what has been written in the hosts file, which will help you.
It is a file in plain text format. It can be opened and edited in notepad or another text editor.

If you want to be lazy, please download this tool: http://www.aoeiuv.com/www/goodtool/hosts.rar
(185 K)

In fact, you can ignore or ignore the above content. What the password really needs to write is the following:

Summary:
I. More things should be known.
2. Do not trust what you see, especially what others want you to see.
3. Do not enter important data on untrusted computers
4. Check the bank balance on a regular basis-but in a trusted place
5. Check the first four items carefully.

Windows has a hosts file (without a suffix). in Windows 98, the file is located in the Windows directory and in the C: \ winnt \ system32 \ drivers \ etc directory in Windows2000/XP. This file is actually a plain text file, which can be opened using common text editing software such as Notepad.
Open the hosts file in Notepad. First, you can see Microsoft's description of this file. This file works according to the TCP/ipforwindows standard. Its function is to include the ing between the IP address and the host name. It is a ing between the IP address and the host name) requires that each segment can only contain one ing relationship, the IP address should be placed at the beginning of each segment, and then enter the mapped Host Name (host name ). For this section of the ing description, use "#" to separate and then use text description.
Now let's take a look at how hosts works in windows.
We know that to access a website on the network, we must first resolve the network domain name (www.xxxx.com) to the IP address of 61. XXX through the DNS server, and then our computer can access the website. For each domain name request, we need to wait for the Domain Name Server to return IP information after resolution, so that the network access efficiency will be reduced, and the hosts file can improve the resolution efficiency. According to Windows System regulations, before a DNS request is made, Windows system will first check whether there is this address ing in its hosts file. If so, this IP address ing is called, if no domain name resolution is provided to a known DNS server. That is to say, the request level of hosts is higher than that of DNS.
What is the role of the hosts file in actual use?
1. Accelerate domain name resolution
For websites that require frequent access, we can configure the ing between the domain name and IP address in hosts, so that when we enter the domain name computer, we can quickly resolve the IP address, instead of requesting DNS servers on the network.
2. Facilitate LAN users
In the LAN of many organizations, servers are provided for users. However, because DNS servers are rarely set up in Lan, it is quite troublesome for many people to access these services to enter hard-to-remember IP addresses. Now we can give these servers an easy-to-remember name, and then create an IP ing in hosts. In this way, we can enter the name of this server for future access.
3. Website Blocking
Many websites install various plug-ins on your computer without your consent. Some may be Trojans or viruses. For these websites, we can use hosts to map the Domain Name of the website to the wrong IP address or the IP address of our computer, so that no access is required. We will write the following content in hosts:
127.0.0.1 # blocked website
0.0.0.0 # blocked website
In this way, the computer resolves the domain name to the local machine or the wrong IP address, to achieve the purpose of blocking.
4. Smooth system connection
For Lotus servers and some database servers, if you enter an IP address directly during access, it cannot be accessed. You can only enter the server name to access the server. Then we configure the hosts file so that the server name can be successfully connected.
Finally, it should be pointed out that the hosting configured in the hosts file is static. If the computer on the network changes, update the IP address in time; otherwise, the IP address cannot be accessed.

Modify the hosts file in windows and add fixed DNS resolution

If you need to add the ing between the domain name and IP address, you can modify it in the following places.

Open the system directory: C:/Windows/system32/Drivers/etc. Find the hosts file, open the hosts file, and add a record at the end.

For example:

127.0.0.1 www.163.com

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.