In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "sample analysis of the conversion of public network IP, intranet IP and NAT in the Internet". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and study the "sample analysis of public network IP, intranet IP and NAT conversion in the Internet".
1. Introduction
Programmers engaged in the development of network communication applications may often hear the external network IP (Internet IP address) and the internal network IP (LAN IP address), but what is the difference between them? What does it matter? In addition, insiders all know that when it comes to external network IP and intranet IP, we have to mention such things as NAT route translation. What the heck are these? In this article, we will briefly talk about what is going on.
2. Does every computer have to have a public network IP?
Answer: no.
As we all know, the number of IP addresses in IPv4 is limited (so we are all working on IPv6 now). Allocating some addresses each time means that fewer IP addresses can be allocated, and with the rapid development of mobile phones, computers, etc., if every mobile phone or computer requires an IP address, then obviously IP address is not enough.
In order to solve this problem, we can adopt this strategy: for example, for a company, each company will have its own intranet (also known as local area network).
The internal network (scientific name should be called local area network (Local Area Network,LAN)) is within a local geographical range, which can be within a few meters (such as home intranet) or within a few kilometers (such as a university intranet). It is a computer communication network that connects all kinds of computers, external devices and databases.
2. The main functions of private network are as follows:
1) shared transmission channel: simply understood that each computer does not need an external network IP address; 2) High transmission rate: computers between intranets do not have the complexity of the external network topology, so the network that communicates with each other can be very fast. For example, it may take only a few seconds to copy a few gigabytes of file from one computer to another. 3) low bit error rate: because the communication distance is very close, the bit error rate is very low, in other words, the network is very stable. (older programmers all know that when they were in college, they almost never encountered network outages or stutters when they played Cmax S games on the same dormitory intranet, unless someone played porn or unplugged the network, ).
3. How does the company's intranet IP address allocation and management?
Suppose we assign an IP=192.168.1.1 to this company A. Let's use this IP as the gateway of the company's intranet. There are three computers in the intranet of Company A. if these three computers want to access the Internet, we need to assign him an IP, then as mentioned in the previous section: do we have to apply for three IP addresses to use?
Answer no. We do not necessarily need to apply for three IP, in our intranet, we can specify our own rules, for example, we can assign three IP to these three computers at will (please note that these three IP are not applied for, and I assign them at will). Respectively assign computer A = 192.168.1.2 computer B = 192.168.1.3 computer C = 192.168.1.4.
This rule can be managed by our private network gateway, as follows:
4. NAT technology: to realize the ability of intranet computers to access extranets.
If computer A wants to visit Baidu, we assume that the IP of Baidu is 172.168.30.3: we all know that the IP of computer An is made up by us. In fact, there may not be such an IP. If you use the IP of computer A to visit Baidu, it certainly won't work.
We also know that since Baidu and computer An are not in the same local area network, if A wants to access Baidu, it has to go through the gateway. The IP address of the gateway is real and can be accessed by Baidu.
In order to allow A to access Baidu, then we can take this approach: let the gateway to help An access, and then Baidu pass the result to the gateway, and the gateway then pass the result to A, so it can be solved?
However, computers A, B, C may ask the gateway to help visit Baidu, and the destination IP returned by Baidu is the IP=192.168.1.1 of the gateway. So how can the gateway tell whether the result is A, B or C?
When we visit Baidu, don't we need to specify a port? As long as we map the IP+ port of A to the IP+ port of the gateway, can we uniquely determine the identity?
For example, A uses port 60 to access Baidu, and the gateway maps IP+ port 60 of A to IP+ port 80 of the gateway.
After Baidu returns the result to port 80 of the gateway, the gateway can return the result to port 60 of A through the mapping table. If B also uses port 60 to access Baidu, it is the same, it can be mapped to port 90.
This method of address mapping translation, we also call it network address translation, English for Network Address Translation, referred to as NAT.
And IP addresses like A, B, C are also called intranet IP, that is, intranet IP; and IP like gateway, Baidu, we call it extranet IP (that is, Internet public network IP).
Therefore, a typical principle of private network access to public network can be realized like the following figure: now you know the public network IP and the private network IP, right?
The above is all the contents of this article entitled "sample Analysis of Public Network IP, Intranet IP and NAT conversion in the Internet". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.