-
Overview of network layering
The general network layer has been mentioned in the basic concept of network protocol in this article. It can be seen from this article that according to international standards, there are 7 layers, but according to our actual development, there are 4 layers in total according to TCP/IP protocol. However, in terms of academic research, it is better to start from the five layers, namely, the physical layer, data link layer, network layer, transport layer and application layer. The following paper mainly starts from these five layers. First, we will take a look at the data forms and protocols of these five layers as follows:
The serial number layered agreement Data form 5 Application Layer FTP, HTTP, SMTP, DNS, DHCP Packets and user data 4 Transport Layer TCP, UDP Segment (Segments) 3 Network Layer IP, ARP, and ICMP Packets (Packets) 2 Data Link Layer CSMA/CD, the PPP The frame (Frames) 1 Physical Layer Bit streams (Bits) -
The physical layer
The physical layer defines interface standards, cable standards, transmission rates, and transmission modes
Popular point said how we deal with broadband is usual telephone lines or fiber door, correlates is our interfaces on a router interface or gigabit interface, equipment between the transmission of signals is what such as household transmission line is of simulation model and then need a modem converts digital model and then transfer to our networking devices, optical fiber transmission is light signal, And the transmission medium that we use, whether it’s multiple channels or simplex channels, is determined by the physical layer.
To sum up: the role of the physical layer is actually to solve the communication problem between two servers, through the cable (can be optical fiber can be telephone line can be network cable (each line transmission signal is different and no transmission channel may be different) between two machines resume an ideal bitstream transmission channel
-
Data link layer
Link: A physical line (wired or wireless) from one node to an adjacent node, with no other switching nodes in the middle, as shown below:Even if it’s two links (the hub doesn’t belong to the data link layer, meaning it doesn’t process the data)
Data link: When data is transmitted over a link, a corresponding communication protocol is required to control data transmission
As mentioned above, the physical layer is to solve the communication problems of two machines, while the data link layer is to solve the correct transmission and transmission rules. In summary, it is to solve the following problems:
- First figure out who sent the packet and then who is going to receive it
- And then what happens if everybody’s sending and there’s confusion, who’s sending first and who’s sending last
- What if there is an error in the process of sending
First, let’s talk about the second problem, which is technically called multiple access. Here’s an example cited by Professor Liu Chao in his interesting article on network protocol, which is the vehicle control of the DMV. There are three solutions:
- Divided into multiple lanes, each lane one car, each go separately, this is called in the computer network channel division
- Even and odd-numbered lines are restricted. This is called a rotation protocol in computer networks
- This is called random Access protocol, and Ethernet works this way
So that’s problem number two
Before we get to the third question, the first thing to know is that at the data link layer, the data packets will be sent to the next layerEncapsulated into a frameThen each frame has a header and a tail (containing the frame start and end characters), and receives a stream of data, so it goes through thisFrame start operatorandEnd of the frameTo determine if it is a complete frame as shown below :(here is a reference to other bloggers)
There are probably several ways to solve the third problem:
- Transparent transmission (ensuring data integrity)
Use SOH as the frame start character
Use EOT as frame terminator
If EOT, SOH, ESC characters appear in the packet, all the characters will be escaped, that is, byte filling is required as shown in the following figure :(the figure here refers to other bloggers) - Error inspection
There’s a frame terminator at the end of the frameFCSLogo, and thisFCSIt is calculated by the data part plus the head, and the receiver uses the data part and the head to calculate and after receiving the informationFCSIf the comparison is inconsistent, it indicates that the packet is lost or wrong.
And then finally, the first problem, the first problem is a little bit easier and it’s going to beDestination MAC AddressandThe source MAC addressEncapsulate at the head of the frame, but if you don’t knowDestination MAC AddressAt this time, you need to send a broadcast address to find, popular point is by “roar”, ask everyone who is the IP address, your MAC address is what (also known as ARP protocol), getDestination MAC AddressThen it is encapsulated in the frame header. For example, an Ethernet frame (if the transmission technology uses Ethernet technology, the encapsulated frame is an Ethernet frame) starts with the destination MAC address and then the source MAC address as shown below:CRC is used for error checking