What is the difference between IPV4 and IPV6, public IP and private IP?

1. What is an IP address?

1.1. Background

Data from one computer can be stored directly on the hard drive of your own computer. If you use two computers, you can use a network cable to connect them to achieve the purpose of real-time transmission of data. However, when you need to use multiple computers to work together to improve efficiency, then it is obvious that the network cable Quantity is simply not enough, hence 交换机the need for this.

image.png

1.2. Switch

Definition : Switch means "switch" and is a network device used for forwarding electrical (optical) signals. It can provide an exclusive electrical signal path for any two network nodes connected to the switch . The most common switch is an Ethernet switch. Other common ones include telephone voice switches, fiber optic switches, etc.

A network switch is a device that expands the network and can provide more connection ports in a subnetwork to connect more computers.
The above comes from the switch Baidu Encyclopedia

The emergence of the switch (Switch) allows 不再是点对点the connection of computers, but each computer is connected to the switch, and the switch distributes it to different devices.
image.png

点对点连接: Which computer you want to transfer data to, just use the corresponding interface to transfer, and the data will definitely be transferred to the target host.

When all computers are connected to the switch, the data sent from the computers to the switch does not know which computer to send the data to? It's like a mail package without a clear address, so it 数字虚拟地址(IP地址)appears.
image.png
When the computer sends data to the switch, it brings the IP address of the target host, and the switch knows how to send it.

1.3. LAN

When a bunch of computers + a switch form a small interactive network, it is called 局域网.

image.png

When joining a new LAN. For two LANs to communicate with each other, two LAN switches are required 点对点连接.
image.png
If we continue to develop, when a bunch of switches need to be connected, the number of point-to-point connections between switches will obviously be very large. There will also be too many interfaces and cables, and new switches will be connected between switches.
image.png

1.4. Wide area network

With further development, there will be more and more LAN devices and more and more users. Eventually, almost all users around the world will participate in this huge network, eventually forming a super huge network 广域网.
image.png

1.5. ISP Internet Service Provider

A WAN is a local area network with a huge number of devices. It is not easy to do this. We need to build backbone servers in various important cities, and arrange branch servers in different areas, and arrange lines to every corner for us to access, which requires a lot of capital costs and later maintenance. Those who do these things ISP 互联网服务提供商are China Mobile, China Unicom and Telecom . These require high costs, so broadband requires speed limits and billing.
image.png

2、IPV4

2.1. What is IPv4?

Internet Protocol version 4 (English: Internet Protocol version 4, IPv4), also known as the fourth version of the Internet Communication Protocol, is the fourth revised version of the Internet Protocol in the development process and the first widely deployed version of this protocol.

2.2. Composition of IPV4

IPv4 is used 32位二进制(4字节)地址and therefore only in the address space 约42亿个地址. However, some addresses are reserved for special purposes, such as 专用网络(approximately 18 million addresses) and 多播地址(approximately 270 million addresses), which reduces the number of addresses that can be routed on the Internet . As addresses continue to be allocated to end users, the problem of IPv4 address exhaustion is also arising. Address structure reconstruction based on classified networks, classless inter-domain routing and NAT (Network Address Translator, Network Address Translation) significantly reduces the speed of address exhaustion. But on February 3, 2011, after the last five address blocks had been allocated to the five regional Internet registries, IANA's main address pool was exhausted.
The above comes from IPV4 Baidu Encyclopedia

QQ picture 20230919113644.png
But not all addresses can be used. See the picture below for details.
image.png

2.3. NAT network address translation

At the end of 2011, IPV4 was exhausted.
In 2020, a new address, NAT, Network Address Translation, was released in Asia-Pacific Internet Information.
The specific process is: there are 5 computers, the IPs are: 192.168.0.1, 192.168.0.2, 192.168.0.3, 192.168.0.4, 192.168.0.5. The router is connected to the WAN and performs NAT, so the router is the gateway, and the IP is 6.6.6.6, when computer A wants to access a device with IP address 8.8.8.8 on the WAN, the data packet comes out of computer A and reaches the gateway with IP address 6.6.6.6. The gateway finds that the data packet is sent to 8.8.8.8 , the IP of the data packet sent by 192.168.0.1 will be mapped to 6.6.6.6, and the mapping table will be recorded, and the data packet will be sent to 8.8.8.8 with the IP of 6.6.6.6.
In this way, the data packets sent by the five computers are converted from the original IP to 6.6.6.6 through NAT, and the data packet is sent to 8.8.8.8 with the IP of 6.6.6.6. Achieve the effect of 5 devices sharing one IP.

image.png

2.4. Port mapping

There is a problem in the above situation. When the data is transmitted from 8.8.8.8 to 6.6.6.6, I don’t know which host to send it to? This introduces 端口映射port mapping.

IP address: port number
such as: 6.6.6.6:1000

That is 在IP地址后面增加一串端口号, the gateway will use different ports to interact with the external network, and then map these ports to various devices in the LAN. When transmitting data, in addition to IP address mapping, port number mapping is also added, so that the same IP can be used to accurately transmit data to achieve PAT many-to-one mapping.
image.png
Finally, with the technical support of NAT and port mapping, IPv4 has been able to survive for many years.

3. Public IP and private IP

6.6.6.6 in the figure below is 公网IPbecause of it 可以直接用来在广域网上交互数据.

192.168.0.1, 192.168.0.2, 192.168.0.3, 192.168.0.4, 192.168.0.5 hosted under the 6.6.6.6 gateway, that is私有IP

image.png

You can apply for a public network IP from the operator, so that the IP of the optical modem connected to your home will become an address that can be accessed directly without any mapping or conversion.
image.png

4、IPv6

Due to the shortcomings of IPV4 (not enough), IPV6 appeared.

IPv6 is the abbreviation of "Internet Protocol Version 6" in English. It is the next generation IP protocol designed by the Internet Engineering Task Force (IETF) to replace IPv4. Its number of addresses is claimed to be enough for everyone in the world. Make up an address with a grain of sand.
The above comes from IPV6 Baidu Encyclopedia

IPv6 is composed of 8 groups of four-digit hexadecimal numbers. The theory is that approximately 3.4*10^38 IP addresses can be provided.
image.png

Currently, IPV6 cannot directly interoperate with IPV4, and other devices must be used for conversion and mapping.

IPV4 will one day be buried in the long river of history~
Learning resources come from Hardware Tea Talk

Guess you like

Origin blog.csdn.net/Miss_croal/article/details/133013425