This is not a new article, but I encountered this problem some time ago due to work requirements.
We have set up a website. For some reason, we can only access the website through the computer name (host name), but not through the IP address.
In some cases, users in our LAN are accessible, but some users are not. For this reason, I checked some information and found the solution. Originally, there was a file named hosts in the C: \ windows \ system32 \ drivers \ etc directory. The content is as follows: 1 # Copyright (c) 1993-1999 Microsoft Corp.
2 #
3 # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
4 #
5 # This file contains the mappings of IP addresses to host names. Each
6 # entry shoshould be kept on an individual line. The IP address shold
7 # be placed in the first column followed by the corresponding host name.
8 # The IP address and the host name shocould be separated by at least one
9 # space.
10 #
11 # Additionally, comments (such as these) may be inserted on individual
12 # lines or following the machine name denoted by a' # 'symbol.
13 #
14 # For example:
15 #
16 #102.54.94.97 rhino.acme.com # source server
17 #38.25.63.10 x.acme.com # x client host
18
19127.0.0.1 localhost
We can see that 127.0.0.1 localhost. In the last line is the IP address, followed by the host name corresponding to this IP address. Therefore, access to 127.0.0.1 and localhost are both local hosts.
Now, we add a line later: 1211.143.112. * techserver
Now we can access the host with the IP address 211.143.112. * Through the host name techserver.