Computer Network (Fifteenth Bullet) --- Two means to solve the shortage of IP addresses

NAT is a relatively important function of routers. This technology mainly solves the problem of insufficient IP addresses. It can also be said to be a transitional technology. However, NAT technology also has many technical defects. This article mainly introduces the related concepts of NAT and NAPT. Secondly, the difference between the IPv4 protocol and the IPv6 protocol is also an important point, so it is better to know more about it.

☻NAT ​​and NAPT

NAT (Network Address Translation Technology) is an address translation technology that can convert an IP address to another IP address, and achieve the purpose of address reuse through related conversion port numbers; NAT is a transition technology to alleviate the shortage of IPv4 public network addresses. The implementation is not complicated, so it is widely used.


The main features are as follows:

  • NAT can convert private IP to global IP when communicating externally, which is a technical method to convert private IP and global IP;
  • The global IP is required to be unique, but the private IP is not required, and the appearance of the same private IP in different LANs is completely unaffected; many schools/companies set private IPs on terminals, and set global IPs on routers or necessary servers.

Technical flaws about NAT:

  • Since NAT relies on this translation table, it is impossible to establish a connection from the outside of NAT to the internal server;
  • The generation and destruction of the translation table requires additional overhead;
  • Once the NAT device in the communication device is abnormal, all TCP connections will be disconnected.

The conversion process of NAT and IP:

  • The NAT router replaces the source address from 172.68.2.101 with the global IP 202.172.202.68;
  • When the NAT router receives external data, it will replace the target IP from 202.172.202.68 to 172.68.2.101;
  • There is an automatically generated table for address translation inside the NAT router. When 172.68.2.101 asks an IP address to send data for the first time, the mapping relationship in the table will be generated.

NAPT (Network Address Port Translation) related concepts:

A school or a large company will have its own internal network. When a large number of internal network clients want to communicate with the outside world but there are few public network addresses, the gateway cannot complete the one-to-one mapping between private addresses and public network addresses; at this time, the gateway needs to combine TCP or UDP port numbers to complete the conversion of multiple internal network mappings into one public network address. This conversion method is called NAPT.

If there are multiple hosts in the LAN accessing the same external network server, and the destination IP in the data returned by the server is the same, how does the NAT router determine which LAN host to forward the data packet to?

NAPT is to solve this problem, mainly using IP + port to establish this association relationship; this association relationship is also automatically maintained by the NAT router. When a connection is established under TCP, this entry will be generated, and this entry will be deleted after the connection is disconnected.


☻☻ Two versions of the IP protocol - IPv4 and IPv6

  • IPv4 length is 32 bits to represent the IP address;
  • The length of IPv6 is 128 bits to represent the IP address; 2 to the 128th power means that it is enough to assign an IP address to every grain of sand on the earth; it fundamentally solves the problem of insufficient IP addresses. However, the popularity of IPv6 is not very high now, because the two are not compatible .

Guess you like

Origin blog.csdn.net/Onion_521257/article/details/129710647