A computer network that connects people to people

The original purpose of computer networks was to connect individual computers together to form a more powerful computing environment. In short, to increase productivity. From batch processing era to computer network era, there is no doubt that embodies this purpose. Now, however, there seems to be a subtle change. One of the primary purposes of modern computer networks is to connect people. People around the world can connect, communicate and exchange ideas through the Internet. In the field of computer networks and information communication, the word “protocol” is often mentioned. Typical protocols commonly used in the Internet include IP, TCP, HTTP, etc., and protocols commonly used in LAN (Local area network) include IPX/SPX, etc. “Computer Network Architecture” systematically summarizes these network protocols. TCP/IP is a combination of PROTOCOLS such as IP, TCP, and HTTP. Many devices now support TCP/IP. In addition, there are many other types of network architectures. Examples include Novell’s IPX/SPX, Apple’s AppleTalk(apple only), IBM’s SNA for building large-scale networks, and DECnet, formerly developed by DEC.

Network architecture agreement The main purpose
TCP/IP IP, ICMP, TCP, UDP, HTTP, TELNET, SNMP, SMTP….. Internet, LAN
IPX/SPX The IPX, SPX, NPC… Personal Computer LAN
AppleTalk DDP, RTMP, AEP, ATP, ZIP Lans for apple’s existing products
OSI FTAM, MOTIS, VT,
XNS IDP, SPP, PEP….. Xerox Corporation Network

Two CPU and OS

The CPU is also called the central processing unit. Like the heart of a computer, it actually schedules and executes every program. CPU performance also largely determines the processing performance of a computer. So it’s often said that the history of computing is really the history of the CPU. At present, people commonly use the CPU Intel Core, Intela Tom and ARM Cortex products OS translation operating system, is a kind of basic software. It integrates CPU management, memory management, computer peripheral device management and program running management and other important functions. Usually, a CPU can only run one program at a time. In order to make multiple programs run at the same time, the operating system uses the CPU time slice rotation mechanism to switch between multiple programs and schedule them reasonably. This approach is called multi-tasking.

Layer of agreement

The OSI reference model divides the necessary functions in communication protocols into seven layers. Through these layers, the more complex network protocols are simplified. In this model, each layer receives specific services provided by the layer below it and is responsible for providing specific services to the layer above it. The conventions by which the upper and lower layers interact are called interfaces. The conventions followed by interactions between the same layers are called “protocols.” Protocol layering is like modular development in computer software. The OSI reference model’s recommendations are idealistic. He wants to implement modules from layer 1 to layer 7 and combine them for network communication. Layering allows each layer to be used independently, so that changes in some layers of the system do not affect the entire system. So you can build a system that is both scalable and flexible. Layers can be used to subdivide communication functions, make it easier to implement each layer’s protocol separately, and define the specific responsibilities and obligations of each layer. These are the advantages of layering. The disadvantage of layering may be that it is too modular, the processing becomes heavier and each module has to implement similar processing logic

Four OSI reference models

The OSI reference model organizes such a complex protocol into seven easy-to-understand layers

Hierarchical name function
The application layer Provides services to the application and specifies the details related to communication within the application
The presentation layer Convert information processed by the application layer into a format suitable for network transmission, or convert data from the next layer into a format that can be processed by the upper layer. Therefore, it is mainly responsible for data format conversion. To be specific, it is to capture the inherent data of the device into the network standard transmission format. Different devices may interpret the same bit stream differently. Thus, keeping them in line is the primary role of this layer
The session layer Responsible for establishing and disconnecting communication connections (logical paths through which data flows) and data segmentation and other data transfer related management
The transport layer Plays the role of reliable transmission, only in the communication of both nodes for processing, without processing on the router
The network layer Transfer the data to the destination address. The destination address can be an address that multiple networks connect to through a router. This layer is therefore responsible for addressing and routing
Data link layer Responsible for physical layer interconnection and communication transmission between nodes. For example, communication between two nodes connected to an Ethernet
The physical layer Responsible for 0, 1 nasal discharge and the high and low voltage, light flashing between the exchange

The relationship between the network layer and the transport layer: In different network architectures, the network layer can not guarantee the data reachability sometimes. For example, in the IP protocol equivalent to the TCP\IP network layer, there is no guarantee that data will be sent to the peer address. Therefore, problems such as data loss and order disorder may occur during data transmission. In such a network layer without reliable transmission requirements, there can be a transport layer responsible for providing the “correct transmission of data processing” in TCP/IP, the network layer and the transport layer cooperate to ensure that packets can be sent around the world, to achieve reliable transmission.

5 OSI in TCP/IP

Literally, one might think that TCP/IP refers to both TCP and IP protocols. In practice, there are sometimes two kinds of agreements. In many cases, however, it simply refers to the group of protocols that IP must use to communicate. Specifically, IP or ICMP, TCP and UDP, HTTP, and so on are all TCP/IP protocols. They are closely related to TCP or IP and are an integral part of the Internet. The term TCP/IP refers generally to these protocols, so TCP/IP is sometimes called the international protocol family.

The role of the layers in the OSI reference model that we wrote about above, the various protocols that have existed since the birth of TCP/IP can also be applied to the OSI reference model. The following figure

5.1 Hardware (Physical Layer)

At the bottom of TCP/IP is the hardware responsible for data transfer. This hardware is equivalent to physical layer devices such as Ethernet or telephone lines. There has never been a unified definition of his content. As long as people use different transmission media in the physical layer, the broadband, reliability, security and delay of the network will be different, and there is no established standard in these aspects. All in all, TCP/IP is a protocol proposed on the premise that interconnected devices can communicate with each other.

5.2 Network Interface Layer (Data Link Layer)

The network interface layer uses the data link layer in Ethernet to communicate, and therefore belongs to the interface layer. That said, it’s ok to think of it as the “driver” for the NIC. Drivers are software that acts as a bridge between the operating system and hardware. Peripheral add-ons or expansion cards that are not plugged into a computer or its expansion slot and ready for immediate use need responsive driver support. For example, if you change a NIC, you need hardware and software to put it into use. Therefore, people often need to install some driver software on top of the operating system to use these additional hardware.

5.3 Internet Layer (Network Layer)

The Internet layer uses the IP protocol, which is equivalent to layer 3 network layer in the OSI model. IP protocol forwards subcontracted data based on IP addresses. The functions of the Internet layer and transport layer in the TCP/IP protocol layer are usually provided by the operating system. Routers, in particular, must be able to forward packets of packets across the Internet layer. In addition, all hosts and routers connected to the Internet must realize IP function. Other network devices connected to the Internet do not necessarily implement IP or TCP functions. IP is a protocol that sends packets across networks, making them available to the entire Internet. The IP protocol allows data to be sent to the other side of the globe, during which time it uses the IP address as the host’s identity. IP also hides the functionality of the data link layer. Hosts that communicate with each other through IP can communicate regardless of the underlying data link. Although IP is also a protocol of packet switching, it does not have a retransmission mechanism. The packet is not retransmitted even if it fails to reach the peer host. Therefore, it is an unreliable transport protocol

5.4 the transport layer

The transport layer of TCP/IP has two representative protocols. The functionality of this layer itself is similar to that of the transport layer in the OSI reference model. The transport layer’s primary function is to enable communication between applications. Inside a computer, more than one program is usually running at the same time. To do this, you must distinguish which programs are communicating with which programs. What identifies these applications is the port number

  • TCP TCP is a transport-layer protocol for links. It ensures reachable communication between hosts at both ends. TCP correctly handles packet loss and transmission sequence disorder during transmission. In addition, TCP can effectively use broadband and alleviate network congestion. However, in order to establish and disconnect, it sometimes needs to send and receive packets at least 7 times, resulting in a waste of network traffic. In addition, to improve network utilization, TCP defines a variety of complex specifications, so it is not suitable for use in video conferences.
  • UDP Different from TCP, UDP is a connectionless transport layer protocol. UDP does not care whether the peer end receives transmitted data. To check whether the peer end receives packet packets or is connected to the network, you need to implement this protocol in the application program. UDP is commonly used in multimedia fields such as multicast, multicast, and video communication with less packet data.
5.5 Application Layer (Layer Above the Session Layer)

TCP/IP layered, the OSI reference model of the session layer, presentation layer and application layer functions are implemented in the application. Sometimes these functions are implemented by a single program, sometimes by multiple programs. Therefore, a close look at TCP/IP application functionality is realized. It not only implements the application layer content of the OSI model, but also implements the session layer and presentation layer functions. The architecture of TCP/IP applications overwhelmingly belongs to the client/server model. The program that provides the service is called the server, and the program that receives the service is called the client. In this communication mode, the service provider is pre-deployed on the host, waiting to receive any request that the client may send at any moment. The client can send a request to the server at any time. Sometimes, the server may handle exceptions or overloads. In this case, the client can resend the request after waiting for a while. The protocol used for communication between the browser and the server is HTTP. The main format of the data transferred is HTML. HTTP in the WWW belongs to the OSI application layer protocol, while HTML belongs to the presentation layer.

TCP layered model and communication example.

What if TCP/IP is transmitted over the medium

6.1 Packet Header

Each layer appends a header to the data being sent, which contains information necessary for the layer, such as the destination address to be sent and protocol-related information. Typically, the information supplied to the protocol is the packet header, and the content to be sent is data. As shown in the figure, from the point of view of the next layer, all packets received from the previous layer are considered as data of this layer.

6.2 Starting Data Packets

In terms of TCP/IP communication, party A sends an email to Party B. We used this example to reduce the price of a TCP/IP communication process.

  • ① The application process starts the application to create a new message, and then click the send button to start TCP/IP communication. First, the application does the coding. After the encoding is transformed, the application establishes a TCP/IP link at the moment the email is sent and uses this TCP link to send data. Her process starts by sending the application’s data to the next layer of TCP, then doing the actual forwarding.
  • TCP is responsible for establishing links, sending data and disconnecting links according to the instructions of the application. TCP provides reliable transmission of data sent from the application layer to the peer end. To implement the TCP function, attach a TCP header to the data front end of the application layer. The TCP header contains the source port number, destination port number, sequence number, and checksum. The packet with the TCP header attached is then sent to the IP
  • (3) IP module processing IP TCP transmitted from the TCP head and TCP data together as their own data, and in the TCP head in front of their OWN IP head. Therefore, the IP header in an IP packet is followed by the TCP header, followed by the application data header and the data itself. The IP header contains the IP address of the receiver and the IP address of the sender. Following the IP header is information to determine whether the data following it is TCP or UDP. After an IP packet is generated, the route or host that accepts the IP packet is determined by referring to the routing control table. IP packets are then sent to drivers that link these routers or host network interfaces to actually send data. If you do not know the MAC address of the receiving end, you can use ARP to search for the MAC address of the receiving end. Once you know the MAC address of the receiving end, you can send the MAC address and IP address to the Ethernet driver for data transmission
  • (4) The network interface processes IP packets transmitted from IP, which are nothing more than data for Ethernet drivers. Attach an Ethernet header to the data and send it. The Ethernet header contains the MAC address of the receiver, the MAC address of the sender, and the protocol that identifies the Ethernet type of data. The Ethernet packets generated based on the above information are transmitted to the receiving end through the physical layer. The FCS in the send process is calculated by the hardware and added to the end of the packet. The purpose of setting up FCS is to determine whether packets are corrupted due to noise.

6.3 Packets passing through data Links

The flow of packets through an Ethernet data link is similar to the figure above, but it simplifies the header of each packet. As packets flow, Ethernet headers, IP packet headers, TCP packet headers, and application headers and data are attached from front to back. An Ethernet packet tail is appended to the end of the packet. Each packet header contains at least two bits of information: the sender and receiver, and the protocol type of the upper layer. As each protocol layer passes, there must be information that identifies the sender and receiver of the packet. Ethernet uses MAC addresses, IP uses IP addresses, and TCP/UDP uses port numbers to identify hosts at both ends. Even within an application, information like an E-mail address is an address identifier. The address information is attached to the packet header of each protocol through each layer. In addition, the packet header of each layer also contains an identification bit, which is used to identify the type of the protocol at the next layer. For example, the Ethernet type in the packet header of Ethernet, the protocol type in IP, and the port number of the two ports in TCP/UDP all play the role of identifying the protocol type.

6.4 Receiving and processing data packets

The packet receiving process is the reverse of the packet sending process

  • ⑤ After receiving the Ethernet packet, the network interface processing host firstly finds the MAC address from the Ethernet packet header to determine whether the packet is destined for itself. If the received packet is destined for itself, the host searches the type domain in the Ethernet packet header to determine the data transmitted by the Ethernet protocol. The data type in this case is obviously an IP packet, since the data is then passed to the subroutine that processes the IP.
  • ⑥ PROCESSING of the IP module The IP module performs similar processing after receiving the IP packet header and the following data part. If the IP address in the packet header matches its own IP address, the device accepts the data and searches for the protocol at the upper layer. If the upper layer is TCP, the part after the IP packet head is transmitted to TCP for processing. If it is UDP, the IP packet header is forwarded to UDP for processing. In the case of a router, the address of the receiving end is usually not its own address. In this case, you need to use the routing control table to investigate the host or router that should be sent before forwarding the data
  • In the TCP module, the checksum will be calculated first to determine whether the data is damaged. Finally check whether data is received according to serial number. Finally, check the port number to determine the specific application. After the data is received, the receiver sends a “acknowledgement receipt” to the sender. After the data is received in its entirety, it is passed to the application identified by the port number.
  • The receiving application will directly receive the data sent by the sender. By parsing the data, the recipient address of the mail can be obtained as b’s address. If host B does not have an email address for host B, then host B returns an “invalid address” error message to the sender. But in this example, host B happens to have host B’s inbox on host B, so host B and recipient B can receive the body of the E-mail. The mail will be saved to the local hard drive. If the save works, the receiver will return a “processing ok” receipt to the sender. On the other hand, if the disk is full or the mail fails to be saved, an acknowledgement receipt is sent to the sender to handle exceptions.