Network layer
—
The IP protocol belongs to the network layer of the network protocol stack. The functional goal of this layer is to transfer packets from one location in the network to another, which is the lowest level of processing end-to-end transmission. In the middle of the transfer process passes through many hop (hop) intermediate routers, so the routing algorithm is the core task of its design. (but unfortunately not the core task of this article)
Tunnel
—
When two of the same networks are separated by a different network, the tunnel is a convenient way to communicate across protocols. That is, the packet of a network into a packet of a B network, and then in the B network transmission, arrived at the destination and then taken out to obtain a network of a packet.
This new network, built on the underlying network, is called Overlay (overlay), which is an effective way to deploy new networks incrementally, such as building IPv6 networks on IPV4.
IPv4
—
IPv4 's head is like this, and the specific function of each field is not said.
It is worth noting that its source and destination addresses are 32 bits long, and now we all know that this length is not enough. In fact, the IP address in the allocation efficiency is also problematic, so that the actual situation is worse than in theory.
Sub-Network
Because the IP protocol mainly solves the problem is inter-network interconnection, and take into account the complexity of inter-network routing. Layering IP addresses is a good way to deal with them. That is, a 32-bit IP address that has the first N bits to identify a network (subnet), and a post-32-n bit to identify the hosts that belong within the network. In this way, when the router forwards the packet, only the N-bit prefixes are considered, which greatly reduces the size of the routing table. Imagine 8.8.8.8
and 8.8.8.7
if one in the United States one in China that router is going crazy.
And the value of the n can also be dynamic, the n notation can be written to indicate that the /16
first 16 bits are network segments, and the last 16 bits are host segments. A more general notation is written in a 32-bit subnet mask format. Such /16
as 255.255.0.0
a subnet mask equal to.
You can see that the subnet mask creates the possibility of a multiplexed IP address. That is, for the same IP address, different subnet masks can be labeled with different network endpoints. But because the subnet mask is just part of the routing protocol (which can look at the IP header above, does not have a subnet mask), and it may bring more complexity than simply increasing the number of IP address bits (I'm not counting, guessing), this multiplexing technology is not used to increase the available IP addresses on the public web.
Categorical addressing (classful addressing) and CIDR
Many people may have heard that the public IP address has a, B, C three of the category. This is actually a method of sub-network by different size prefix partition. Such as:
You can see the main disadvantage of this partitioning method is that the network address and host address division is too unreasonable, for most organizations, the class B address is too large and the class C is too small (contains too few hosts). Therefore cidr-classless inter Domain routing inter-class routing is actually used. Because it goes back to the category of routing algorithms, this is skipped.
Nat
So how can so few public network IP support so many internet users now? Many people may think of the answer on the router at home. Because it is what makes the actual network open.
Network Address Translation This is what you do. This function exists in each home router, he is responsible for the user packet IP address from the intranet IP (192.168.1.101) converted to a legitimate public IP, by tampering with the IP packet way.
The main problem here is, because the intranet IP and the external network IP is a 多对一
relationship, so turn the past easy, turn back difficult. Then, when the router receives the packet from the outside network, how to decide to replace the Baotou into which intranet IP? The answer is a rather bad way. Because of the two mainstream protocols of the network layer-the Transport layer-TCP and UDP occupy the bulk of the traffic on the transport layer, both of which have a field that identifies the source port and the destination port (the specific process, or port, that marks the connection object). NAT then replaces the port number, replacing it with a key in its own mapping table. Then, when the external packet is received, the TCP port number in the packet is queried in the mapping table to the IP and the real TCP port number of the intranet host and replaced.
Obviously this violates the layering principle of the network protocol stack and relies on the transport layer to use certain protocols. But before IPv6 became popular, NAT worked well.
This reliance is likely to be the reason that TCP/IP is always put together.
IPv6
—
Simply put, IPV6 and IPv4 and the difference is having a 128-bit address, as well as removing the checksum, and others.
Because of the use of tunnels, IPV6 can be deployed with great flexibility and on-demand configuration. So the key to IPv6 's popularity may be that specific needs are widely recognised in the market.
Introduction to IP Protocols