Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the knowledge points of TCP/IP?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "what are the knowledge points of TCP/IP?", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "what are the knowledge points of TCP/IP" article.

Network communication protocol

Network communication protocol is mainly the regulation and standard of information transmission rate, transmission code, code structure, transmission control steps, error control and so on.

The agreement mainly consists of the following three parts:

Semantics: control information needed and actions performed

Syntax: the format and structure of exchanged data or control information

Timing: the response relationship between both parties, including speed matching and order

OSI reference model

OSI is not a specification, to be exact, an abstract reference model, and it does not provide any specific implementation standards. Most of the existing networks can be analyzed by the OSI model. Understanding the OSI model is helpful to analyze and manage the network.

OSI is a hierarchical structure with seven layers:

Introduction of TCP/IP protocol suite

The TCP/IP protocol suite was developed before the OSI reference model, so the hierarchy cannot fully correspond to the OSI model. He integrates different communication functions into different network levels, forming a four-tier architecture.

Some people also divide it into five layers and separate the link layer from the network interface layer.

Responsibilities at all levels

Network interface layer: mainly responsible for sending / receiving data packets to the network physical media. Because TCP/IP does not define the physical layer and link layer, it supports a variety of underlying network technologies and standards.

Network layer: responsible for handling IP packet transmission, routing, flow control and congestion control. The ARP/RARP protocol is used to translate IP addresses to and from the underlying physical address. IP protocol is not only the core protocol of the network layer, but also the core protocol of the whole TCP/IP protocol suite.

Transport layer: provides end-to-end communication for two hosts. The transport layer mainly includes transmission control protocol TCP (providing reliable connection-oriented transport services) and user Datagram protocol UDP (simple and efficient connectionless service). It can be selected according to the actual needs of the upper application.

Application layer: directly provides services for specific applications, such as File transfer Protocol (FTP), simple Mail transfer Protocol (SMTP), Hypertext transfer Protocol (HTTP).

Important concept

Connection-oriented and connectionless:

To communicate between two hosts through a connection-oriented protocol, you need to establish a connection between the two hosts before you can communicate. How do I establish / disconnect? This involves three handshakes and four waves. We'll talk about it later.

On the other hand, connectionless protocols do not need to establish a connection before communicating, just like sending a letter, you just need to know the destination address (please note that this is just a metaphor, e-mail is not the connectionless protocol used, because connectionless protocols are usually unreliable)

Reliable and unreliable

Reliable protocols ensure that data can be transmitted to the destination, and the content will not change. TCP is a reliable protocol.

An unreliable protocol does not guarantee that the data will be delivered to the destination, but it will do its best and verify the integrity of the data sent to the destination. UDP is an unreliable protocol.

So someone might say it? Now that there is a reliable agreement, why do you need an unreliable agreement? Isn't it superfluous? No, let's talk more about the advantages and disadvantages of TCP and UDP.

Byte flow and Datagram

The byte stream protocol indicates that the data transmitted by the sender to the receiver can be treated as a byte stream. The data sent first will be received first. TCP belongs to byte streaming protocol.

Datagram protocol transmits data one by one, out of order. UDP is a Datagram protocol.

Socket (Socket)

In the network layer, IP uses protocol numbers to specify the transport protocol, and in the transport layer, TCP/UDP uses port numbers to distinguish applications. An IP address and a port number are combined to form a socket (also known as a socket), which is used to identify unique network processes in the network.

Advantages and disadvantages of TCP and UDP

TCP:

Advantages: reliable, stable TCP reliability is reflected in the TCP before the transmission of data, there will be a three-way handshake to establish a connection, and in data transmission, there are confirmation, window, retransmission, congestion control mechanism, after the data transmission, will also disconnect to save system resources.

Disadvantages: slow, low efficiency, high occupation of system resources, easy to attack TCP before transmitting data, build a connection, which will consume time, and in data transmission, confirmation mechanism, retransmission mechanism, congestion control mechanism and so on will consume a lot of time, and to maintain all transmission connections on each device, in fact, each connection will occupy the system's CPU, memory and other hardware resources. Moreover, because TCP has confirmation mechanism and three-way handshake mechanism, TCP is easy to be used to realize DOS, DDOS, CC and other attacks.

UDP:

Advantages: faster, slightly safer than TCP UDP does not have TCP handshake, confirmation, window, retransmission, congestion control and other mechanisms, UDP is a stateless transmission protocol, so it is very fast when transmitting data. Without these mechanisms of TCP, UDP is less exploited by attackers than TCP. But UDP can not avoid attacks, such as UDP Flood attacks.

Disadvantages: unreliable, unstable because UDP does not have the reliable mechanisms of TCP, in data transmission, if the network quality is not good, it is easy to lose packets.

So, which scenarios use TCP and which scenarios use UDP?

TCP: email, remote login, etc. UDP:NDS, broadcast, instant messaging, video call and so on.

TCP's three-way handshake and four waves

Three-way handshake to establish a connection

In theory, TCP seems to need only one request and one response to establish a connection, but in practice, the request or response may be lost and need to be retransmitted to establish the connection. If you pass only one request and one response, the following problems may occur (the picture is transferred to user @ idle person Chai Mao):

To solve this problem, the "three-way handshake" when connecting can be solved effectively. (in fact, no matter how many handshakes, there is no guarantee that a channel is completely reliable, it can only show that it is available, three-way handshakes can identify each other, and the overhead is the least, so three-way handshakes are commonly used to establish connections.)

Let me draw a picture to describe the process:

Disconnect with four waves

Hierarchical analysis and troubleshooting

In a previous phone interview, the interviewer asked me: what might be the problem if no data is returned when invoking a third-party service? At that time, I replied that it was judged by the returned status code, and he did not return the supplementary status code. I was speechless for a moment. I didn't know what the interviewer wanted to examine, so I had to skip it awkwardly. (I am rather lame.)

Later, I thought that through the hierarchical analysis of the protocol suite, we can troubleshoot the fault more effectively.

There are generally two ways of investigation:

Starting at the lower layer, first check the physical layer, such as to see if the network cable is loose and damaged. This is generally used when the network has just been set up or the network cable has been adjusted. Otherwise, it will be too inefficient.

Starting from the high level, first check the application layer, such as whether the browser is configured properly, which is generally used when the network environment is relatively stable.

In order to solve the problem efficiently, in practical applications, the detection often starts from the middle layer, which seems to be a bit like the idea of binary search.

So let's go back to the first question:

If no data is returned when invoking a third-party service, what might be the problem?

1. Ping target remote computer

If successful, it means that the network is normal, you can consider higher-level things, you need to test the service or application.

If you fail, continue to 2.

2. Ping the gateway of the same subnet to confirm whether the host you are using is connected to the local network.

If successful, there is a problem with the connectivity between the local gateway and the remote destination computer, and the test route can be tracked.

If you fail, continue to 3.

3. Ping loopback address 127.0.0.1.

If successful, there is a communication problem between the local gateway and the current computer.

If it fails, check whether there is a problem with IP, if there is a problem, check whether there is a problem with the local TCP/IP protocol software, and so on.

The above is the content of this article on "what are the knowledge points of TCP/IP". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report