Regarding network knowledge, I mainly talk about OSI layering, network protocols and other related knowledge. Talk about your understanding of the OSI seven-layer model and the TCP/IP four-layer model?The so-called seven-layer model and four-layer model are hierarchical structures designed by our predecessors to enhance universality and compatibility. Each layer follows certain rules.
The TCP/IP model has four layers, which is a simplification of the OSI model:
Summary of OSI ModelThe physical layer connects computers through physical means, the data link layer encapsulates and encodes the bit stream, the network layer establishes host-to-host communication, the transport layer establishes port-to-port communication, the presentation layer handles data encoding and conversion, and the application layer is ultimately responsible for establishing connections, converting data formats, and presenting them to users. In the OSI seven-layer reference model, what protocols are there in each layer?
How to know if two machines are connected?To determine whether two machines are connected, we know from the OSI model above that we only need to implement it at the IP layer. The IP layer is used to implement communication between the two machines. We also know from the above that there are IP protocols, IPX protocols, etc. Regarding the IP layer, as long as we know some commands that implement the IP layer protocol, we can know how to use commands to know whether the two machines are connected. How to know whether two machines are connected? We can use ping or traceroute command. Ping and traceroute commands are based on ICMP protocol. Let's analyze ping and traceroute commands and ICMP protocol. Ping command: It is based on the network layer and detects the connection status between two computers by sending and receiving data packets. When a network failure occurs, we can use the ping command to estimate the fault point. If the ping command fails, then we should consider whether the hardware connection is wrong, such as whether the network card is set correctly, whether the network cable is connected, and whether the IP address is set correctly. It can also be used to measure the time it takes for a data packet to go back and forth. Use the command: Ping IP address. The ping command will print the destination server's IP address, data size, and round-trip time to the screen, as shown below: traceroute command: traceroute command is an application that makes full use of ICMP error message type, which is mainly used to trace routing information. Its implementation is to use the TTL of IP message between each machine node to increase from 1 and send UDP packets at the same time, and receive the timeout error information of ICMP packet when an error occurs. If we refer to the figure below, we can clearly describe the entire process of traceroute. Why does the tracerouter send ICMP when it sends UDP? Under normal circumstances, the protocol stack can reach UDP normally and return to UDP normally. However, your host is unreachable, which is the IP layer (not yet UDP). The IP layer, of course, only knows to return ICMP. ICMP ProtocolICMP is the abbreviation of Internet Control Message Protocol. It is one of the core protocols of the Internet protocol suite. It sends control messages in the IP layer and provides feedback on various problems that may occur in the communication environment. Through this information, network administrators can diagnose the problems sent and take appropriate measures to solve the problems. ICMP itself is a protocol of the network layer, but its message is not sent directly to the data link layer, but encapsulated in IP data packets and then sent to the data link layer. ICMP's error and control information transmission is only to solve the unreliable problem that IP may have. It cannot exist independently of IP, so it should be regarded as a part of IP and belong to the IP system. ICMP protocol messageProtocol message The meaning of each field in the ICMP message is as follows:
ICMP message types are divided into query messages and error control messages: ICMP message type | type value | description ICMP code type: Code | Meaning Now that we know the ICMP protocol messages, let's look at the entire transmission process of the ICMP protocol implemented by the ping command. ICMP is an upper layer protocol of IP, but ICMP also shares some of the functions of IP. The following is a diagram of the implementation of the ICMP protocol. |
<<: How to design a distributed ID generator?
>>: The social app that once had 500 million users is about to be shut down
BuyVM is a foreign hosting company founded in 201...
【51CTO.com Quick Translation】 The failure of smar...
Enterprise IT leaders have heard a lot about edge...
Today, Huawei Software Development Cloud entered ...
2019 can be called the year of naked swimming for...
IPv6 certification assesses products, networks an...
5G technology is being rolled out in many countri...
Recently, LoRaWAN was officially approved by the ...
Recently, VIAVI Solutions, a provider of communic...
Before we dive into the ways drones can make the ...
[51CTO.com original article] On April 25, Huawei ...
RAKsmart's year-end discount is coming. In ad...
We are witnessing a massive transformation in the...
[[430598]] The shopping festival is here. If you ...
Today, the rapidly developing IoT devices can rea...