Chapter 3: Data link layer

1. Overview of link layer

Research idea of data link layer: In chapter 1 of the seven-layer model, it was mentioned that data is transmitted from top to bottom through similar unboxing and packing operations to the receiving end. However, when we specifically study the data link layer, in many cases we can only care about the horizontal data link layer in the protocol stack. Thus, when host H1 sends data to host H2, we can imagine that the data is sent horizontally from left to right at the data link layer, as shown by the thick arrow from left to right, through the following link layer :H1 link layer →R1 link layer →R2 link layer →R3 link layer →H link layer

As can be seen from the figure, from the perspective of data link layer, H1 to H2 communication can be regarded as composed of four different link layer communications, namely, H1→R1, R1→R2, R2→R3 and R3→H2. The four different link layers may use different data link layer protocols.

The most important points of this chapter are:

  1. The characteristics of the point-to-point channel and the broadcast channel at the data link layer, as well as the characteristics of the protocols used by the two channels (PPP and CSMA/CD). :
  2. There are three basic problems in data link layer: frame encapsulation, transparent transmission and error detection.
  3. Hardware address of the Ethernet MAC layer.
  4. Functions and applications of adapters, forwarders, hubs, Bridges, and Ethernet switches.

1.1. Basic Concepts

  • Node: host, router, etc
  • Link: A physical channel between two nodes in a network. The transmission media of a link include twisted-pair cable, optical fiber, and microwave. There are wired links and wireless links. A link is only a component of a communication path;
  • Data link: A logical channel between two points in a network. A data link is formed by adding the hardware and software of the communication protocol that actually controls data transmission to the link. The most common way to implement these protocols is to use network adapters, which generally include both the data link layer and the physical layer.
  • frame: protocol data unit at the data link layer. It encapsulates IP datagrams at the network layer
    • The data link layer sends the data frame handed down by the network layer to the link, and takes out the data in the received frame and delivers it to the network layer. In the Internet, the protocol data unit of the network layer is IP datagram (referred to as datagram, packet and packet).

As shown in the figure above: The data link layer is responsible for transmitting network layer datagrams from one node to the neighboring nodes directly adjacent to another physical link through a link. The main steps of the data link layer of this point-to-point channel are as follows:

  1. The data link layer of node A adds headers and tails to IP datagrams handed over by the network layer and encapsulates them into frames.
  2. Node A sends the encapsulated frame to the data link layer of node B.
  3. If the data link layer of node B receives no error, it extracts IP datagrams from the received frames and delivers them to the network layer above. Otherwise, the frame is discarded.

The data link layer does not have to consider the details of how the physical layer implements the bit transfer. It is even simpler to think of frames as being sent directly to each other horizontally between two data link layers

1.2 Overview of data link Layer functions

The data link layer provides services to the network layer on the basis of the services provided by the physical layer. The most basic service of the data link layer is to reliably transfer the data from the network layer to the target computer network layer of the adjacent nodes. Its main function is to strengthen the physical layer to transmit the original bitstream function, the physical layer provided by the error may be transformed into a logical error-free data link, so that the network layer as an error-free link.

Physical layer, data link layer, network layer relationship diagram:

  • Function 1: Provides services for the network layer. There is no confirmation connection service, there is confirmation no connection service, there is confirmation Connection Oriented service. (There must be a connection to confirm!)
  • Function 2: Link management, that is, establishing, maintaining, and releasing connections (for connection-oriented services)
  • Function 3: Frame grouping
  • Function 4: Flow control, limit the sender
  • Feature 5: Error Control (Frame error/bit error)

2. Encapsulate into frames

Encapsulate into frames:

A frame is formed by adding a head and tail to the front and back of a piece of data. After receiving the bit stream submitted by the physical layer, the receiver can identify the beginning and end of the frame from the received bit stream according to the tags at the head and tail.

Illustration:

The length of a frame is equal to the length of the data portion of the frame plus the length of the header and tail of the frame. One of the most important functions of headers and tails is frame delimiting (determining frame boundaries), and headers and tails also contain a lot of necessary control information.

When you send a frame, you send it from the beginning of the frame. Various data link layer protocols specify the headers and tails of frames. To improve frame transmission efficiency, the length of the data part of the frame should be larger than the length of the head and tail as much as possible. However, each link layer protocol sets an upper limit for the length of the data part —- Maximum Transfer Unit (MTU), as shown in the figure above.

Frame synchronization:

The receiver should be able to distinguish the start and end of a frame from the received binary bit stream.

Frame delimiter:

Special frame delimiters can be used when the data is a text file consisting of printable ASCII codes. The control character SOH is placed at the beginning of the frame, indicating the beginning of the frame, and another control character EOT indicates the end of the frame. Note: both SOH and EOT here are the names of the control characters, and the hexadecimal codes of SOH and EOT are 01 (0000001 for binary) and 04 (00000100 for binary) respectively.

Frame delimiters are especially useful when something goes wrong in transit. Assume that the sender before sending out a frame when suddenly broke down, cut off to send, but then quickly returned to normal, and start from scratch again send just now did not send the frame, with the use of frame delimiter, the receiver will know that the received data is incomplete frame (only the first character SOH without transmission end EOT), must be discarded, The data received later has clear frame delimiters (SOH and EOT), so this is a complete frame and should be accepted.

Note that different protocols use different frame delimiters, but the idea is the same: both are implementations of SOH and EOT.

Four methods of framing:

  1. Character counting method
  2. Character (section) padding method
  3. Zero bit filling method
  4. Code violations

3. Transparent transmission

Transparent transmission

This means that the data transmitted should be able to be transmitted over the link regardless of the combination of bits. As a result, the link layer is “blind” to anything that interferes with data transmission. Frame framing errors occur when the combination of bits in the transmitted data happens to be the same as the bit encoding of the control character used for frame framing. Therefore, appropriate measures must be taken so that the receiver does not mistake such data for control information similar to frame framing. In this way, transparent transmission at the data link layer can be ensured.

As shown in the figure, SOU is the beginning and EOT is the end. Transparent transmission is to ensure that all data between SOH and EOT can be sent correctly, and it is necessary to ensure that control fields such as EOT can not be moved in the frame data part.

The transmission of a frame like the one shown above is clearly not “transparent transmission” because it cannot be transmitted when the character “EOT” happens to appear in the data portion of the transmitted frame. The “EOT” in the data is wrongly interpreted by the receiver as a “end of transmission” control character, and the subsequent data is discarded by the receiver as an invalid frame because the “SOH” is not found. But the character “EOT” that actually appears in the data is not a control character but just binary 00000100.

It is worth mentioning that: when the transmitted frames are composed of text files (characters of text files are input from the keyboard, all are ASCII code, no matter what characters are input from the keyboard, they can be transmitted in the frame, that is, transparent transmission is realized).

Solution to the transparent transmission problem

In order to solve the transmission problem, it is necessary to make the control characters “SOH” and “EOT” that may appear in the data not be interpreted as control characters at the receiving end.

The method is as follows: The data link layer of the sending end inserts an escape character ESC before the control character SOH or EOT in the data. The data link layer at the receiving end removes the inserted escape character before sending the data to the network layer. This method is called byte padding or character padding. If the escape character also appears in the data, the workaround is still to insert an escape character before the escape character. So when the receiver receives two consecutive escape characters, it deletes the first one of them.

Therefore, the application of the transparent transmission problem to frames is now introduced in detail in four methods of encapsulation into frames:

3.1 character counting method

A simple encapsulation method that uses a count field (the first byte, eight bits) at the beginning of the frame to indicate the number of characters in the frame.

As shown in the figure, each frame is preceded by a number specifying how many characters it should send. This method is called character counting.

Disadvantages: If the number at the beginning of the first frame changes, the number at the beginning of the second frame will also move forward and change, causing a chain reaction.

3.2. Character filling method

The data link layer of the sending end inserts an escape character ESC before the control character SOH or EOT in the data. The data link layer at the receiving end removes the inserted escape character before sending the data to the network layer. This method is called byte padding or character padding. If the escape character also appears in the data, the workaround is still to insert an escape character before the escape character. So when the receiver receives two consecutive escape characters, it deletes the first one of them.

Can be used when the transmitted frame is composed of non-ASCII text files (binary code programs or images), this method can be used for transparent transmission

3.3. Zero-bit filling method

Add 01111110 to the header and tail of the data. The principle is as follows:

  1. At the sending end, the entire message field is scanned and a 0 is immediately filled in whenever there are five consecutive ones
  2. At the receiving end, the flag field is first found to determine the boundary, and then the hardware is used to scan the bitstream. When five ones are found in a row, the zeros are deleted.

3.4. Illegal coding law

As shown in the figure, the Manchester code has only “high-low” and “low-high” for each symbol, so “high-high” and “low-low” can be used to start and end bounded frames. Start and end a delimited frame in a level manner that is not possible in the code.

Summary: Due to the fragility of the Count field in byte counting (its value error can lead to catastrophic consequences) and the complexity and incompatibility of character filling implementation, the more commonly used frame synchronization methods are bit filling and illegal coding.

4. Error control

4.1. Check the code

4.1.1 Where did the error come from?

Realistic communication links are not ideal. That is, bits can go wrong in transit. A 1 could become a 0, and a 0 could become a 1. This is called a bit error. Bit error is a type of transmission error. The term “error” in this subsection, unless otherwise specified, means “bit error”.

4.1.2 Error control

4.1.3 Cyclic redundancy detection CRC error detection technology

Over a period of time, the ratio of the number of incorrectly transmitted bits to the total number of transmitted bits is called the bit error rate. Bit error rate is closely related to signal-to-noise ratio. If you try to improve the SNR, you can reduce the bit error rate. The actual communication link is not ideal, it is impossible to get the bit error rate down to zero. Therefore, in order to ensure the reliability of data transmission, various error detection measures must be adopted in computer network data transmission. At present, cyclic redundancy detection (CRC) is widely used in data link layer.

Here is an example to illustrate the principle of cyclic redundancy detection.

The sender:

The data is divided into groups, assuming that each group has k bits. Now assume that the transmitted data M=101001 (k=6). CRC operation is to add n bits of redundancy code for error detection after data M, and then form a frame to send out, sending a total of (K + N) bits.

This n-bit redundancy code can be obtained by multiplying 2 to the NTH power by M using a binary modulo 2 operation, which is equivalent to adding n zeros after M. The resulting number of (k+n) bits divided by the polynomial P of length (n+1) bits agreed by the sender and sender implementations gives Q and R as the quotient. In the example shown in the figure, M=101001 (k=6). Assume the remainder P=1101 (n=3). The result of modulo 2 division is Q=110101, and remainder R=001. The remainder R is then sent as a redundancy code concatenated after the data M.

This kind of redundant code added for error detection is often called frame check sequence FCS. So the frame sent with FCS is 101001001 with (k+n) bits.

The receiving end

CRC checks the received data on a frame-by-frame basis: print out the same divisor P for each received frame, and then check the remainder R. If there is no error during transmission, then the remainder R obtained after CRC test must be 0. But if there’s an error, the probability that R is still equal to zero is very, very small. In short, after CRC check is performed on each frame received by the receiver.

  1. If the remainder R=0, the frame is judged to be correct and accepted.
  2. If the remainder R! =0, the frame is judged to be wrong and discarded.

Finally, it is emphasized that if only cyclic redundancy check CRC error detection technology is used in the data link layer, only error-free acceptance of frames can be achieved, that is, “all frames received by the data link layer at the receiving end can be considered with a probability close to 1 that there is no error in the transmission process of these frames”. The above can be approximately expressed as: “All frames received by the data link layer at the receiving end are error-free”. However, we do not require the concept of reliable transmission, the so-called “reliable transmission” is: the data link layer sends what the receiver receives. **

example

4.1.4,

Transmission errors can be divided into two main categories: one is the above mentioned and most basic bit error, and the other is more complicated, which is the received frame with no bit error, but with frame loss, frame repetition, or frame out-of-order. All three cases are “transmission errors”, but none of these frames have “bit errors”.

Frame loss is easy to understand. However, the occurrence of frame repetition and frame out of order is more complicated, and we will not discuss these issues now. It should be made clear that using CRC checks at the data link layer enables extremely poor transport, but it is not yet reliable. “Infinite error” is not the same as “transmission error free”. Using CRC checks at the data link layer, it is possible to achieve extremely high error transmission, but it is not reliable transmission.

We know that OSI’s view in the past was that the data link layer had to be brought up to provide reliable transmission. Therefore, on the basis of CRC error detection, frame number confirmation and retransmission mechanism are added. An acknowledgement is sent to the sender when the correct one is received. If the sender does not receive an acknowledgement from the other side within a certain period of time, it considers that there is an error and retransmits until it receives an acknowledgement from the other side. However, none of the data link layer protocols widely used on the Internet are practical for confirmation and retransmission, that is, the data link layer is not required to provide reliable transmission services. If an error occurs during data transmission at the data link layer and needs to be corrected, the task of correcting the error is performed by the upper layer protocol (TCP protocol at the transport layer). Practice has proved that this can provide communication efficiency.

4.2 error correction code

slightly

5, flow control and reliable transmission

5.1 Flow control at the data link layer

5.1.1, concepts,

The mismatch between higher sending speed and lower receiving capacity will cause transmission errors, so flow control is also an important work of the data link layer.

Traffic control at the data link layer is point-to-point, while traffic control at the transport layer is end-to-end.

Data link layer traffic control means: The receiver does not reply to confirm the receipt. And transport layer flow control means: the receiver to the sender of a window announcement.

5.1.4 method of flow control

Stop-wait protocol:

After each frame, it stops sending, waits for confirmation, and then sends the next frame. The send window size is 1, and the receive window size is 1(a special case of sliding Windows).

Sliding window protocol (fixed window size)

  • Back N Frame protocol (GBN): send window size greater than 1, receive window size is 1;
  • Select retransmission protocol (SR) : The size of the sending window is greater than 1, and the size of the receiving window is greater than 1.

conclusion

Reliable transmission: what the sender sends, the receiver receives

Flow control: Control the sending rate so that the receiver has enough buffer space to receive each frame

Sliding window solution:

  • Flow control (can not receive to confirm, want to send can not send);
  • Reliable transmission (automatic retransmission by sender), loss of packets

5.2 Stop – Wait for agreement

1. Why stop-wait protocols

In addition to the bit error, the underlying storage will also have packet loss problem [packet loss: physical line failure, device failure, virus attack, routing information error, etc., will lead to the loss of packets]

The names of packets at different levels are also different. The link layer is called frame, the network layer is called IP datagram or packet, and the transport layer is called packet segment to achieve flow control.

2, stop waiting for the protocol to do the problem (research) premise:

  1. Although most of the current communication is full-duplex, the problem is abstracted into simplex (i.e. one side sends and one side receives).
  2. There is no need to consider which layer the protocol is at (data link layer or transport layer)
  3. Stop – Wait is to stop sending each packet, wait for confirmation, and then send the next packet.

3. Application of stop waiting protocol:

It is divided into error condition & no error condition

Error-free condition

Error condition

1. A data frame is lost or a frame error is detected

2. Missing or late ACK

4. Performance analysis

Channel utilization

5.3 Back N Frame Protocol (GBN)

Disadvantages of stop protocol: channel utilization rate is low, pipeline technology can be used to improve utilization rate.

  • Must increase serial number range;
  • Sending requires caching multiple packets.

Therefore, we extend SR and GBN for this technology

There are three things the GBN sender needs to respond to

[1] Upper level call:

When the upper layer wants to send data, the sender first checks whether the sending window is full. If not, a frame is generated and sent. If the window is full, sending simply returns the data to the upper layer, indicating that the upper window is full. The upper layer will send it later. (In practice, sending can cache this data and send frames when the window is not full).

[2] Received an ACK:

In GBN protocol, the confirmation of n frame adopts the cumulative confirmation method, indicating that the receiver has received N frame and all previous frames. If the maximum serial number is confirmed, the previous confirmation indicates that it has been received regardless of whether the confirmation is sent or not.

[3] Timeout event:

The name of the protocol is back N frames/Back N frames, derived from the sender’s behavior when a frame is lost or extended. As in the stop protocol, the timer will again be used to recover the data frame or confirm the loss of the frame. If a timeout occurs, the sender retransmits all frames that were sent but not acknowledged.

GBN receiver to do

If frame N is received correctly and in order, the receiver sends an acknowledgement ACK for frame N and delivers the data portion of that frame to the upper layer. Anything else is discarded and ACK is resend for the most recently received frame in sequence. The receiver does not need to cache any out-of-order frames, but maintains a message exepectedSeqnum (the sequence number of the next frame to be received in order).

Sliding window length

If n bit pairs are used for frame numbering, then the size of the sending window W1 should meet: 1<=W1<= 2N-1. Because the size of the sending window is too large, the receiver cannot distinguish the new frame from the old frame.

Key points of GBN agreement

Cumulative confirmation (also known as piggyback confirmation). The receiver accepts frames sequentially and discards them ruthlessly. Identifies the sequence arriving frame with the largest sequence number. The maximum size of the sending window is 2N-1, and the size of the receiving window is 1.

GBN protocol performance analysis

Improved channel utilization; During retransmission, the data frames that have been correctly transmitted must be retransmitted, which reduces transmission efficiency.

5.4. Select retransmission Protocol (SR)

slightly

6, channel division media access control

6.1 overview,

Two types of links used to transmit data

Point-to-point link: Two adjacent nodes are connected by a link without a third party. Application: PPP protocol, commonly used in wide area networks

Broadcast link: All hosts share the communication media. Applications: Early bus Ethernet, wireless LAN, often used in local area networks. Typical topologies: bus, star (logical bus)

Second, media access control

The content of media access control is to take certain measures so that the communication between two pairs of nodes will not interfere with each other.

Media access control:

Iii. Channel Division Media access control:

Each device using media is separated from the communication of other devices from the same channel, and the time domain and frequency domain resources are reasonably allocated to the devices on the network.

Multiplexing technology: multiple signals are combined in a physical channel for transmission, so that multiple computers or terminal devices share channel resources and improve channel utilization.

Frequency division multiplexing FDM

Time division multiplexing TDM

Time multiplexing STDM statistics

Wavelength division multiplexing WDM

It is the frequency division multiplexing of light, transmitting a variety of optical signals of different wavelengths in an optical fiber. Because of the different wavelengths, each optical signal does not interfere with each other. Finally, wavelength decomposition multiplexer is used to decompose each wavelength

Code division multiplexing CDM

Code division Multiple access (CDMA) is a method of code division multiplexing.

  • One bit is divided into multiple code slices/chips, and each site is assigned a comfortable m-bit chip sequence.
  • When sending 1, the site sends the chip sequence; Sends chip sequence inverse when sending 0 (usually written as -1)
  • How to avoid collisions: When multiple sites send data at the same time, the chip sequences of each site are orthogonal to each other.
  • How to merge: Data is added linearly in the channel.
  • How to separate: Merge data and source station normalized inner product.

6.2 ALOHA Protocol

Slightly, bored very, do not write, use the time to watch the video

6.3. CSMA protocol

Slightly, bored very, do not write, use the time to watch the video

6.4. CSMA-CD protocol

Carrier sense, collision detection

Ethernet and wireless LAN in LAN

7.1. LAN

7.1.1 overview,

A Local Area Network (LAN) is a computer group that consists of multiple interconnected computers in a certain Area and uses broadcast channels

Feature 1: the geographical coverage is small, only in a relatively independent local area inline, such as one or several architectural complexes

Feature 2: specially laid transmission media (twisted pair or coaxial cable) are used for networking, and the data transmission rate is high (10Mb/s to 10Gb/s).

Feature 3: Short communication delay time, low bit error rate, high reliability

Feature 4: All stations are equal and share the transmission channel

Feature 5: More distributed control and broadcast channel, broadcast and multicast

The main factors that determine LAN are: network topology, transmission medium and media access control method

7.1.2. LAN Topology

The star topology

The central node is the control center. The communication between any two nodes only needs two steps at most. The transmission rate is fast, and the network configuration is simple, the network is easy to build, and it is easy to control and manage. But this kind of network system, network reliability is low, network sharing ability is poor, have single point of failure problem

Bus topology

The network has high reliability, fast response speed between network nodes, strong ability to share resources, less equipment input, low cost, easy installation and use. When a workstation node fails, the impact on the entire network system is small

Ring topology

Communication equipment and lines in the system are relatively economical. Single point of failure; Because the loop is closed, it is not easy to expand, the system response delay is long, and the information transmission efficiency is relatively low

The tree topology

Easy to scale, easy to isolate failures, and easy to have single points of failure

7.1.3 LAN media access control method

LAN:

  • Wired LAN, common media: twisted pair, coaxial cable, optical fiber
  • Wireless LAN, common medium: electromagnetic wave

Access control methods:

  • CSMA/CD: Commonly used for bus lans, but also for tree networks
  • Token bus: Commonly used for bus lans, but also for tree networks. It is the bus or tree network of each workstation in a certain order, such as the size of the interface address, arranged into a logical ring. Only the token holder can control the bus and have the authority to send messages
  • Token-ring: Used for ring lans, such as token-ring networks

7.1.4 Classification of LAN

  • Ethernet. Ethernet is the most widely used LAN, including standard Ethernet (10Mbps), fast Ethernet (100Mbps), gigabit Ethernet (1000Mbps) and 10G Ethernet, which all comply with IEEE802.3 series of standard specifications. The logical topology is bus, and the physical topology is star or extended star. Using CSMA/CD
  • Token ring network. The star topology is used physically and the ring topology is used logically. Is “yesterday’s past”
  • Fiber Distributed Data Interface (FDDI). It has a double ring topology physically and a ring topology logically
  • ATM network (Asynchronous Transfer Mode). Newer cell switching techniques use 53 – byte fixed – length cells for switching
  • Wireless Local Area Network (WLAN) adopts IEEE802.11 standard

The IEEE 802 standard

IEEE 802 series standards are technical standards for local area network (LAN) and metropolitan area network (MAN) developed by the IEEE 802 LAN/MAN Standards Committee. The most widely used are Ethernet, token ring, wireless LAN, etc. Each sub-standard in this series is the responsibility of a specialized working group within the Commission

  • IEEE 802.3: Ethernet Media Access Control Protocol (CSMA/CD) and physical layer specification
  • IEEE 802.5: Media access control protocol and physical layer specification for token-ring networks
  • IEEE 802.8: Optical fiber Technical Advisory Group, which provides technical advice on optical fiber networking
  • IEEE 802.11: Media access control protocol and physical layer specification for wireless local area network (WLAN)

7.1.5 MAC sublayer and LLC sublayer

The LAN reference model described by IEEE 802 only corresponds to the data link layer and physical layer of the OSI reference model. The data link layer is divided into logical link layer LLC layer and media access control (MAC) layer

7.2 Ethernet

7.2.1 overview,

Ethernet refers to the baseband bus LAN specification created by Xerox and jointly developed by Xerox, Intel and DEC. It is the most common communication protocol standard used in the current LAN. Ethernet uses CSMA/CD technology

Ethernet occupies a dominant position in various LAN technologies:

  • Low cost (less than 100 Ethernet nics)
  • It is the most widely used LAN technology
  • Cheaper and simpler than token ring network and ATM network
  • The network speed ranges from 10Mb/s to 10Gb/s

Two Ethernet standards:

  • DIX Ethernet V2: First LAN product (Ethernet) protocol
  • IEEE 802.3: The first IEEE Ethernet standard developed by the IEEE 802 Committee 802.3 Working Group. 802.3Lan is Ethernet

Ethernet provides connectionless and unreliable services

  • No connection: No handshake between sender and receiver
  • Unreliable: the data frame number of the sender is not correct, the receiver does not confirm to the sender, the error frame is discarded directly, and the error correction is responsible for by the senior management. Ethernet only achieves error-free reception, not reliable transmission

Ethernet transmission medium

Thick coaxial cable => Thin coaxial cable => Twisted-pair cable + hub

Ethernet Topology

  • Ethernet using hubs is still logically a bus network, with stations sharing the logical bus and using the CSMA/CD protocol.
  • Ethernet topology: Logically bus, physically star

7.2.2 10Base-T Ethernet

10base-t is a twisted pair Ethernet cable for transmitting baseband signals. T indicates that a twisted pair cable is used. Currently, 10base-t uses an unshielded twisted pair (UTP) cable at the transmission rate of 10Mb/s

Physically, the star topology is adopted. The length of each twisted pair cable is 100 mbit/s. Manchester code is used. Use CSMA/CD media access control

7.2.3 Adapter and MAC Address

The connection between the computer and the external LAN is through the communication adapter.

The adapter houses the processor and memory (including RAM and ROM). The ROM has the computer’s hardware address — the MAC address

On lans, hardware addresses are also called physical addresses, or MAC addresses

MAC address: Each adapter has a globally unique 48-bit binary address. The first 24 bits represent the vendor (specified by IEEE) and the last 24 bits are specified by the vendor. Six hexadecimal numbers are used, for example, 02-60-8C-e4-B1-21.

7.2.4 Ethernet MAC Frames

There are two common Ethernet MAC frame formats:

  • DIX Ethernet V2 Standard (Common)
  • IEEE 802.3 standard

The most commonly used MAC frames are in the Ethernet V2 format:

  • The type field is used to indicate the protocol used by the upper layer so that the data received by the MAC frame is submitted to the upper layer
  • The official name of the data field is MAC Customer data field, minimum length 64 bytes – 18 bytes header and tail = minimum length of the data field (46 bytes)
  • If the length of a data field is less than 46 bytes, add an integer byte padding field to the end of the data field to ensure that the MAC frame length of the Ethernet is not less than 64 bytes
  • Of the eight bytes inserted (hardware-generated) in front of the frame, the first field, seven bytes in total, is the pre-sync code, which is used to quickly synchronize the bits of the MAC frame. The second field, 1 byte, is the frame start delimiter, indicating that the following information is the MAC frame.

Invalid MAC frame

  • The length of the data field is inconsistent with the value of the length field
  • The frame length is not an integer of bytes
  • The received frame check sequence FCS is used to detect errors
  • The length of the data field is between 46 and 1500 bytes
  • The valid MAC frame length ranges from 64 to 1518 bytes

7.2.5. High-speed Ethernet

An Ethernet whose speed is greater than or equal to 100Mb/s is called a high-speed Ethernet

  • 100base-t Ethernet: transmits 100Mb/s baseband signals over twisted-pair cables in a star topology. It still uses the CSMA/CD protocol of IEEE 802.3 and supports full-duplex and half-duplex. It works in full-duplex mode without conflict
  • Gigabit Ethernet: transmits 1Gb/s signals over optical fibers or twisted-pair cables, supports full duplex and half duplex, and can work in full duplex mode without conflict
  • 10 gigabit Ethernet: 10 gigabit Ethernet transmits 10 GB /s signals over optical fibers. It supports only full duplex and has no contention problem

7.3. Wireless LAN

7.3.1, IEEE 802.11

IEEE 802.11 is a universal wireless LAN standard. It is a wireless network communication standard defined by IEEE

802.11 MAC frame header format

7.3.2 Classification of wireless LAN

  • Wireless LAN with fixed infrastructure
  • A self-organizing network with no fixed infrastructure wireless LAN

8. Link layer protocols used by wan

8.1 Overview of Wan

Wan, usually across a large physical range, covering the range from tens of kilometers to thousands of kilometers, it can connect a number of cities or countries, long-distance communication, the formation of international remote network.

Wan communication subnets mainly use packet switching technology. The communication subnet of wan can make use of packet switched network, satellite communication network and wireless packet switched network. It interconnects local area networks or computer systems in different areas to achieve the purpose of resource sharing. For example, the Internet is the world’s largest wide area network

Node switches differ from routers in that switches can only be packet-switched within a single network

8.2 PPP point-to-point protocol

Point-to-point protocol (PPP) PPP is the most widely used link layer protocol. When users use dial-up phones to access the Internet, PPP is generally used. Only full-duplex links are supported.

The PPP protocol must meet the requirements

  • Simple: For frames at the link layer, no error correction, no serial number, no flow control is required.
  • Encapsulate into frames: Frame delimiter
  • Transparent transfer: How data should be handled in bits combinations like frame delimiters: one-step line byte filling, synchronous line bit filling.
  • Multiple network layer protocols: serial/parallel, synchronous/asynchronous, electrical/optical.
  • Error detection: Discard errors
  • Check the connection status: Whether the link is working properly.
  • Maximum transmission unit: MTU, the maximum length of the data part;
  • Network-layer address negotiation: Obtains the network-layer addresses of the communication parties.
  • Data compression negotiation.

Requirements that need not be met

  • No error correction required
  • No flow control is required
  • Frame numbering is not required
  • Multi-point lines are not supported

PPP has three components

  • A method for encapsulating IP datagrams into serial links (synchronous serial/asynchronous serial).
  • Link Control protocol (LCP) : Establishes and maintains data link connections. [Authentication]
  • Network control protocol (NCP) : PPP supports multiple network-layer protocols. Each network-layer protocol requires a corresponding NCP to establish and configure logical connections for network-layer protocols.

PPP status diagram

PPP frame format

The HDLC protocol is rarely used

9. Link layer devices

9.1 Physical Layer Extended Ethernet

Using optical fiber expansion

  • The host is connected to the hub using optical fiber (usually a pair of optical fibers) and a pair of optical fiber modems.
  • It is easy to connect the main engine to a hub several kilometres away

Using hub scaling: Concatenate multiple Ethernet segments into a larger, multilevel star-shaped Ethernet

advantages

  • Enables computers on Ethernet networks originally belonging to different collision domains to communicate across collision domains
  • Expanded the geographic coverage of Ethernet

disadvantages

  • The collision domain is enlarged, but the overall throughput is not improved, resulting in low efficiency
  • If different collision domains use different data rates, they cannot be connected by hubs

The collision domain, also known as the collision domain, refers to the part of the network where a frame issued by one site will collide or collide with frames issued by other sites. The larger the collision domain, the higher the probability of collision

9.2 Data link layer extended Ethernet

Reference link: blog.csdn.net/weixin_4465…

The more common way to scale Ethernet is at the data link layer. Early Bridges, now Ethernet switches

The bridge

Working at the data link layer, the bridge forwards and filters the received frame according to the destination address of the MAC frame. When the bridge receives a frame, it does not forward the frame to all interfaces, but first checks the destination MAC address of the frame, and then determines which interface to forward the frame to or discard it

Ethernet switch

In essence, an Ethernet switch has a dozen or more ports. Usually, there are a dozen or more ports. Each port is directly connected to a single host or another Ethernet switch and usually works in full-duplex mode

The Ethernet switch is parallel and can connect to multiple pairs of interfaces at the same time, so that multiple pairs of hosts can communicate at the same time

Switch switching mode

  • Storage and forwarding mode:
    • The entire data frame is cached before processing.
  • Cut-through mode:
    • When receiving the data frame, the forwarding interface of the frame is determined according to the destination MAC address of the data frame, thus improving the forwarding speed of the frame.
    • The disadvantage is that it simply forwards frames without checking for errors, so it is possible to forward invalid frames to other stations as well.

Conflict domains and broadcast domains:

10 and summarize

The data link layer belongs to the lower layer of the computer network. The channels used by the data link layer are mainly of the following two types

  • Point-to-point channel: One-to-one point-to-point communication mode, point-to-point protocol PPP
  • Broadcast channel: ONE-TO-many broadcast communication mode, which uses one-to-many broadcast communication mode (such as hub), so the process is complicated. There are many hosts connected in the broadcast channel, so a dedicated shared channel protocol, CSMA/CD, must be used to coordinate the data transmission of these hosts

Lans belong to the data link layer: a LAN is a network. But we are not talking about Lans at the network layer. And that’s because at the network layer you’re talking about the interconnection of multiple networks, how packets are forwarded from one network, through routers, to another network. On the same LAN, packets are transferred from one host to another without being forwarded by a router. Viewed from the whole Internet, LAN still belongs to the scope of data link layer

For more information, please refer to blog.csdn.net/weixin_4562…