A comprehensive introduction to linux MAC/IPV4/IPV6/Internetwork/Gateway/Bridge, TCP/IP protocol family model, TCP/IP transport layer protocol

Yuxian: CSDN content partner, CSDN new star mentor, full-stack creative star creator, 51CTO (Top celebrity + expert blogger), github open source enthusiast (go-zero source code secondary development, game back-end architecture https: https://github.com/Peakchen)

 

Linux is a free and open source Unix-like operating system. It supports a variety of network protocols, including the TCP/IP protocol family. In this answer, I will introduce MAC, IPv4, IPv6, Internet interconnection, gateways, and bridges in Linux, and provide the model of the TCP/IP protocol family, the underlying structure of the transport layer protocol, the architecture diagram, and related principles and usage scenarios a detailed description of .

MAC address

The MAC address is an address in the data link layer, which is unique and pre-assigned by the manufacturer. The MAC address is usually expressed in hexadecimal, including 48 bits, of which the first 24 bits are the manufacturer identification code, and the last 24 bits are the device identification code. In Linux, you can use the command ifconfigor ip addrto view the MAC address of a network interface.

IPv4

IPv4 is version 4 of the Internet Protocol (IP). It is a connectionless protocol used to transmit data packets on the internet. An IPv4 address is a 32-bit binary number, usually expressed as 4 decimal numbers, ranging from 0 to 255, expressed in dotted decimal notation, such as 192.168.1.1. In Linux, you can use the command ifconfigor ip addrto view the IPv4 address of a network interface.

IPv6

IPv6 is version 6 of the Internet Protocol (IP). It is the successor of IPv4 and is used to transmit data packets on the internet. An IPv6 address is a 128-bit binary number, usually expressed as eight 16-bit hexadecimal numbers separated by colons, for example, 2001:0db8:85a3:0000:0000:8a2e:0370:7334. In Linux, you can use the command ifconfigor ip addrto view the IPv6 address of a network interface.

Internet

The Internet is a global network of many interconnected computer networks. In Linux, you can use pingthe command to test connectivity to other Internet hosts. For example, to test whether you can connect to Google's IPv4 address, you can run the following command:

ping 8.8.8.8

gateway

A gateway is a device that connects two different networks, and it can transmit data packets from one network to another. In Linux, you can use routecommands to view and configure the routing table. For example, to add a default gateway, run the following command:

route add default gw 192.168.1.1

bridge

A bridge is a device used to connect multiple networks. It transfers packets of data from one network to another while allowing devices on all networks to communicate with each other. In Linux, you can use brctlcommands to configure and manage bridges. For example, to create a br0bridge named , you would run the following command:

brctl addbr br0

TCP/IP protocol family model

The TCP/IP protocol family model is a layered model, which divides the Internet protocol into four layers: application layer, transport layer, network layer and data link layer. Each tier has its unique capabilities and protocols.

  • Application layer: Responsible for handling the interaction between applications and the network, such as HTTP, FTP, SMTP, etc.
  • Transport layer: Responsible for data transmission between two hosts, such as TCP and UDP protocols.
  • Network layer: Responsible for sending data packets from the source host to the destination host, such as the IP protocol.
  • Data Link Layer: Responsible for transferring data packets from one node to another, such as the Ethernet protocol.

The underlying structure of the TCP/IP transport layer protocol

TCP/IP transport layer protocols include TCP and UDP. TCP is a reliable transport protocol, which provides the order and integrity of data packets, but it will add a certain delay. UDP is an unreliable transport protocol that does not guarantee the order and integrity of data packets, but has low latency. Both TCP and UDP use port numbers to identify applications and services.

The header structures of both TCP and UDP include information such as source port number, destination port number, sequence number, confirmation number, and window size. The TCP header also includes an optional options field.

Architecture diagram of TCP/IP protocol family

The following figure shows the architecture diagram of the TCP/IP protocol family:

+----------------------------------------+
|              应用层                     |
+----------------------------------------+
|                传输层                   |
+----------------------------------------+
|                 网络层                  |
+----------------------------------------+
|                数据链路层                |
+----------------------------------------+

Detailed explanation of usage scenarios and practical application methods

The TCP/IP protocol family is widely used in the Internet and enterprise internal networks. Here are some examples of practical applications:

  • Web browsers communicate with web servers at the application layer using the HTTP protocol.
  • Email clients communicate with mail servers at the application layer using the SMTP protocol.
  • The file transfer client uses the FTP protocol to communicate with the FTP server at the application layer.
  • VoIP clients use the RTP protocol to transmit audio data at the transport layer.
  • The remote desktop client uses the RDP protocol to transmit graphics data at the transport layer.
  • The online game client uses the UDP protocol to transmit game data at the transport layer.

Detailed description of the principle

The TCP/IP protocol family is based on a layered model, and each layer has its own unique functions and protocols. When sending data, the data starts from the application layer, passes through the transport layer, network layer, and data link layer, and finally reaches the physical layer and is sent to the network. When receiving data, the data starts from the physical layer, passes through the data link layer, network layer, transport layer and application layer, and finally passes to the application program.

The TCP protocol provides reliable data transmission, which uses acknowledgments and retransmissions to ensure the order and integrity of data packets. The UDP protocol provides unreliable data transmission, which does not guarantee the order and integrity of data packets, but has low latency.

The IP protocol is responsible for sending data packets from source hosts to destination hosts, and it uses IP addresses to identify hosts and routers. Routers are responsible for delivering packets to the correct network, which uses routing tables to determine the next hop. Every device on the network has a unique MAC address, which is used by the data link layer to transmit data packets from one node to another.

Documentation Links

Here are some links to literature on Linux networking and the TCP/IP protocol family:

Guess you like

Origin blog.csdn.net/feng1790291543/article/details/131833743