TCP/IP Protocol Stack Model Analysis

        The standard TCP/IP protocol is a set of protocols used for computer communication, usually called the TCP/IP protocol stack, and the Internet based on it is currently the largest computer network in the world. Because of the wide application of the Internet, TCP/IP has become the de facto network standard.

2. Correspondence between OSI seven-layer model and TCP/IP protocol model.

What is TCP/IP:

        TCP/IP is a set or system of protocols for network communication. The TCP/IP protocol model is divided into 7 layers by the OSI model. But in fact, generally what we are talking about is the four-layer TCP/IP protocol stack.

OSI seven layer model

        The OSI seven-layer protocol model is mainly: application layer (Application), presentation layer (Presentation), session layer (Session), transport layer (Transport), network layer (Network), data link layer (Data Link), physical layer ( Physical).

OSI model VSTCP/IP model

Data decapsulation process

3. What are the protocols corresponding to each layer?

Application layer:

        The application layer provides interfaces for application software, enabling applications to use network services. The application layer protocol specifies the corresponding transport layer protocol and the ports used by the transport layer.

The PDU of the application layer is called Data (data).

application layer

(Data)

HTTP 80(TCP)

Hypertext Transfer Protocol, providing web browsing services

Telnet 23(TCP)

Remote login protocol, providing remote management services

FTP 20、21(TCP)

File transfer protocol, providing Internet file resource sharing service

SMTP 25(TCP)

Simple Mail Transfer Protocol, which provides Internet e-mail services

TFTP 69(UDP)

Simple File Transfer Protocol, providing simple file transfer services

transport layer:

TCP: A connection-oriented, reliable transport layer communication protocol defined by RFC 793 of the IETF.

UDP: A simple connectionless transport layer protocol defined by RFC 768 of the IETF.

Network layer:

        The transport layer is responsible for establishing process-to-process connections between hosts, while the network layer is responsible for transferring data from one host to another.

        A PDU at the network layer is called a Packet.

The network layer, also called the Internet layer, is responsible for sending packet packets from the source host to the destination host.

The role of the network layer:

  • Provide logical addresses for devices in the network;
  • Responsible for routing and forwarding of data packets;
  • Common protocols such as IPV4, IPV6, ICMP, IGMP, etc.

data link layer:

        The data link layer is located between the network layer and the physical layer, and can provide services to protocols such as IP and IPv6 at the network layer. The PDU of the data link layer is called Frame (frame).

        Ethernet (Ethernet) is the most common data link layer protocol.

The data link layer sits between the network layer and the physical layer:

  • The data link layer provides "intra-segment communication" to the network layer;
  • Responsible for framing, physical addressing, error control and other functions;
  • Common data link layer protocols include: Ethernet, PPPoE, PPP, etc.

physical layer:

        After the data reaches the physical layer, the physical layer converts the digital signal into an optical signal, an electrical signal, or an electromagnetic wave signal according to different physical media.

        The PDU of the physical layer is called a bit stream (Bitstream).

The physical layer is at the bottom of the model:

  • Responsible for the transmission of the bit stream on the medium;
  • Specifications for physical characteristics such as cables, pins, voltages, and interfaces;
  • Common transmission media are: twisted pair, optical fiber, electromagnetic wave, etc.

4. What are the differences and application scenarios of the TCP/UDP protocol?

the difference:

1. TCP is connection-oriented , and UDP is connectionless-oriented ;

2. TCP provides reliable services. That is to say, the data transmitted through the TCP connection is error-free, not lost, not repeated, and arrives on demand; UDP does its best to deliver, that is, it does not guarantee reliable delivery. TCP achieves reliable transmission through checksum, retransmission control, serial number identification, sliding window, and confirmation response . For example, the retransmission control when the packet is lost, and the sequence control of the subpackages whose order is out of order can also be controlled.

  • TCP guarantees data correctness, UDP may lose packets
  • TCP guarantees data order, UDP does not

3. UDP has better real-time performance , and its work efficiency is higher than that of TCP. It is suitable for high-speed transmission and real-time communication or broadcast communication.

  • TCP data transmission is slow, UDP data transmission is fast

4. Each TCP connection can only be point-to-point ; UDP supports one-to-one , one-to-many , many-to-one and many-to-many interactive communications.

5. TCP has more requirements on system resources , and UDP has less requirements on system resources .

6. TCP is byte-oriented , and UDP is datagram- based .

Application Scenario

The main application scenarios of UDP:

  1. Intranet with few resources and stable network conditions , or applications that are not sensitive to packet loss , such as DHCP is based on UDP protocol.
  2. There is no need for one-to-one communication and connection establishment, but an application that can be broadcast . Because it is not connection-oriented, it can implement one-to-many, broadcast or multicast protocols.
  3. The processing speed needs to be fast , and packet loss can be tolerated , but even if the network is congested, it will not shrink back and move forward.

A few examples based on UDP

  1. Live . Live streaming has relatively high real-time requirements, and packet loss is better than freezing, so many live streaming applications implement their own video transmission protocols based on UDP
  2. Real time game . The game is also characterized by high real-time performance. In this case, using a custom and reliable UDP protocol and a custom retransmission strategy can minimize the delay and reduce the impact of network problems on the game.
  3. internet of things . On the one hand, there are few interrupt resources in the Internet of Things field, and it is possible to know a small embedded system , and the cost of maintaining the TCP protocol is too high; on the other hand, the Internet of Things has particularly high requirements for real-time . For example, Google's Nest resume Thread Group launched the Internet of Things communication protocol Thread, which is based on the UDP protocol.
  4. Many applications only support UDP, such as: multimedia data flow , do not generate any additional data, and do not retransmit even if it is known that there is a damaged packet.
  5. Video chat

The main application scenarios of TCP

  1. Applicable to scenarios that require high data transmission reliability, such as text transmission.
  2. For Internet and enterprise online client applications , data transmission performance gives way to data transmission integrity , controllability and reliability.
  3. In the scene of sending messages and file transfer , it is necessary to ensure that the sent messages are not lost.

5. Which protocols are included in the TCP/UDP protocol suite?

Protocols running on top of the TCP protocol:

  1. HTTP protocol: hypertext transfer protocol, used for ordinary browsing
  2. HTTPS protocol: secure hypertext transfer protocol, HTTP protocol in SSL coat
  3. FTP Protocol: File Transfer Protocol, used for file transfer
  4. POP3 protocol: post office protocol, used for receiving mail
  5. SMTP protocol: Simple Mail Transfer Protocol, used to send email
  6. Telent protocol: remote login protocol, log in to the network through a terminal
  7. SSH protocol: secure shell protocol, used for encrypted and secure login, replacing the poorly secure Telent protocol

Protocols running on top of the UDP protocol:

  1. DHCP protocol: dynamic host configuration protocol, dynamically configure IP address
  2. NTP protocol: Network Time Protocol, used for network time synchronization
  3. BOOTP protocol: the bootstrap protocol, the predecessor of the DHCP protocol, used for diskless workstations to obtain IP addresses from the central server

6. What is the port number corresponding to the well-known protocol?

         Addresses in data link and IP refer to MAC address and IP address respectively. The former is used to identify different computers in the same link, and the latter is used to identify interconnected hosts and routers in a TCP/IP network. There is also this concept similar to an address at the transport layer, that is, the port number. Port numbers are used to identify different applications communicating on the same computer. Therefore, it is also called program address. This problem is the port number of our commonly used protocols, mainly in the following

  • SSH service port number 22
  • FTP service port numbers 20 and 21
  • Telnet service port number 23
  • SMTP service port number 25
  • TFTP service port number 69
  • HTTP service port number 80
  • HTTPS encrypted hypertext transfer service port number 443
  • SNMP service port number 161

Build a simple and topology diagram to simply capture and analyze:

Configure the IP address as follows:

Open the WEB server HTTP service

 Then we go to use the client to access the server

 Before accessing, we open the packet capture software and capture packets on the e0/0/2 interface

 

Guess you like

Origin blog.csdn.net/zhao__b/article/details/122045247