The first link layer has three main objectives:
(1) send and receive I p datagram for the I p module; (2) Send a R p request for the R p module and receive a R p response; (3) send the r a r p request to r a r p and receive the r a r p response.
Two Ethernet and IEEE 802 Encapsulation
Ethernet: uses a media access method called c s m a/c d, which means the carrier sense, multiple access with Collision Detection of the carrier with conflict detection ). The speed is 10 Mb/s and the address is 48 bits.
In the world of t c p/I p, The encapsulation of Ethernet I p datagram is defined in RFC 894 [Hornig 1984], IEEE 802
Network I p datagram encapsulation is defined in RFC 1042 [Postel and Renault 1988. Host Requirements R f c requirements per
All I n t e r n e t hosts are connected to a 10 Mbit/s Ethernet cable:
1) packets must be sent and received in RFC 894 (Ethernet) Encapsulation Format.
2) It should be able to receive packets in RFC 894 (IEEE 1042) Encapsulation Format mixed with RFC 802.
3) groups may be sent in RFC 1042 format. If the host can send two types of groups at the same time
The sent group must be configurable, and the default group must be RFC 894.
The most commonly used Encapsulation Format is defined in RFC 894:
Format defined by RFC 1024:
:
The standard-defined frames and Ethernet frames both have minimum length requirements. Indicates that the data part must be at least 3 8 bytes. For Ethernet, the data part must be at least 4 6 bytes. To ensure this, the padding (p a d) bytes must be inserted in the insufficient space. This minimum length will occur when you start to observe the group on the line.
RFC 893 [Leffler and Karels 1984] describes another Encapsulation Format for Ethernet, called trailer encapsulation ). This is an early test format when the B s d system was running on the DEC va x machine. It improves performance by adjusting the order of fields in the I p datagram.
Three slip Serial Line IP:
The full name of s l I p is serial line IP. It is a simple form of encapsulation of I p datagram on a serial line, which is described in RFC 1055 [romkey 1988. S l I p is applicable to the r s-2 3 3 2 serial port and high-speed modem access I n t e r n e t that almost all computers in the home.
The following rules describe the frame format defined by the s l I p protocol:
1) IP data is reported to end with a special character called e n d (0 x C 0. In addition, to prevent line noise before the arrival of the datagram from being considered as the content of the datagram, most implementations also transmit an e n d character at the beginning of the datagram (if line noise exists, then the character "e n d" will end the incorrect message. In this way, the current message can be correctly transmitted, and the content of the previous error message is discarded when it is handed over to the upper layer ).
2) if a character in the I p message is e n d, it is necessary to transmit two bytes 0 x d B and 0 x D C consecutively to replace it. The special character 0 x d B is called the e s c character of s l I p, however, its value is different from the e s c character of a s c I code (0x1 B.
3) if a character in the I p message is an e s c character of s l I p, two bytes 0 x d B and 0 x D must be transmitted consecutively to replace it.
There are many small t c p group switches on the compressed slip: s l I p line. To transmit 1 byte of data, we need 2 0 bytes of I p header and 2 0 bytes of T C P header, this is a slip performance defect because the total number of bytes exceeds 4 0. Therefore, we propose a new protocol called c s l I p (that is, compressing s l I p, it is described in RFC 1144 [jacson 1990a] in detail. C s l I p can generally compress 4 0 bytes to 3 or 5 bytes. It can maintain up to six t c p connections at each end of c s l I p, and it knows that some fields in the header of each connection will not change. Most of the changed fields are only small numbers and changes. These compressed headers greatly shorten the interaction response time.
4. PPP: Point-to-Point Protocol (often used for low-speed serial links)
The PPP protocol includes the following three aspects:
1) method for encapsulating I p datagram on a serial link. P supports both an 8-bit asynchronous mode with no parity check (for example, serial interfaces that are common in most computers) and a bit-oriented synchronous link.
1) method for encapsulating I p datagram on a serial link. P supports both an 8-bit asynchronous mode with no parity check (for example, serial interfaces that are common in most computers) and a bit-oriented synchronous link.
3) Network Control Protocol (n c p: Network Control Protocol) systems for different network layer protocols. The network layers defined by r f c include I p, o s I network layer, D E C n e t, and a p L E TA L K. For example, the ip ncp allows both parties to determine whether to compress the packet header, similar to c s l I p (the acronym n C P is also available before t C P ).
Format of P data frame:
Because the flag value is 0x7 E, when this character appears in the information field, p needs to escape it.
In the synchronization link, PPP uses the bit filling mode to solve the problem through the special Escape Character 0x7d In the IBU link. When it appears in the p data frame, then the 6th bits of the followed characters need to be supplemented. The specific implementation process is as follows:
1) when the character 0x7 EIS encountered, two consecutive characters must be transferred: 0x7 d and 0x5 e to escape the character.
2) When the Escape Character 0x7 d is encountered, two consecutive characters must be transferred: 0x7 d and 0x5 d to escape the escape character.
3) by default, if the character value is less than 0x2 0 (for example, an a s c I control character), it is generally escaped. For example, when the character 0x0 1 is encountered, the 0x7 d and 0x2 1 characters must be transmitted consecutively (in this case, the 6th bits are converted, in the first two cases, it is changed to 0 ).
PPP compression:Most products can omit the identifier and address fields through negotiation, and reduce the protocol field from 2 bytes to 1 byte.. MostlyThe van jacson packet header compression method (corresponding to c s l p compression) can be adopted through negotiation to reduce the length of I P and T C P headers.
In general, p has the following advantages over s l I p: (1) PPP supports running multiple protocols on a single serial line,
(2) Each frame has a cyclic redundancy test. (3) both parties can perform dynamic negotiation on the I p address (Use
I p Network Control Protocol); (4) similar to c s l I p, the header of t c p and I p packets is compressed; (5) the Link Control Protocol can
Set multiple data link options. The cost for these advantages is to add three bytes at the beginning of each frame.
Several frames of negotiation data must be sent when establishing a link, and more complex implementation is required.
Slip users have more advantages than PPP users, but in the future, PPP users will surpass slip users.
5-cycle Interface
Class A network number 1 2 7 is reserved for the loopback interface. According to the Convention, most systems allocate the I P address 1 2 7. 0. 0. 1 to this interface and name it l o C A l h o s t. An I p datagram sent to the loopback interface cannot appear on any network.
A simple process for the loop interface to process the I p datagram:
Most products still complete all the processes at the transport layer and network layer, but only return the IP datagram to themselves when it leaves the network layer.
The key points to be pointed out in the figure are:
1) Any data sent to the loopback address (generally 1 2. 0. 0. 1) is used as the I p input.
2) copy the data transmitted to the broadcast address or multicast address and send it to the loopback interface, and then to the Ethernet. This is because the definition of broadcast and multicast transfer (chapter 2) includes the host itself.
3) any data sent to the host's I P address is sent to the loopback interface.
The other implicit meaning in the figure is that the I p datagram sent to the host's I P address generally does not appear in the corresponding network
Network. For example, on an Ethernet network, the group is generally not transferred out and then read back.
Six Largest Transmission Unit MTU
Ethernet requires the data frame format length not more than 1500 bytes 802.3 protocol requires 1492 bytes link layer this feature is called m t u, the maximum transmission unit
If there is a datagram to be transmitted on the I p layer, and the data length is larger than the m T U on the link layer, then, the I p layer needs to be split (f r a g m e n t a t I o n), and the datagram is divided into several pieces, so that each piece is smaller than M t u
Several common maximum transmission units:
Seven path MTU
Concept: not the m t u value of the network where the two hosts are located, but the minimum M t u in the path of the two communication hosts
The m t u path between two hosts is not necessarily a constant. It depends on the route selected at that time. The routing is not necessarily symmetric (the routing from A to B may be different from that from B to a). Therefore, the path m T U is not necessarily consistent in both directions.
Throughput Calculation of eight serial lines
If the line rate is 9600 B/S, and a byte has 8 bits, plus a starting bit and a stop bit, the line rate is 960 B/S (Bytes/s ). It takes 1066 ms to transmit a group of 1 0 2 4 bytes at this rate. If you use the s l I p link to run an interactive application and another application such as f t p to send or receive 1 0 2 4 bytes of data, in general, you have to wait half the time (533 MS) to send the grouped data of the interactive application. It is assumed that the interactive group data can be sent out before other "large" group data is sent. Most of the s l I p implementations do provide such service queuing methods, placing Interactive Data in front of large data blocks. Interactive communication generally involves the control parts of te l n e t, r l o g I n, and f t p (user commands, rather than data ).
Shortening the m t u of s l I p to 2 5 6 means that the chain needs a maximum of 266 MS to transmit a frame, and half of it is 133 Ms, which is generally the time to wait ). This situation will be better, but it is still not perfect. The reason we chose it (compared to 6 4 or 1 2 8) is that large data blocks provide good line utilization (such as large file transfers ). Assume that the header of the c s l p packet is 5 bytes, the total length of the data frame is 2 6 1 byte, and the data of 2 5 6 bytes makes the line utilization rate 9 8. 1%, the frame header occupies 1. 9%, the utilization rate is very good. If the m t u is reduced to 2 5 6, the maximum throughput of large data blocks will be reduced.
Our calculation of the average wait time (half of the time required for transmitting the maximum data frame) is only applicable to s l I p Link (or p link) in the case of intercommunication and mass data transmission. When only interactive communication is available, if the line rate is 9600 B/S, 1 byte data in any direction (assuming there are 5 bytes of compressed frame headers) it takes about 12.5 ms for a round-trip. It is better than the above mentioned 100 ~ 200 ms is much smaller. Note that the round-trip time of a 1-byte data is reduced from 85 Ms to 12.5 Ms because the frame header is compressed from 4 0 bytes to 5 bytes.
Data enters the protocol stack package process:
Link Layer for TCP/IP explanation