An overview of the content of the article
Virtual Internet
From a question at the end of the last articleVirtual Internet
The last article raised A very important question about this network topology: How does Computer A transfer data across devices to computer C?
You can actually make this small network topology bigger
In this large network topology, how computer A transfers data to computer B is the same as in the simple network topology above. This network actually has a lot ofThe pathYou can transfer data from Computer A to computer B, for example:
Computer A’s data goes through medium network, large network, medium network, small network, and then to Computer B. In addition to this path, there are many other paths that can be drawn. According to this network topology, there are many transmission paths of A. In fact, these network paths, for users, do not need to care about, that is to say, we do not care about how the network is connected, and do not care about how packets go, this is solved by the network layer. The network layer puts forward a very important concept, virtual Internet
Virtual Internet
- The actual computer network is intricate
- Different physical devices use IP to mask the differences between physical networks
- When hosts on the network are connected using the IP protocol, you do not need to pay attention to the details of the network, but only to the end-to-end connection
In other words, we don’t need to care about the complex network topology mentioned above. Just think of the middle as a virtual Internet. As shown below, Computer A is connected to A virtual Internet through the network, and computer B is also connected to the virtual Internet. Then computer A only needs to send data to the virtual Internet, which can solve the problem of data transmission and transmit it accurately to computer B. This is the concept of the virtual Internet
TCP/IP protocol
- For network layer, IP protocol is one of the most important protocols
- IP protocol turns the complex physical network into a virtual interconnected network (that is, we only need to connect terminal devices to the network, and do not need to care about the actual complex network inside).
- The IP protocol allows the network layer to mask the low-level details and focus on data forwarding at the network layer (if we look at the network layer alone, we don’t care whether the packets are transmitted to the destination computer by submarine cable or WiFi).
- IP protocol solves the problem of datagram transmission path in virtual network
It was mentioned in the last overviewThe MAC addressIt is for every network device or network cardId cardAt the data link layer, you can perform operations as long as you have the MAC addressData frameThe transmission of.The MAC address is a 48-digit hexadecimal number. We can expand the MAC address into binary format
inThe network layerThere is also the idea of an address, which is calledThe IP address. The IP address has a total of 32 bits and is generally usedDotted decimalSaid. It can also be expanded to binary format
IP addresses function similarly at the network layer as MAC addresses do at the data link layer. The IP address is the unique identity of each network device. That is, for the network layer, each network device has a unique IP address, and a unique device can be identified by this IP address
Differences between MAC addresses and IP addresses
For MAC addresses, it is unique and immutable. Because the network card moves from one place to another, the MAC address remains the same. But the IP address is different, so if our laptop is IP address A when it’s connected to WiFi at home, when we take our laptop to work or to A coffee shop, that IP address will change, so the IP address for the network device, it’s mutable. That is, if the network environment of the network device changes, the IP address will change with it
The IP address
- The LENGTH of an IP address is 32 bits, usually divided into four 8-bits
- IP addresses are usually expressed in dotted decimal notation (0~255.0~255.0~255.0~255, which can represent a maximum of 2 ^ 32 IP addresses, about 4.2 billion).
TCP/IP protocol
Before we look at THE IP protocol, let’s take a look at where it stands. At the physical layer, it transmits bits like 0 and 1. In the data link layer, data frames are transmitted, including the head and tail of frames and “frame” data, which is mainly IP datagrams. Now the IP datagram is dissected in detail. It will be divided into two parts: IP header and IP datagram data
To learn the IP protocol, the IP header is very important. The information about the IP header will be introduced in the following part. The following is the format of the IP header
As can be seen from the figure above, the IP header contains a lot of information, including version, protocol, IP address, etc. Each of the top lines is 32 bits, or 4 bytes, with the first five lines required, the sixth line optional, and the seventh line IP data. So for the IP header, it should be at least 20 bytes long
The meaning of each part in the IP header
- Version: contains four bits. The VERSION of the IP protocol must be the same as that of the communication party. Currently, the mainstream version is 4, that is, IPv4 and IPv6
- Header length: contains 4 bits. The maximum value is 15. This parameter indicates the length of the IP header, in 32-bit characters (4 bytes)
- Type of service: This is generally not a concern
- Total length: 16 bits. The maximum value is 65535. It indicates the total length of the IP datagram (IP header +IP data). The length of the data link layer, called MTU, is generally 1500 bytes. The maximum length of an IP datagram is 65535 bytes, which is larger than the MTU. If this happens, the data link layer will fragment the IP datagram, that is, break a long IP datagram into multiple frames for transmission.)
- Identifier: used internally in the protocol
- Tag: Indicates whether IP packets can be fragmented
- Slice offset: If the length of an IP packet is too long, IP packets are fragmented. An IP packet is divided into multiple data frames for transmission at the data link layer. Therefore, if split, you need to use the slice offset to record the current data frame, which offset IP data is saved
- TTL: of 8 bits, suggested that IP data packet in the network life, every device (a router or computer), TTL minus one, when TTL = 0, network devices must discard the newspaper article, it solves the network packet is that it can’t find the end, avoid network message transmission in the network infinite, to consume bandwidth)
- Protocol: 8 bits, indicating the protocol of the specific data carried by IP data (such as TCP, UDP, etc., for the corresponding values of some protocols, please refer to the following figure)
- Checksum: 16 bits to check whether there is any error in the IP header (the receiver will also check the IP header after receiving it. If there is any error, the receiver will discard it directly)
- Source IP address: IP address of the network device that sends the IP packet
- Destination IP Address: IP address of the network device to which the IP packet is destined
Values corresponding to some protocols
When data from these protocols is transmitted over IP, different values are assigned to the protocols in the IP header. You can also see that there is a value corresponding to IP protocol, that is, for IP protocol, IP protocol data can continue to encapsulate IP data, that is, IP data in IP data, in some special occasions, it also plays a role
It is the core competitiveness of a technician to seek invariance in the rapidly changing technology. Unity of knowledge and practice, theory and practice