The solution to the HOSTS setting not taking effect

        People who need to set HOSTS should know why they are used. The main purpose is to establish a domain name/ip mapping locally, instead of going to the upper-level DNS server for resolution. The specific address of the file under Windows: C:\Windows\System32\drivers\etc\hosts.

        The link operation can be established directly and the relevant information can be sent.

        It can complete the work similar to domain name resolution. For example, if you want 192.168.20.1 to have the domain name iteye.bijian.com, then you can add the line in the red box above, and the modification will take effect immediately.

        In fact, it has many functions, such as it can be used to solve the situation that the IP address of the svn library may change. Configure the hosts file, and then use the domain name to access it. If the IP of the svn library changes, you only need to modify the IP address in the hosts without relocating the svn view. If there are many svn views, it is more useful.

        In some cases, we may not be able to set HOSTS to take effect. Here is a summary of the problems encountered in the work and the solutions:

1. Double system machine

        The main reason why the set hosts does not take effect is that the set hosts are not the hosts of the current operating system. For example, the current system is installed on the D drive, and the modified hosts are modified on the C drive. The easiest way to check which disk the current system is installed on is to open a cmd command line, and the disk with the initial prompt path is the current system disk: such as C:\Documents and Settings\sina>, then the C drive is the current system disk. Or use the set command to view the system environment variables.

 

2. Due to local DNS buffering

        Because hosts is a local DNS resolution service, there is a dedicated DNS client service running in the background locally, and this service has a caching mechanism, so sometimes it may not take effect in time. This can be solved by flushing the dns cache or manually restarting the dns client service. The flush command is: ipconfig /flushdns. The method to manually restart the dns client server is: cmd--"services.msc--"find the dns cilent service-"stop--"restart

 

3. Incorrect formatting due to text formatting

        There is a certain format in the hosts file, that is, a single line of dns ip address mapping, one ip can correspond to multiple domain names, and there is at least one space or TAB key between the ip and the domain name in each line. Usually our direct input is correct, but when we copy and paste the incoming text, sometimes it does not take effect. This is caused by the problem of newlines, because the newline format of the content you copied from other terminals may be different from the newlines of windows, so it will not take effect.

        Workaround: Fill it out manually, or convert it automatically with a text editor. Such as: editplus

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326946612&siteId=291194637