We have already introduced the tcp ip address query command in Linux. Now let's continue with the previous article. After the IP address is queried, we must have a set of methods to correspond to the IP Protocol address and entity address.
In this process, the key point is to map the IP Protocol address to the physical address. Some networks that use simple physical addresses (such as proNET-10) occupy only one byte length, and allow users to select their own physical addresses When configuring the network card.
It is relatively simple to map the IP Protocol address and the physical address on such a network. We can set the physical address to the same as the IP Protocol address. For example, if the IP address of a node is 192.168.1.17, we can set the object address to 17.
In this way, you can easily obtain the object address based on the IP Protocol address in proNET. This correspondence is very simple and easy to maintain. When a new machine is connected to the Internet, it does not need to modify or re-compile the existing data.
However, we know that on the Ethernet, each physical interface has a 48-bit (6 byte) MAC address, while IP (v4) uses a 32bit (4 byte) address) ﹔ each address format can only be used by corresponding level agreements. At this time, we cannot use a simple mathematical relationship to map IP protocol addresses to physical addresses.
Method for ing IP protocol addresses and object addresses
Create a table
First, the simplest way we think of is to create a table on each machine that corresponds to an IP Protocol address and an object address ). However, this method still cannot solve the following situation:
◆ If the number of nodes on the network is large, it is almost impossible to include all node mappings in the table.
◆ If a node changes (for example, network card replacement), it is also a headache to make correct changes to all tables.
◆ For a non-disk workstation, because there is no local storage device, there will be no more than creating a table.
Write advanced programs
In addition to creating tables, we can also write the actual network address to the high-order network program. However, as with the previous method, if the hardware address changes or other changes become emotional, the program also needs to be re-compiled.
Obviously, the above two methods are not very clever.