Unable to resolve NetBios host names across network segments. What should I do?

In the same network segment, it is no problem for users to access the hosts on the network through host names. However, if it is across network segments, it is difficult to use this method. If the client segment is Microsoft operating system, b-node is used to find the IP address of other computers according to the host name, which is a way of broadcasting information. But by default, most routers will isolate broadcast information, that is, they will not send broadcast information to other network segments to improve network performance. If all users' hosts are not in the same network segment as the hosts they want to access, they may not be able to convert their host names into IP addresses, and users will not be able to access hosts in another network segment through host names. In this case, what should I do?

First, the purpose of the LMHOSTS file If the client network segment cannot obtain the IP address corresponding to a host name from the network device, then the client will not give up so easily at this time. They will check the LMHOSTS file in this machine to see if there is an IP address corresponding to the host name in this file. LMHOSTS file is a plain text file, which can be edited with Notepad and other tools. What network administrators need to pay attention to is that there is a file that is proud of being a host. Its function is similar to that of LMHOSTS file, but there are still great differences. There is a big difference just from the order of access. Usually, when resolving a domain name, the client usually looks at the HOSTS file first to see if there is a corresponding record. If not, it will be resolved through DNS and other domain name resolution devices on the network. It can be seen that the LMHOSTS file is the last means for the client to resolve the host name. If this doesn't work, then the client will show that the network host cannot be found.

Second, the writing rules of LMHOSTS file LMHOSTS file is actually a correspondence between IP address and NETBIOS host name, so its content is relatively simple. But because this is a configuration file of network parameters, there will be strict requirements on the format. Network administrators need to remember the following rules.

First, ip addresses and host names are sequential and cannot be reversed. Usually, the IP address of the computer should be placed in the first column. The second column is the host name. If this order is out of order, if the first column is written as host name and the second column is written as IP address, the client will not be able to recognize this file.

Secondly, we need to pay attention to the handling of special symbols in the computer. When defining computer names, there are usually no strict requirements. For example, you can use uppercase letters, lowercase letters, and even space symbols to define computer names. The name XP xp is also very French. However, these hostnames with spaces need special treatment in the LMHOSTS file. Usually, if the host name contains spaces, you need to enclose the host name in double quotation marks, that is, "XP xp". Notice how many spaces there are, none. Obviously, this will be more troublesome to handle. For this reason, it is best not to use special characters or spaces when naming computers.

Third, the application of LMHOSTS file in the network In my opinion, LMHOSTS file is a good supplement to HOSTS file and DNS server. Usually, if the WINS server is not deployed in a LAN or has multiple network segments, it is undoubtedly a good choice to use the LMHOSTS file.

1. Because the user doesn't know the IP address of the computer whose host name is XP, he only knows the host name. Enter the host name of this user. Then the client operating system will be responsible for resolving this name. When the client needs to resolve the host name into an ip address, it will first check whether there is a corresponding relationship between the IP address and the host name in the NetBios name cache. If it exists, the recorded information is directly used; If it does not exist, it will be broadcast instead.

2. If the correspondence between the host name and the IP address cannot be found through broadcasting, the LMHOSTS file will be queried. If found, it will take the record and save the record information in the NetBios cache for next use. If you still can't find the corresponding record, then finally the client will prompt an error message.

From the above analysis, it can be seen that if there are multiple network segments in the enterprise network environment, it is not feasible to resolve the host name by broadcasting. At this time, LMHOSTS file is undoubtedly a better means to solve this hostname resolution problem. Network administrators only need to define the correspondence between host names and IP addresses in this file.

Fourth, use the LMHOSTS file point 1 to write some common communications into the NETBIOS cache when the system starts. From the above analysis, the network administrator can find that when the client starts, it will divide a small area in the memory to save NETBIOS information. This area is called NETBIOS cache. Usually, when a client resolves a host name, it usually looks for information from the NETBIOS cache first. If there are relevant records, they will be used directly. There is no follow-up attempt. For this reason, for some commonly used correspondence, adding their records to this cache when the system starts will undoubtedly improve the speed of hostname resolution and the efficiency of network access. For example, a network administrator has deployed a file server named Share in the network. For security reasons, please put this server in another network segment. In order to improve the access speed of the file server, the correspondence between the host name and the ip address should be automatically added to the NETBIOS cache when the client starts. This can significantly improve the efficiency of client access to the server. Although the client segment will also record this information in the NETBIOS cache after the first access, this information will be cleared from the cache after the client segment is restarted next time. Therefore, the next time you visit, you need to go through a process of hostname resolution. Therefore, in daily management, I often add the corresponding relationship between the host names and IP addresses of these file servers and print servers. Add them to the LMHOSTS file and automatically add them to the cache when the client starts. To achieve this goal, it is actually very simple. Just add #PRE after the corresponding record. When the client starts, it finds that there is a record with #PRE in the LMHOSTS file, which will be directly added to the NETBIOS cache.

2. Realize the fault-tolerant function of LMHOSTS. If this file of the client is accidentally deleted or damaged for unknown reasons, the client segment will not be able to access this file normally. What should I do at this time? For this reason, the network administrator will consider whether it is possible to provide some fault-tolerant functions for this file. When this file on the client is damaged, the client operating system can quickly obtain the required information from another file. LMHOSTS file under Microsoft operating system has actually provided similar fault-tolerant function. For example, in this file, you can add the keyword #INCLUDE followed by the file name of the path, which can provide fault tolerance for it. If the LMHOSTS file in this computer cannot be accessed or the corresponding record cannot be found, the client will access the file. In fact, the function of this keyword is that the system will automatically read the information in the file specified by this path and add this information to the local LMHOSTS file. It should be noted that when using this fault-tolerant measure, the # symbol must be added. Generally speaking, the content after the # symbol indicates comments and has no practical significance. However, if you add some special keywords after the # symbol, it will have special significance to the operating system. As mentioned above, #PRE indicates that this line of record information needs to be added to the NETBIOS cache when the operating system starts. In addition, this backup LMHOSTS file can be located in another location on this computer or in other hosts on the network. At the same time, network administrators can also deploy multiple backup LMHOSTS files. But then again, the LMHOSTS file is fine, not much. For fault tolerance, it is usually enough to specify a backup LMHOSTS file.