Basic concepts of network layering (2)

table of Contents

Transport layer

TCP protocol

TCP RESET message

UDP

Application layer

DHCP

Network hardware

Difference between Hub, Switch and Router

HTTP protocol

URI sum URL


 

Transport layer

"Packet" is the data unit in TCP/IP protocol communication and transmission, generally called data packet . The TCP/IP protocol works at the network layer, transport layer, and application layer.

TCP and UDP are the two transport layer protocols in the TCP/IP protocol. They use the IP routing function to send data packets to the destination, thereby providing network services for applications and application layer protocols (HTTP, SMTP, FTP, and Telnet) .

TCP protocol

Connection-oriented and reliable data streaming. The so-called connection-oriented means that during the connection process, the TCP protocol must send confirmation information to ensure that the sent connection partner can receive it.

TCP RESET message

TCP terminates abnormally (reset packet)

The abnormal termination of TCP is relative to the process of releasing the TCP connection normally . We all know that the establishment of the TCP connection is completed through a three-way handshake, while the normal TCP connection release is completed through four waves of hands , but in some cases, There will be some unexpected situations in the process of TCP interaction, causing TCP to be unable to release the connection according to the normal four waves of hands. If the TCP connection is not released by other means at this time , the TCP connection will always exist and occupy Some resources of the system . In this case, we need to have a way to release the TCP mechanism connections, this mechanism is the TCP of reset packets. The reset packet refers to the packet with the reset position in the flag field of the TCP header , as shown in the following figure:

Common scenarios for TCP abnormal termination

In our actual working environment, there are mainly the following situations that cause a party to send a reset message:

1. The client tries to establish a TCP connection with a port that the server does not provide external services , and the server will directly send a reset message to the client .

2. If an exception occurs during the interaction between the client and the server (such as a program crash, etc.), the system of that party will send a TCP reset message to the opposite end , telling the other party to release the relevant TCP connection , as shown in the following figure:

3. The receiving end receives a TCP message, but finds that the TCP message is not in its established TCP connection list , then it sends a reset message directly to the opposite end , as shown in the following figure:

4. If one of the two interacting parties has not received the confirmation message from the other party for a long time, it will actively send a reset message to the opposite end to release the TCP connection after a certain number of retransmissions or time is exceeded , as shown in the figure below Shown:

 

5. When designing an application system, some application developers will use the reset message to quickly release the TCP connection that has completed data interaction to improve the efficiency of business interaction , as shown in the following figure:

 

Use of Reset message

1 The  security device uses the reset message to block the abnormal connection

When security devices (such as firewalls, intrusion detection systems, etc.) discover some suspicious TCP connections, they will construct reset messages between the interacting parties and send them to the opposite end, allowing the opposite end to release the TCP connection. For example, intrusion detection detects a TCP connection attacked by a hacker , and it is constructed such that the attacked end sends a reset message to the hacker host to let the hacker host release the attack connection.

Use reset messages to attack

Security devices can use reset messages to achieve the effect of security protection, and hackers and attackers can also use reset messages to invade and attack certain hosts. The most common is TCP session hijacking attacks.

UDP

It provides non-connection-oriented, unreliable data streaming. UDP protocol has great advantages over TCP in data transmission speed, and it is easier to use. A large number of applications such as DNS, FTP and other services use UDP.

Application layer

At the application layer, there are protocols such as FTP, HTTP, TELNET, SMTP, and DNS.

DHCP

It would be very tedious to set the IP address for each host one by one. Therefore, in order to achieve automatic IP address setting and unified management of IP address allocation, the DHCP (Dynamic Host Configuration Protocol) protocol was created.

DHCP (Dynamic Host Configuration Protocol, Dynamic Host Configuration Protocol) is a local area of network protocol , using UDP protocol works, there are two main purposes: to the internal network or network services automatically assign vendor IP address to the user or an internal network administrator As a means of central management of all computers .

DHCP is an application layer protocol. DHCP (Dynamic Host Configuration Protocol) is usually used in large-scale local area network environments. Its main function is to centrally manage and allocate IP addresses so that hosts in the network environment can dynamically obtain IP Address, Gateway address, DNS server address and other information, and can improve the utilization rate of the address.

Usually in the home network, the broadband router acts as this DHCP role.

Network hardware

Difference between Hub, Switch and Router

First of all, let's talk about HUB, which is the hub. Its function can be simply understood as connecting some machines to form a local area network.

The switch (also known as a switching hub) has roughly the same function as a hub. However, there is a difference in performance between the two: the hub uses a shared bandwidth working mode, while the switch is exclusive bandwidth. In this way, when there are many machines or large amounts of data, the two will be more obvious.

The router is obviously different from the above two. Its function is to connect different network segments and find the most suitable path for data transmission in the network. It can be said that under normal circumstances, individual users have little demand. The router is generated after the switch, just like the switch is generated after the hub, so the router and the switch are also connected to a certain extent, and they are not completely independent two devices. The router mainly overcomes the shortcomings that the switch cannot route and forward data packets.

The router is also called the protocol gateway, which is a transit point for the Internet interconnection. Imagine a PC server equipped with dual network cards, which is connected to the campus network and the dormitory or class LAN at the same time. All requests from dormitories or classes to access the campus network are transferred through the proxy software of this PC server. Then this PC server is called a gateway or proxy server. Of course, under normal circumstances, the network properties and network protocols used on both sides of the gateway are different, such as Ethernet on one side and point-to-point on the other. So such a proxy server is usually called a protocol gateway.

Imagine simplifying this server, removing any other functions except proxy services, putting it into a small box, and it becomes the router we know. Of course, we can load some software with functions such as information filtering into this server, so the router becomes a router with integrated firewall. Logically you can think of it as two things.

Up to now, the router has only one internal network interface and one external network interface, and only when you connect its internal network interface to a hub or so-called Ethernet switch, it can connect to multiple PCs in the LAN at the same time . Now let’s simplify it a bit and put this hub and router into a small box. So what we call home routers appeared. In fact, it is an integration of three things: from the external network to the internal network, the firewall, router, and hub are arranged in sequence.

HTTP protocol

The three WWW construction technologies are:
1. HTML (HyperText Markup Language) using SGML (Standard Generalized Markup Language) as the text markup language of the page;
2. As a document delivery protocol HTTP;
3. Specify the URL (Uniform Resource Locator) where the document is located.

URI sum URL

URI(Uniform Resource Identifier)

Uniform resource identifier, URI is the location identifier of the resource indicated by a certain protocol scheme.

Uniform

The provision of a unified format can facilitate the processing of multiple different types of resources without identifying the specified access method of the resource based on the context. Such as (http: or ftp:)

Resource

The definition of resource is "anything that can identify a point". Except for documents, images, or services that can be distinguished from other types, all can be used as resources.

URL

URL is a subset of URI. Indicates the specified URI, using absolute URI, absolute URL, and relative URL that cover all necessary information.

RFC

There are some documents used to formulate technical standards for the HTTP protocol. They are called RFCs (Request for Comments).

RFC is a design document of the Internet. Generally, applications will be implemented in compliance with the standards determined by the RFC.

Guess you like

Origin blog.csdn.net/sinat_37138973/article/details/85050566