Chapter Review:
"TCP/IP Detailed Volume 1: Agreement" 1th Chapter Overview-Reading Notes
1. Introduction
As can be seen from figure 1-4, in the TCP/IP protocol family, the link layer has three main purposes:
(1) send and receive IP datagram for IP module;
(2) send ARP request and receive ARP reply for ARP module.
(3) send Rarp request and receive Rarp reply for Rarp.
TCP/IP supports a number of different link layer protocols, depending on the hardware used by the network, such as Ethernet, Token Ring, FDDI (Fiber Distributed Data Interface), and RS-232 serial line.
2, Ethernet and IEEE 802 packages
(1) Ethernet
Ethernet is generally referred to as a standard published jointly by Digital Equipment Corp., Intel and Xerox in 1982. It is today TCP/IP using the main LAN technology , it uses a media access method called CSMA/CD , which means carrier-listening multiple access with collision detection. It has a rate of 10mb/s and an address of zero bit.
(2) IEEE 802 Package
The IEEE 802 committee publishes a slightly different set of standards, where 802.3 for the entire CSMA/CD network,802.4 for the token bus network,802.5 for the Token Ring network. The common features of these three are defined by the 802.2 Standard, which is the logical link control (LLC) shared by the 802 network.
Note: IEEE 802.2 and 802.3 define a different frame format than Ethernet.
(3) related RFC documentation
In TCP/IP, the encapsulation of an Ethernet IP datagram is defined in RFC 894 . IEEE 802 The IP datagram encapsulation of the network is defined in RFC 1042 .
Host requirements RFC requires that each Internet host is connected to a 10mb/s Ethernet cable:
1) You must be able to send and receive packets in RFC 894 (Ethernet) encapsulation format.
2) You should be able to receive a grouping of RFC 1042 (IEEE 802) encapsulation formats that are mixed with RFC 894.
3) may be able to send packets encapsulated in RFC 1042 format.
The most commonly used encapsulation format is the format defined in RFC 894. Figure 2-1 shows two different forms of encapsulation format.
Description of the two package formats:
(1) two frame formats are 48bit (6 bytes) of the destination address and source address (802.3 to allow the use of the address of the BI, but generally the three-bi address), called the hardware address . The ARP and RARP protocols map the IP address of the BI and the hardware address of the bit.
(2) in the frame format defined by the 802 standard, the length field refers to the byte length of its subsequent data, but does not include the CRC test Code. The type of Ethernet field defines the type of subsequent data.
(3) in the Ethernet frame format, the Type field is followed by the data, whereas in the 802-frame format, the following is the 3-byte 802.2 LLC and the 5-byte 802.2 SNAP.
(4) The CRC field is used for cyclic redundancy code inspection (inspection and) of subsequent byte errors within a frame.
(5)802.3 standard defined frames and Ethernet frames have a minimum length requirement. 802.3 specifies that the data portion must be at least 38 bytes, while for Ethernet it requires a minimum of 46 bytes.
3. SLIP: Serial Line IP
The full name of slip is Serial line IP. It is a simple form of encapsulating an IP datagram on a serial line. Slip is suitable for RS-232 serial ports and high-speed modems that connect to the Internet in almost every computer in the home. The following rules describe the frame format defined by the SLIP protocol:
(1) The IP datagram ends with a special character called End (0XC0). At the same time, most implementations also pass an end character at the beginning of the datagram in order to prevent line noise before the datagram arrives as a datagram content.
(2) if one of the characters in the IP message is end, then it is necessary to transfer two bytes of 0xdb and 0xdc in succession to replace it. 0xdb This special character is called the ESC character of SLI.
(3) if one of the characters in the IP message is the ESC character of slip, then it is necessary to transfer two bytes of 0xdb and 0xDD in a row to replace it.
The example in Figure 2-2 is an IP message that contains an end character and an ESC character.
Slip is a simple frame wrapping method that deserves a mention of the flaw :
(1) each end must know the other's IP address. There is no way to notify the other end of the IP address on this side.
(2) There is no type field in the data frame (similar to the Type field in Ethernet). If a serial line is used for slip, it cannot use other protocols at the same time.
(3) Slip does not add a check in the data frame and (similar to the CRC field in Ethernet). If the SLIP transmission message is affected by the line noise, errors can only be found through the upper layer protocol.
Despite these shortcomings, slip is still a widely used protocol.
4. Compressed slip
Because the rate of a serial line is usually low (19200b/s or lower), and communication is often interactive, there are many small TCP packets exchanged on the slip line. In order to transfer 1 bytes of data requires a 20-byte IP header and 20 bytes of TCP header, the total number is more than 40 bytes.
Propose a new protocol called CSLIP (compressed slip), which typically compresses the 40 bytes above to 3 or 5 bytes. It maintains up to 16 TCP connections at each end of the cslip, and knows that some of the fields in the header of each of these connections do not generally change. For those fields that have changed, most are just some small numbers and changes. These compressed headers greatly shorten the interaction response time.
5, PPP: Point-to-Point protocol
The PPP point-to-point protocol modifies all defects in the SLIP protocol. Consists of three parts:
(1) the method of encapsulating IP datagrams on a serial link. PPP supports both 8-bit and no-parity asynchronous patterns, and supports bit-oriented synchronization links.
(2) establish, configure, and test the Link Control protocol for the data link (Lcp:link control Protocol). It allows both sides of the communication to negotiate to determine the different options.
(3) Network Control Protocol (ncp:network control Protocol) system for different network layer protocols.
Figure 2-3 is the format of the PPP data frame.
(1) each frame begins and ends with a 0x7e character. followed by an address byte, the value is always 0xff, and then a control byte with a value of 0x03.
(2) Protocol field, similar to the function of Type field in Ethernet. When its value is 0x0021, the information field is an IP datagram; When the value is 0xc021, the information field is the link control data, and the value is 0x8021, which indicates that the information field is the network control data.
(3) The CRC field (or FCS, frame test sequence) is a cyclic redundancy check code to detect errors in the data frame.
(4) when the flag character 0x7e appears in the Information field, PPP needs to be escaped.
In general, PPP has the following advantages over slip :
(1) PPP supports the operation of multiple protocols on a single serial line, not just the IP protocol;
(2) each frame has cyclic redundancy test;
(3) The two sides of the communication can conduct the dynamic negotiation of IP address (using IP network Control Protocol);
(4) similar to Cslip, the TCP and IP packet header is compressed;
(5) Link Control protocol can be set for multiple data link options.
The price to pay for these benefits is to add 3 bytes at the header of each frame, to send several frames of negotiated data when the link is established, and for more complex implementations.
6. Loop-Back interface
Most products support loopback interfaces to allow client programs and server programs running on the same host to communicate over TCP/IP. Class A network number 127 is reserved for the loopback interface, most systems assign IP address 127.0.0.1 to this interface and name localhost. An IP datagram passed to the loopback interface cannot appear on any network.
Once the transport layer detects that the destination address is a loopback address, it should be possible to omit the logical operation of the partial transport layer and all network layers. However, most products still complete all the processes of the transport and network layers, but return the IP datagram to itself when it leaves the network layer. Figure 2-4 is a simple process for the loopback interface to handle IP datagrams.
Description of Figure 2-4:
(1) any data passed to the loopback address (typically 127.0.0.1) is used as an IP input.
(2) a copy of the datagram transmitted to the broadcast address or multicast address is transmitted to the loopback interface and then sent to the Ethernet. This is because the definition of broadcast delivery and multicast delivery contains the host itself.
(3) any data passed to the IP address of the host is sent to the loopback interface.
(4) the loopback interface can be viewed as another link layer below the network layer. The network layer transmits a datagram to the loopback interface as if it were passed to the other link layer, except that the loopback interface returns it to the IP input queue. as you can see from figure 2-4, IP datagrams sent to the host's own IP address generally do not appear on the appropriate network .
7, Maximum transmission Unit MTU
Ethernet and 802.3 have a limit on the length of the data frame, with a maximum value of 1500 and 1492 bytes, respectively. This feature of the link layer is called the MTU, the maximum transmission unit. Most of the different types of networks have an upper limit. If the IP layer has a datagram to pass, and the length of the data than the link layer MTU is also large, then the IP layer needs to be fragmented, the data is divided into several slices, so that each piece is less than the MTU.
8. Path MTU
When two hosts on the same network communicate with each other, the MTU of the network is very important. However, if the communication between the two hosts passes through multiple networks, then the link layer of each network may have different MTU. What is important is not the MTU value of the network on which the two hosts are located, but the minimum MTU in the two communication host paths. It is called the Path MTU.
The path MTU between the two hosts is not necessarily a constant. It depends on the route that was selected at that time. Routing is not necessarily symmetric (routes from A to B may differ from B to a), so the path MTU is not necessarily consistent in two directions .
9. Serial Line throughput calculation
If the line rate is 9600b/s, and a byte has 8bit, plus a starting bit and a stop bit, then the rate of the line is 960b/s (Bytes/sec). It takes 1066ms to transmit a 1024-byte packet at this rate. If you run an interactive application with a slip link and you run another application such as FTP to send or receive 1024 bytes of data, you generally have to wait half the time (533MS) to send the packet data for the interactive application.
For interactive applications, waiting for 533MS is unacceptable. Studies have shown that interactive response times of more than 100~200ms are considered bad, which is a round trip time when an interactive message is sent out until a response message (usually a echoing character) is received.
Note: Our calculation of the average wait time (half of the time required to transmit the maximum data frame) applies only to slip links (or PPP links) in the case of interactive communication and bulk data transfer.
"TCP/IP Detailed Volume 1: Protocol" chapter 2nd link layer-Reading notes