Recently, I have been porting the network protocol stack. I have found a lot of information about the protocol stack. This is a summary of some professional terms and is hereby recorded for reference.
1. Several data exchange methods and features
Line switching: the concept of the source telephone system. The hardware switch enables the input and output signals. Low latency, exclusive physical line. Line, data transmission, and line release are required.
Packet Exchange: A storage and forwarding technology that does not require connection lines, but does not limit data block transmission.
Group switching: the maximum data block size is strictly limited and the throughput is high, but there are congestion, packet fragmentation and reorganization, packet loss and out-of-order
2. Packet Exchange transmission methods include virtual circuits (connection oriented) and datagram (connectionless ).
The main feature of the virtual circuit technology is that a virtual circuit must be set through virtual call before data transmission. It is suitable for long-time data exchange between two ends.
Advantages: Reliability and order keeping;
Disadvantage: If a fault exists, all data that passes through the fault point is lost.
A datagram is characterized by the absence of a connection. Each datagram carries a sink address. During transmission, the subnet routes each datagram separately and re-assembles the packet at the destination.
Advantage: If a fault exists, the fault point can be bypassed;
Disadvantage: it cannot be guaranteed to arrive in order, and the loss cannot be known immediately.
3. End-to-end and point-to-point
Point-to-point is a physical topology and a network layer (two machines are directly connected)
End-to-end is a logical link and a transport layer (logical connection is established before transmission)
Comparison of end-to-end and point-to-point advantages and disadvantages:
After an end-to-end connection is established, once the data is sent from the source end, the sender knows that the sender can certainly receive the data.
It does not require peer-to-peer entities of intermediate nodes for storage and forwarding, which is highly efficient;
The end-to-end source machine is involved in the entire transmission process, causing a serious waste of time. After the point-to-point is sent, the task is completed.
End-to-end operations cannot be performed if the peer node is not powered on or temporarily faulty; point-to-point operations can be stored and forwarded
4. Ethernet specifies a unique 48-bit binary number for each hardware network interface as the ethernet address, which is also known as the hardware address, physical address, MAC address, or L2 address. An Ethernet destination address can be a unicast address, broadcast address, or multicast address.
5. The size of the Ethernet frame is no less than 64 bytes and no greater than 1518 bytes.
6. Why do protocols need to be layered?
Network-Level Interconnection naturally requires protocol layering (separation of application software and communication software) protocol layering to simplify the problem (to solve various problems that may arise in network communication, adopt a divide-and-conquer approach)
7. Features of protocol layering
Each layer only pays attention to the details of this layer, and each layer provides services for the upper layer. Each layer communicates with the peer layer through the corresponding protocol.
8. Meaning of IP Datagram
Version: 4 bits, indicating that the current IP protocol version is 4. header Length: 4 bits, header length (measured by 32 bits). Generally, except for optional fields and corresponding filling fields, the header length is fixed, the most common header is the absence of optional fields and filling fields. The total length is 160 bits, and the header length is 5. Service type: 8 bits are used to indicate the required quality of service (QoS ). Currently, the priority and these bits are only user requirements and are not mandatory for the network. Currently, most networks do not process this. However, fields in the service class are very important, and they reserve the necessary technical means for future business development. Total Length: 16 bits, indicating the length of the sum of the header and data, in bytes. The maximum length of an IP group is 65535. ID: 16 bits. It is a counter used to generate a packet ID. Each time the Origin Site sends a group, the ID value is + 1. Flag bit: 3bit, used to indicate and control the shard function.
9. Differences between direct and indirect routes
Direct routing is an internal route of the physical network and is part of the technical details of the physical network. There is no route in the broadcast network, but it is required in the storage and forwarding network. Indirect routing is a route on the abstract network.
In fact, indirect routes are selected between different routers and the next vro In the datagram transmission process. Physical transmission between the host and the vro, and between the vro and the vro depends on direct routing. Different routing objects, direct routing objects are physical network frames, and indirect routing objects are data units at the IP layer-IP Datagram
10 External Gateway Protocol (EGP)
If two routers belong to two different autonomous systems, they are called outer neighbors. If they belong to the same autonomous system, the Intranet-adjacent external gateway protocol is the EGP protocol used to broadcast network accessibility between the outer neighbors. The vro that uses it is called the external vro.
11. Three main functions of EGP
Access from a neighboring machine, that is, allow one vro to request another vro to agree that the two should exchange accessibility information. This is also known as a router that obtains an EGP peer or EGP neighbor. EGP peer is called adjacent when and only when they want to exchange route information, but it is not related to the distance of the geographical location. In the neighbor test, the router constantly tests whether the EGP neighbor can arrive. The EGP neighbor sends a route to update packets and periodically exchanges network accessibility information.
12. What problems should the transport layer solve?
The transport layer provides end-to-end logical communication between application processes (but the network layer provides logical communication between hosts ).
The transport layer also performs error detection on received packets. The transport layer must have two different transport protocols: connection-oriented TCP and connectionless UDP.
13. Port Functions
The role of a port is to allow various application processes at the application layer to deliver their data to the transport layer through the port, and let the transport layer know that the data in the packet segment should be delivered to the corresponding process at the application layer through the port. In this sense, the port is used to mark the process at the application layer.
14. Concept of UDP pseudo Header
The pseudo header is located before the UDP header and consists of some information in the IP header and UDP header. During verification, the pseudo-header should be included to verify whether the UDP datagram is transmitted to the correct sink. The pseudo header information is added to UDP datagram transmission, acceptor calculation, and validation. If the acceptor finds that the checksum is correct, it indicates that the UDP datagram has reached the correct port on the correct host to a certain extent. In the UDP/IP protocol stack, UDP validation and the only guarantee for data correctness.
15. Traffic Control
In connection-oriented transmission, in order to make full use of network capabilities and provide reliability, the designer proposed a solution: A sliding window protocol allows continuous transmission of several data packets without waiting for confirmation from any of them, but the number of messages sent continuously does not exceed the limit.
16. Three-way handshake:
First, it is required to number all packets connected this time. The common method is to take the nth bit of the current clock as the initial serial number. Because the serial number field has enough length, it can be absolutely guaranteed that when the serial number is returned for one week, the old packets with the same serial number have already been transmitted.
17. Four handshakes
1. the client sends a message with a fin segment to the server, indicating that the client has terminated sending. 2. after receiving the fin, the server returns an ACK message to respond to the other party. 3. the server sends a FIN packet (the previous fin serial number + 1), indicating that the server has terminated sending; 4. after receiving the fin, the client sends an ACK confirmation response to the other party;
Now, both parties have confirmed to terminate data transmission and the TCP connection is closed (four handshakes.
18. What are the characteristics of connection-oriented and connectionless services?
Connection-oriented has three stages: establish connection, data transmission, and release connection. A connection must be established before data transmission, and the connection must be released after data transmission. Data is transmitted in sequence. It is suitable for scenarios where a large number of packets must be transmitted to the same destination address within a certain period of time.
When there is no connection, the two communication entities do not need to establish a connection in advance, and communication resources can be dynamically allocated.
The advantage of No-connection is that it is flexible, convenient, and fast, but its disadvantage is that it cannot prevent packet loss, duplication, or out-of-order.
19. What are the key points of the ICMP protocol?
ICMP allows the host or router to report errors or exceptions. It also provides traffic control, route change, test whether the network entity can communicate, query the address mask, and test the route latency. An IP address is an unreliable network service protocol. It can only be transmitted "as much as possible" and may discard the datagram. ICMP allows the sender to be notified when the datagram cannot be delivered. An ICMP packet is encapsulated in an IP datagram, but it is not a high-level protocol, but still an IP layer protocol. ICMP messages are classified into error messages and ICMP inquiry messages. Redirect-redirection is the most frequently used ICMP error message. A typical use case of ICMP request packets is that the application uses echo to ping (packet Internet groper) request and return response messages to test whether the two hosts are reachable.
20. What are the main differences between IGP and EGP?
The Internal Gateway Protocol (IGP) has multiple specific protocols, such as Rip and OSPF. The external Gateway Protocol (EGP) currently uses BGP. IGP tries to make it possible to transmit data from the source station to the target station as effectively as possible in an autonomous system. There is no need to consider other strategies in an autonomous system. Compared with IGP, the size of the Internet is too large, making it very difficult to select routes between autonomous systems. It is unrealistic to find the best route between autonomous systems; policies must be taken into account when selecting routes between autonomous systems. Therefore, the Border Gateway Protocol BGP can only be used to find a good route that can reach the destination network, rather than finding the best route.
21. Try to explain why three handshakes are required when the transport connection is established. Describe what may happen if this is not done
We know that three handshakes are required to complete two important functions: Both parties must prepare for data sending (both parties know that each other is ready), and both parties must allow negotiation on the initial serial number, the serial number is sent and confirmed during the handshake. Now, only two handshakes are needed to change the three-way handshake. A deadlock may occur. For example, considering the communication between computer A and computer B, assume that B sends a connection request group to a, and a receives the group and sends a confirmation Response Group. According to the two handshakes, A considers that the connection has been successfully established and can start sending data groups. However, if B is lost in a's Response Group during transmission, it will not know whether a is ready or what serial number a recommends, B even doubts whether a has received its own connection request group. In this case, B considers that the connection has not been established successfully, and ignores any data groups sent by a and only waits for the connection to confirm the response group. When a times out, the same group is repeatedly sent. In this way, a deadlock occurs.
22. Why use TCP and UDP? Can I directly package user process data into IP datagram and send it?
No. Although the IP datagram contains a destination IP address, it is not enough to only have an IP address. The IP address can only address the destination host, but cannot address the application process on the host. A tcp or UDP packet contains a destination port. This information is necessary. With this information, data can be sent to the correct process.
23. What are the biggest advantages of the header check in the IP datagram and the data in the datagram is not verified? What are the disadvantages?
Errors in the header are more serious than errors in the data. For example, a bad address may cause the group to be delivered to the wrong host. Many hosts do not check whether the group to which they are delivered is indeed to them. They assume that the network never delivers the group that was originally going to another host to them. Data is not involved in the test and calculation, because if the data is involved in the test, the additional time overhead will be greatly increased, because the data is usually longer than the first. In addition, the high-level protocol usually performs this test on the data, and the IP layer checks the data repeatedly and redundant. Therefore, the first packet in an IP datagram can be used to speed up packet forwarding without verifying the data in the datagram. The disadvantage is that data errors cannot be detected early.
24. An important formula: RTT = A' RTT + (1-A)'m