Current location - Music Encyclopedia - Chinese History - Host details daquan

Hosts is a system file without extension, which can be opened with Notepad and other tools. Its function is to establish an associated "database" between some commonly used w

Host details daquan

Hosts is a system file without extension, which can be opened with Notepad and other tools. Its function is to establish an associated "database" between some commonly used w

Host details daquan

Hosts is a system file without extension, which can be opened with Notepad and other tools. Its function is to establish an associated "database" between some commonly used website domain names and their corresponding IP addresses. When the user enters the website that needs to log in in the browser, the system will automatically find the corresponding IP address from the Hosts file first. Once found, the system will immediately open the corresponding web page. If it is not found, the system will submit the website to DNS domain name resolution server for IP address resolution.

It should be noted that the mapping of the host file configuration is static. If the computer on the network changes, please update the IP address in time, otherwise it will be inaccessible.

Mbth: hosts feature: read-only file without extension; System file opening tool: Notepad and other functions: history and working principle, storage location, file content, specific functions, file modification, file update, etc. Establish a "database" between the website domain name and the corresponding IP. History and Working Principle Before the introduction of DNS (Domain Name System), the hosts in the network mapped easily memorized domain names into IP addresses and stored them in a shared static file hosts, and then the hosts file realized the management of domain names in the network. At first, Inter was very small. Only by using this centrally managed file can we provide domain name publishing and downloading for sites and hosts connected to Inter through FTP. Each Inter site will periodically update its copy of the hosting file and publish an updated version of the hosting file to reflect the changes in the network. However, when the number of computers on the Internet increases rapidly, it is impossible to manage the host files of all Internet hosts through a central organization. Files will grow with time, so it will be very difficult or even impossible to maintain files in the current and updated form and distribute them to all sites, so DNS servers are produced. When a browser visits a website, it must first resolve the domain name of the website to be visited to its designated IP address through the DNS server, and then the browser can locate the website and access its data. The operating system stipulates that before making a DNS request, it is necessary to check whether there is a mapping relationship between this domain name and the ip in the Hosts file. If yes, directly access the network location specified by the IP address; if not, send a domain name resolution request to a known DNS server. That is to say, the IP resolution priority of the host is higher than DNS. Storage Location Host files have different locations in different operating systems (even different versions of Windows). The following is the directory where the hosts files are located under different systems Windows XP/2000/Vista/7/8/8.110: C: \ Windows \ System32 \ Drivers \ etc \ (XP system cannot directly replace the host with the bat batch command, so it needs to be replaced manually. Then plug or reboot the network cable to make the host take effect) (You can change the \ HKEY _ local _ machine \ system \ current control set \ service \ tcpip \ parameter \ DataBasePath to modify the host location) Windows 95/98/Me:% Windir% \ (actually it is C:\ Unix-like operating systems such as Windows) and Linux: /etc/ Mac OS 9 and earlier systems: system folder: preference or system folder (file format may be different from that of WINDOWS) Linux) Mac OS X:/private// Etc (using BSD-style host AllFiles) OS/ 2 and ECOM station: "boot drive": \ mptn \ etc \ Android:/system/etc/Symbian version 1 )iPhone OS:/etc/ (jailbreak required) iPad OS:/private/etc webos:/etc file content of Windows version original host file: #? Copyright? (3)? 1993-2009? Microsoft? Company # #? This? Is it? Answer? Sample? Moderator? Documents? Used? By who? Microsoft? TCP/IP? For what? Windows. ##? This? Documents? Contain? That? Mapping? Yes? IP? Address? Where to? Moderator? Name. ? Every #? Getting started? Should? Is it? Keep? Open? Ann? Personal? Line. ? That? IP? Address? Should #? Is it? Placement? Are you online? That? First of all? Column? Being followed? By who? That? Corresponding? Moderator? Name. #? That? IP? Address? And then what? That? Moderator? Name? Should? Is it? Separated? By who? Where is it? At least? One #? Space. ##? Besides? Comments? (like this? As? These)? May? Is it? Insert? Open? Personal #? Lines? Or? Follow? That? Machine? Name? Show? By who? Answer? '#'? Symbol. ##? For what? For example: # #? 102.54.94.97? Rhino. acme? #? Source? Server number? 38.25.63. 10? x.acme? #? x? Clients? Moderator #? Local host? Name? Resolution? Is it? Deal with it? Inside? DNS? In itself. #? 127.0.0. 1? Local host #? :: 1? Localhost If you suspect that your hosts file has been modified by Trojan virus, you can copy the above contents to repair the hosts file. It is worth mentioning that # is followed by comments, so emptying the hosts file has no effect on the normal operation of the system. Specific role, understand how the Hosts file works and what role it plays in specific use. 1, speed up domain name resolution For websites that need frequent visits, we can improve the speed of domain name resolution by configuring the mapping relationship between domain name and ip in the host. Because of the mapping relationship, when we enter the domain name, the computer can quickly resolve the ip without requesting the DNS server on the network. 2. It is very convenient for users of local area network. In many LANs, there will be servers for users to use. However, because DNS servers are rarely set up in local area networks, it is necessary to enter unforgettable IP addresses when accessing these servers. This is quite troublesome for many people. You can give these servers easy-to-remember names, and then set IP mapping in Hosts, so that when you visit in the future, just enter the name of this server. 3. Prohibit websites (domain name redirection) Many websites install various plug-ins into your computer without the user's consent, some of which may be Trojans or viruses. For these websites, we can use the host to map the domain name of the website to the wrong IP or the IP of the local computer, so we don't have to visit them. In WINDOWS system, the convention 127.0.0. 1 is the IP address of the local computer, and 0.0.0 is the wrong IP address. If, in Hosts, we write the following contents: 127.0.0. 1 domain name of website A to be blocked 0.0.0 domain name of website B to be blocked. In this way, when the computer resolves domain names A and B, it will resolve to the local IP or the wrong IP, so as to achieve the purpose of banning websites A and B. 4. Smooth connection system For Lotus servers and some database servers, if you directly enter the IP address when accessing, you will not be able to access them. You can only access it by entering the server name. Then, we configure the Hosts file so that we can connect smoothly by entering the server name. 5. Virtual domain name Many times, website builders need to build a "soft environment" to upload and debug. But similar to the mail service, you need to use the domain name to assist debugging. At this time, you can use a "virtual domain name" to address the local IP address, and you can achieve the desired effect without spending. For example:

127.0.0. 1 website domain name

Then enter the corresponding website domain name in the browser address bar. File modification 1, modifying the hosts file: Generally, there is an example of opening the hosts file, which can be modified according to its format, such as the following: 127.0.0. 1 abc Modifying the format means that opening the abc website will be interpreted as 127.0. 1 In other words, some unfriendly websites or IP are banned by resolving to the local return address. Of course, adding a # before it can temporarily invalidate this line. When modifying the HOSTS file, it is often invalid after saving the modification. Here, I want to remind you that many people write in the last line. Write the last line. If you don't press enter, this line will not take effect. Be sure to get in the car. I suggest you add records according to this habit: "ip address +Tab+ domain name+line break". 2. System attribute of hosts file: Hosts file has hidden attribute by default and is invisible by default. Of course, entering this file is invisible except for directly entering the route. Solution: Turn on my computer-> Click Tools-> Folder options-> View-> Uncheck hide protected system files-> Just making sure. Cannot save after modification: Wiki host right-clicks the host file-> Attribute-> Delete read-only attribute-> Click OK to save. 3. The host computer cannot open or edit the UAC security policy: When windows VISTA or windows 7 operating system cannot open and edit, UAC security mechanism leads to prompts such as "Unable to create file" or "File operation failed". You can solve this problem by pressing the Shift key, then right-clicking the Hosts file and running it as an administrator. 4. A simple way to open the hosts file is to create a new txt file. Enter notepad "%systemroot% \ system32 \ drivers \ etc \ hosts" to save it, and change the extension to. Bat, and then double-click this bat file to automatically open the Hosts file for modification. 5. Host in five minutes. Android may need to change the specified domain name in the Hosts file to the corresponding IP address for some reasons. Android is a Linux-based system, similar to Linux, which is set by hosts file. Under Android, /etc is linked to /system/etc, and we need to modify /system/etc/hosts to realize it. But this file is read-only and cannot be modified directly through the shell. It can be modified by connecting to a PC and using adb. The steps are as follows: 1. Get root privileges: adb root 2. Setup/system reading and writing: adb reinstallation 3. Copy the host file to the PC: ADB pull/system/etc/hosts 4. Modify files on PC 5. Copy files from PC to mobile phone: adb push /system/ Etc/hosts If you want to check whether the modification is successful, you can execute adb shell on PC and run cat/system/etc/hosts; Or run cat /system/etc/hosts on your mobile phone. In Android system, the format of hosts file is different from PC Linux: one IP cannot correspond to multiple domain names in one line, for example,127.0.01host1.examplehost2.examplehost3.example is legal in most PC Linux systems. But not on Android, each domain name needs to be split into one line: x.x.x.xhost 1 .examplex.x.xhost2.examplex.x.xhost3.example file update1.Visit the googlecode website to get the latest file of Google hosts, which provides the latest mapping. 2. Use smarthosts.exe program to download smarthosts.exe program. After downloading, double-click this program to generate three files hosts, lists and srvlist. Note that using this program will often pop up errors. Don't worry at this time, you can try again in a few minutes.