Computer Network Summary - Data Link Layer

3.1 Data Link Layer Overview

  • Link: A physical line from one node to an adjacent node with no other nodes in between.

  • Data link: refers to adding the hardware and software that implements the communication protocol to the link to form a data link.

  • The data packets transmitted by the data link layer are called frames , and the data link layer transmits and processes data in units of frames.

Questions to be discussed at the data link layer:

(1) For the data link layer using point-to-point channels, there are three important issues in the data link layer:

  • Encapsulation and framing : The data link layer adds a frame header and frame trailer to the network protocol data unit delivered by the network layer. This operation is called encapsulation and framing.

The following is the MAC frame format for Ethernet version 2:

image-20210529234625851
  • Error detection : The sender sends the encapsulated frame to the transmission medium through the physical layer. When the frame encounters interference during transmission, a bit error may occur, that is, bit 0 may become bit 1, or vice versa. So some measures need to be taken to solve this problem.

Before sending the frame, the sender calculates the error detection code based on the data to be sent and the error detection algorithm , and seals it to the end of the frame, such as the FCS field in the Ethernet MAC frame above. After receiving the data, the receiver can use the error detection code and error detection algorithm to determine whether the frame has a code error during transmission.

  • Reliable transmission : The receiver discards an errored frame and takes other steps to ensure that it receives a correct copy of the frame again.

The reliable transmission here means that although I threw away the error frame, I will still notify you to resend it, and I will not let it go irresponsibly.

Encapsulation into framing, error detection, and reliable transmission are the most basic and important issues in the data link layer.

(2) For the data link layer using the broadcast channel (shared LAN), in addition to the above three problems, the data link layer has some other problems that need to be solved:

image-20210530000435844

Addressing problem : As shown in the figure, ABCDE is interconnected through a bus. Host A wants to send data to host C. The signal representing the frame will be transmitted to all hosts on the bus through the bus. Host C needs to know that the frame is sent to itself, and host BDE needs to know that the frame is not sent to itself. Host A will add the destination address to the header of the frame and transmit it together, such as the destination address field of the Ethernet MAC frame above.

image-20210530001049478

Collision problem : When multiple hosts on the bus use the bus to transmit frames at the same time, the transmission signal will collide. The coordination method adopted by Ethernet is: use a special protocol CSMA/CD (carrier sense multipoint access/collision detection).

(3) With the development of technology and the maturity of switching technology and the reduction of cost, the switched LAN using point-to-point link and link layer switch has higher performance, which has completely replaced the above shared LAN in the field of wired LAN.

image-20210530001819149

At this time, it is necessary to discuss how the switch forwards the frame?

(4) Wireless LANs still use shared channel technology. For example, 802.11 LANs use media access control protocol CSMA/CA (Carrier Sense Multipoint Access/Collision Avoidance). What is its working principle?

image-20210530002207656

3.2 Encapsulation and framing

(1) Encapsulation and framing

  • Encapsulation into a frame means that the data link layer adds a frame header and a frame tail to the network protocol data unit delivered by the upper layer to make it into a frame.

  • The header and trailer of the frame contain a lot of important control information.

For example, the frame header of an Ethernet MAC frame contains the destination address, source address and type, and the frame tail contains the FCS field

image-20210530102153764

The frame format of the point-to-point protocol PPP, the frame header includes flag, address, control and protocol fields, and the frame tail includes FCS and flag fields.

image-20210530102333036
  • One of the functions of the frame header and the frame trailer is frame delimitation, for example, the flag bits in the frame header and frame trailer in the PPP frame are used for frame delimitation.

image-20210530102844946

In this way, the data link layer of the receiver can extract frames one by one from the bit stream delivered by the physical layer according to the frame delimitation mark.

It should be noted that not every data link layer frame includes a frame delimitation flag , for example, an Ethernet MAC frame does not include a frame delimitation flag bit.

In fact, Ethernet delivers the encapsulated frame to the physical layer, and the physical layer adds an 8-byte preamble in front of the MAC frame , and then converts the bit stream into an electrical signal for transmission.

The first 7 bytes in the preamble are the preamble, which is used to synchronize the receiver's clock. The last byte is the frame start delimiter, indicating that it is followed by the MAC frame.

image-20210530104104215

In addition, Ethernet also stipulates that the inter-frame interval time is 96-bit transmission time, so the MAC frame does not need a frame end delimiter.

image-20210530104014230

(2) Transparent transmission:

Transparent transmission means that the data link layer does not have any restrictions on the data delivered by the upper layer, as if the data link layer does not exist.

  1. Byte-oriented physical links use byte stuffing (or character stuffing) to realize transparent transmission.

Before sending a frame, the data link layer will scan the protocol data unit delivered by the upper layer, add an escape character in front of each frame delimiter appearing in the upper layer data , and the data link layer of the receiver will extract the frame from the bit stream delivered by the physical layer . In this way, the data link layer does not have any restrictions on the data delivered by the upper layer, so it is called transparent transmission.

The escape character is a special control character with a length of 1 byte and a decimal value of 27.

  1. Bit-oriented physical links use bit stuffing to realize transparent transmission.

Taking a point-to-point protocol frame as an example, when a bit string similar to the frame delimiter appears in the protocol data unit delivered by the upper layer, the zero-bit filling method can be used to scan the data part before sending, and a bit 0 is inserted after every 5 consecutive bit 1, thus ensuring the uniqueness of the frame delimiter in the entire frame. This enables transparent transmission.

image-20210530113538970

When the receiver's data link layer extracts frames from the bit stream delivered by the physical layer, it removes the bit 0 following every 5 consecutive bit 1s.

Practice questions:

image-20210530113831789

In order to improve the transmission efficiency of the frame, the length of the data part of the frame should be made as large as possible.

However, considering factors such as error control, each data link layer protocol specifies the maximum length of the data part of the frame, which is called the maximum transfer unit MTU (Maximum Transfer Unit).

3.3 Error detection

The actual transmission link is not ideal, and errors may occur during the transmission of bits, which are called bit errors.

Over a period of time, the ratio of the number of transmitted erroneous bits to the total number of transmitted bits is called the Bit Error Rate (BER).

An error detection code is used to detect whether an error occurs during data transmission. For example, the frame tail of an Ethernet MAC frame contains a 4-byte frame check sequence FCS field.

(1) Parity check

Add a parity bit after the data to be sent, so that the number of bits 1 in the entire data (including the parity bit) is even (even parity) or odd (odd parity).

If an odd number of bits are in error, the parity changes and bit errors can be detected.

If there is an even number of bit errors, the parity does not change and bit errors cannot be detected (missed detection).

Due to the high miss rate of the parity test, the data link layer in the computer network generally does not use this test method.

(2) Cyclic Redundancy Code (CRC)

This is an inspection method with strong error detection ability, and the missed detection rate is very low.

  • The sending and receiving parties agree on a generating polynomial G(x).
  • The sender calculates an error detection code (redundant code) based on the generator polynomial and the data to be sent, and adds it to the data to be sent and sends it together.
  • The receiver calculates whether an error has occurred based on the generator polynomial and the received data.
image-20210530121618649

image-20210530121741428

The sender generates a redundancy check code:

image-20210530150201998

The receiver judges whether the data is wrong:

image-20210530150629690

The error detection code can only detect errors in the transmission process of the frame, but cannot locate the error, so it cannot correct the error.

To correct errors, forward error correction can be performed using error-correcting codes with more redundant information. However, this kind of error correction code has relatively large overhead and is rarely used in computer networks.

Cyclic redundancy codes have good error detection capabilities. Although the calculation is relatively complicated, they are easy to implement on hardware, so they are widely used in the data link layer.

3.4 Reliable Transmission

3.4.1 Basic concept of reliable transmission

The receiver finds that the data has a bit error through the error detection code, then there will be two situations:

  • If the data link layer provides an unreliable transmission service for the upper layer, it will directly discard the frame and do nothing else.
  • If the data link layer provides reliable transmission services for the upper layer, it will find a way to realize what the sender sends, and the receiver accepts what. For example, the receiver can send a notification frame to the sender, notifying the sender that a code error occurs in the data and needs to be resent.

Reliable transport services also need to solve other problems:

  • The notification frame was also bit-erroneous.
  • From the perspective of the entire computer system, **transmission errors also include packet loss, packet out-of-sequence, and packet duplication,** these transmission errors generally appear in the upper layer of the data link layer.

For wired links, the bit error rate is relatively low. In order to reduce overhead, the data link layer is not required to provide reliable transmission services for the upper layer. Even if a bit error occurs, the problem of reliable transmission is handled by the upper layer.

For wireless links, due to its susceptibility to interference and high bit error rate, the data link layer must be required to provide reliable transmission services for the upper layer.

Reliable transport services are not limited to the data link layer, other layers can choose to implement reliable services.

image-20210530155321097

The implementation of reliable transmission is complicated and expensive. Whether to use reliable transmission service depends on the application requirements.

3.4.2 Realization Mechanism of Reliable Transmission - Stop Waiting Protocol SW

(1) Acknowledgment and denial : After the sender sends the packet, it waits for the receiver to accept the packet. After the receiver accepts the packet, it detects whether there is a bit error in the data.

If no bit error occurs , accept the packet and send the confirmation packet ACK to the sender, and the sender will continue to transmit the next packet after receiving the confirmation packet;

If a code error occurs , the packet is discarded and a NAK packet is sent to the sender, and the sender retransmits the packet after receiving the acknowledgment packet.

Therefore, the sender cannot delete the packet from the cache immediately after sending the packet, but can only delete the packet from the cache after receiving the confirmation packet.

image-20210530164543868

(2) Timeout retransmission:

The packet sent by the sender may be lost during the transmission process, causing the receiver to never receive the packet, and will not send an acknowledgment packet or deny packet to the sender, which will cause the sender to be in a waiting state. In order to solve this problem, you can start a timeout timer after the sender sends a data packet. When the set retransmission time is up and the sender does not receive an ACK or NAK, the packet is retransmitted .

This retransmission time is generally set to be slightly greater than the average round-trip time from the sender to the receiver.

image-20210530165433617

(3) Confirm the loss:

If the acknowledgment or acknowledgment packet sent by the receiver is lost during transmission, it will cause the sender to retransmit over time, and the receiver will receive duplicate packets.

In order to avoid transmission errors such as packet duplication, the sender must add a sequence number to each packet before sending the packet.

For the stop-and-wait protocol, due to the feature of stop-waiting, it is only necessary to ensure that the sequence number of the packet sent each time is different from the packet sequence number sent last time, so only one bit is needed for numbering, that is, sequence number 0 and sequence number 1.

When the receiver finds that the packet is repeated, it discards it, and at the same time sends a confirmation packet to the sender, so as to prevent the sender from retransmitting the packet again.

image-20210530170513623

(4) Confirmation of being late:

The receiver sends an acknowledgment packet after receiving the sender's packet 0, but for some reason, the acknowledgment packet is late, causing the sender to timeout and retransmit packet 0. At this time, the sender receives the late acknowledgment packet, so it sends the next packet 1, and the receiver discards the retransmitted packet 0 and sends an acknowledgment packet, and this acknowledgment packet makes the sender think it is an acknowledgment response to packet 1.

Therefore, in order to solve this problem, the confirmation group also needs to be numbered.

image-20210530171513396

For the point-to-point channel of the data link layer, the round-trip time is relatively fixed, and there will be no problem of late confirmation. Therefore, the stop-and-wait protocol is only implemented on the data link layer, and the confirmation group number does not need to be assigned.

Precautions:

image-20210530172010554

(5) Stop waiting for the channel utilization of the protocol:

image-20210530172525378

TD: The transmission delay of the sender to send the data packet.

RTT: The round-trip time between the sending and receiving parties.

TA: The transmission time delay for the receiver to send the acknowledgment packet.

image-20210530173038207

When the round-trip delay RTT is much greater than the data frame transmission delay TD (such as using satellite links), the channel utilization will be very low.

If retransmission occurs, the channel utilization rate will be lower for useful information.

In order to overcome the shortcoming of the low channel utilization rate of the stop-and-wait protocol, two other protocols have emerged: the fallback N frame protocol and the selective retransmission protocol.

Practice questions:

image-20210530173934457 image-20210530174243569

3.4.3 Realization Mechanism of Reliable Transmission - Fallback N Frame Protocol GBN

At the same time, only one packet can be sent using the stop-and-wait protocol, while multiple packets can be sent using pipeline transmission.

image-20201012190027828

On the basis of pipeline transmission, the fallback N frame protocol uses the sending window to limit the number of packets that the sender can send continuously.

image-20210530201853476

(1) No error condition:

Data packets 0 to 4 in the sending window of the sender are correctly transmitted to the receiving side, that is, there is no out-of-order or bit error. The receiving side accepts them in order. Every time one is received, the receiving window slides forward one position, and sends a confirmation packet for the received packet to the sender. Every time the sender receives a confirmation packet, the sending window slides forward one position, so that a new sequence number falls into the sending window.

Cumulative acknowledgment : The receiver does not have to send acknowledgment packets one by one for the received packets, but can send acknowledgment to the last packet that arrives in sequence after receiving several data packets (determined by the specific implementation).

Example: The sender sends data packets numbered 0 to 4, and arrives at the receiver correctly through the transmission line. After receiving 0 and 1, the receiver sends ACK1 confirmation packet, and after receiving 2, 3, and 4, sends ACK4 confirmation packet. If ACK1 is lost during transmission, the sender only receives ACK4, and the sender can determine that the data packets with sequence number 4 and before have been correctly accepted, so the sending window moves forward 5 positions.

So even if the acknowledgment packet is lost, the sender may not have to retransmit.

The advantages of cumulative confirmation : it can reduce the overhead of the receiver, reduce the occupation of network resources, etc.;

Disadvantage : It cannot reflect the information that the receiver has correctly accepted the packet in time like the sender.

(2) In case of error:

image-20210530203911483

The sender sent data packets with serial numbers 5, 67, 0, 1. During the sending process, a code error occurred in packet No. 5. The receiver found the error through the error detection code, so it discarded the packet, and the sequence number of the subsequent arriving packet was inconsistent with the sequence number in the receiving window, so it was also discarded, and confirmed the last packet received in order, that is, sending ACK4. Every time a data packet was discarded, an ACK4 was sent. Retransmit immediately when the timeout timer expires.

As for retransmitting immediately after receiving several repeated confirmations, it is determined by the specific implementation.

image-20210530204821818

In this example, it is assumed that the sender will not trigger retransmission after receiving 4 duplicate acknowledgment packets. When the timeout timer reaches the specified time, the sender will resend the packets in the window. Although the packets with sequence numbers 6, 7, 0, and 1 have all arrived at the receiver correctly, the packets with sequence number 5 are not accepted due to code errors, so they are also implicated and not accepted. The sender has to retransmit these packets. This is the so-called Go-back-N (back N frame).

It can be seen that when the quality of the communication line is not good, the channel utilization rate of the fallback-N frame protocol is not higher than that of the stop-and-wait protocol.

(3) When the size WT of the sending window exceeds the upper limit of the value range

WT exceeds the upper limit of the value range, and WT is set to 8

image-20210530205742458

The sender correctly sends the data packets from 0 to 7 to the receiver through the transmission line, and the receiver sends the confirmation packet ACK7 after receiving it, but ACK7 is lost during the sending process, which will trigger the sender’s timeout retransmission mechanism, and the sender resends the 0 to 7 packets. At this time, the receiver cannot distinguish whether it is a new packet or an old packet, and then a transmission error such as packet repetition occurs.
image-20210530210224827

Therefore the size of the sending window cannot exceed its upper limit.

The fallback N frame protocol uses the sending window to limit the number of consecutively sent packets on the basis of pipeline transmission, and is a continuous ARQ protocol.

During the working process of the protocol, the sending window and the receiving window are constantly moving forward, so this type of protocol is also called a sliding window protocol.

summary:

image-20201012202222138

practise:

image-20210530211234933

3.4.4 Realization Mechanism of Reliable Transmission—Selective Retransmission Protocol SR

The receiving window WR size of the fallback N frame protocol is only 1, so the receiver can only accept the correctly arrived data packets in order, and a bit error in one data packet will lead to timeout retransmission of subsequent data packets, which is obviously a great waste of communication resources.

In order to further improve performance, it is possible to try to retransmit only errored data packets . Therefore, the size WR of the receiver's receiving window should be greater than 1 , so that the receiver first accepts those data packets that arrive out of order but have no error codes and whose sequence numbers fall within the receiving window , and deliver them to the upper layer together after all missing packets are collected . This is the selective retransmission protocol .

Note: In order to select the retransmission protocol, in order to make the sender retransmit only the errored data packets, the receiver can no longer use cumulative acknowledgment , but needs to confirm each correctly received packet one by one .

(1) Select the working principle of the retransmission protocol:

image-20210530222002057

The sender sends packets 0 to 3, but packet 2 is lost during the transmission process. Packets 0, 1, and 3 arrive at the receiver correctly. The receiver receives packets 0 and 1, and sends confirmation packets 0 and 1. The receiving window slides forward two positions. The receiver accepts packet 3 and sends confirmation packet 3, but the receiving window cannot slide forward because the data packet 3 is a data packet that did not arrive in order.

image-20210530222718503

Each time the sender receives an acknowledgment packet, the sending window slides forward one position. The sender accepts confirmation packets No. 0 and No. 1, and the sending window slides two positions forward. After receiving the confirmation packet No. 3, the sender records that the data packet No. 3 has been confirmed, so that the data packet will not be resent over time. The sender sends data packets No. 4 and No. 5, and the receiver sends a confirmation packet after receiving it. After receiving the confirmation packet, the sender records that No. 4 and No. 5 have received confirmation. When the timeout timer of the No. 2 packet reaches the time, the sender will retransmit the timeout, and the receiver accepts the No. 2 packet and sends a confirmation packet. At this time, the receiving window can slide forward 4 positions; the sender accepts the confirmation packet. At this time, the sending window can slide forward 4 positions.

image-20210530223105319

image-20210530223921359

(2) The size of the sending window and receiving window:

image-20210530224156353

What happens if the window size exceeds the value range?

image-20210530224513291

Set the size of the sending window and the receiving window to more than half of the total sequence number, here it is set to 5.

The sender sends 0, 1, 2, 3, 4 data packets, and the receiver sends confirmation packets one by one after receiving the packets, but the packet number 0 is lost during the transmission process, which will cause the sender to timeout and retransmit the packet 0.

image-20210530224921101

The receiving side cannot tell whether the No. 0 packet is a new packet or an old packet. If it still accepts it, a transmission error of packet duplication will occur.

So the size of the sending window and receiving window can only be half of the total number of sequence numbers.

summary:

image-20201012205133924

3.5 Point-to-Point Protocol PPP

Point-to-point protocol PPP (Point-to-Point Protocol) is currently the most widely used point-to-point data link layer protocol.

If a user wants to access the Internet, he needs to connect to an ISP that provides Internet services before he can access the Internet.

These ISPs have applied for a batch of IP addresses from the Internet management agency, and the user's computer can become a host on the Internet only after obtaining the legal IP address assigned by the ISP.

When the user computer communicates with the ISP, the data link layer protocol used is usually the PPP protocol.

Published in 1999, the PPP protocol running on Ethernet is called PPP over Ethernet, or PPPoE for short.

image-20210531000017038

The PPP protocol was formulated by the Internet Engineering Task Force IETF in 1992. After revisions in 1993 and 1994, the current PPP protocol has become a formal standard of the Internet [RFC1661, RFC1662]. ,

The components of the PPP agreement:

The PPP protocol provides a standard method for transmitting various protocol datagrams on point-to-point links, and mainly consists of the following three parts:

  • Encapsulation methods for various protocol datagrams (encapsulation into frames)

  • Link Control Protocol LCP: Connections for establishing, configuring, and testing data links

  • A set of Network Control Protocols NCPs: each of which supports different network layer protocols

    image-20210531001011719

The frame format of the PPP protocol:

image-20201012211826281

Transparent transmission of PPP protocol:

(1) Byte-oriented asynchronous links: Byte stuffing (inserting "escape characters")

image-20201012212148803

(2) Bit-oriented synchronous link: bit stuffing method (insert "bit 0")

image-20201012212255550

Error detection:

image-20201012212558654

The data link layer using the PPP protocol does not provide reliable transmission upwards.

Working status:

image-20201012213021860

It can be seen that the PPP protocol is not a pure data link layer protocol, it also includes the content of the physical layer and the network layer.

3.6 Media Access Control

In order to make the data link layer better adapt to various LAN standards, the IEEE 802 committee split the data link layer of the LAN into two sublayers:

  1. Logical Link Control LLC (Logical Link Control) sublayer
  2. Medium Access Control MAC (Medium Access Control) sublayer

The content related to the access to the transmission medium is placed in the MAC sublayer, while the LLC sublayer has nothing to do with the transmission medium.

Regardless of the LAN protocol, it is transparent to the LLC sublayer.

image-20201013201133903

3.6.1 Basic concepts of media access control

If multiple devices send information on the shared channel at the same time, the signals will collide on the shared medium, causing the information to fail to be sent.

image-20210531191752119

A problem to be considered in the shared channel is how to coordinate the occupancy of the shared channel by multiple stations, that is, media access control (MAC).

image-20201013152453425

With the development of technology, the maturity of switching technology and the reduction of cost, the switched LAN with higher performance using point-to-point links and link layer switches has completely replaced the shared LAN in the wired field, but due to the broadcast nature of the wireless channel, the wireless LAN still uses shared media technology.

3.6.2 Media Access Control - Static Channel Allocation

Channel multiplexing:

Multiplexing: Simultaneously transmit signals of multiple users through one physical line.

When the transmission capacity of the transmission medium in the network is greater than the total traffic transmitted by multiple single channels, channel multiplexing technology can be used to establish multiple communication channels on one physical line to fully utilize the bandwidth of the transmission medium.

image-20210531200100957

If a multiplexer is used on the sender side and a demultiplexer is used on the receiver side, multiple users can communicate on the same physical line.

Common channel multiplexing techniques:

  • Frequency Division Multiplexing FDM
  • TDM
  • WDM
  • code division multiplexing CDM

(1) Frequency division multiplexing FDM:

image-20210531201612211

The frequency band resources of the transmission line are divided into multiple sub-bands to form multiple sub-channels, and isolation frequency bands need to be reserved between the sub-channels to avoid interference between the sub-channels.

When multiple signals are input to a multiplexer, the multiplexer modulates each signal onto a different frequency carrier, and the corresponding demultiplexer at the receiving end separates each signal through filtering, and restores the synthesized multiplexed signal to the original multiple signal.

All users of frequency division multiplexing occupy different frequency band resources at the same time and communicate in parallel.

(2) Time division multiplexing TDM:

image-20210531201542553

Time-division multiplexing technology allocates bandwidth resources on the transmission line to different users in turn according to time slots, and each pair of users only uses the line to transmit data in the allocated time slots.

Time-division multiplexing technology divides time into time-division multiplexing frames of equal length, and each time-division multiplexing user occupies a time slot with a fixed sequence number in each time-division multiplexing frame.

All users of time division multiplexing occupy the same frequency bandwidth at different times.

(3) Wavelength division multiplexing WDM:

image-20210531202149379

Wavelength division multiplexing is the frequency division multiplexing of light.

As shown in the figure above, these are 8 optical carriers with a transmission rate of 2.5Gb/s, and their wavelengths are all 1310nm. After being modulated by the optical modulator, the wavelength is converted to 1550-1561.2nm respectively, and each optical carrier is separated by 1.6nm. These 8 optical carriers with very close wavelengths pass through the optical multiplexer (or combiner) and are transmitted on the same optical fiber. Therefore, the total data transmission rate is 8*2.5Gb/s = 20G/s.

Optical signals will attenuate after being transmitted for a certain distance, so amplifiers are needed to amplify them to continue transmission, such as the erbium-doped fiber amplifier in the figure.

(4) Code division multiplexing CDM:

Since this technology is mainly used for multiple access, the more commonly used term is Code Division Multiple Access (CDMA).

Frequency-division multiplexing FDM and time-division multiplexing TDM can also be used for multiple access, and the corresponding terms are frequency-division multiple access FDMA and time-division multiple access TDMA.

Multiplexing and Multiple Access:

image-20210531204554072

Multiplexing is for transmission lines, and multiple access is for users.

Multiple access must be multiplexed, and multiplexing is not necessarily for multiple access.

Different from frequency division multiplexing and time division multiplexing, each user of code division multiplexing can occupy the same frequency band resource for communication within the same time.

Since each user uses a specially selected different code pattern, there is no interference between users.

Code division multiplexing was originally used in military communications, because the signal sent by this system has strong anti-interference ability, and its spectrum is similar to white noise, which is not easy to be detected by the enemy.

With the advancement of technology, the price and volume of CDMA equipment have dropped significantly, so it has been widely used in civilian mobile communications.

chip:

In CDMA, each bit time is further divided into m short intervals, called chips (Chip). Usually the value of m is 64 or 128.

For simplicity, the example here assumes that m is 8.

Each station using CDMA is assigned a unique m bit chip sequence (Chip Sequence).

  • If a station wants to send bit 1, it sends its own sequence of m bit chips.

  • A station that wants to send a 0 bit sends the one's complement of its own sequence of m bit chips.

image-20210531210903243

This communication method is called Direct Sequence Spread Spectrum DSSS.

The selection principle of chip sequence is as follows:

  1. The code chip sequence assigned to each station must be different, and a pseudo-random code sequence is often used in practice.
  2. The chip sequences assigned to each station must be mutually orthogonal, that is, the normalized inner product is 0.

image-20210531212421922

image-20210531212849737

Examples of code division multiple access applications:

image-20210531213244947

Practice questions:

image-20210531223536390

Parse:

image-20210531223655487

The result is 1, so A sent bit 1.

image-20210531223737807

The result is -1, so B sent bit 0.

image-20210531223813910

The result is 0, so C sent no bits.

image-20210531223913879

The result is 1, so station D sends bit 1.

image-20210531224015294

Parse:

image-20210531224332724

3.6.3 Media Access Control - Dynamic Access Control

  • Ethernet is a local area network technology. The previous Ethernet was a bus structure, but now Ethernet is connected to the network through switches, so it has become a star structure.

But logically, Ethernet still adopts bus topology and CSMA/CD bus technology.

(1) Random access - CSMA/CD protocol

basic concept:
image-20201013211620687

Multiple Access MA : Multiple sites are connected to the same bus and compete to use the bus.

Carrier Sense CS : Each station first detects whether other stations are sending frames on the bus when sending frames.

  • This frame is sent if the bus is detected to be idle for 96 bit times .
  • If it is detected that the bus is busy, continue to detect and wait for the bus to turn to 96-bit idle time, and then send this frame.

The 96-bit time refers to the time it takes to send 96-bit time, also known as the minimum interval between frames.

Collision detection : Each station that is sending a frame detects a collision while sending, and stops sending if a collision is detected.

Ethernet also adopts a measure called enhanced collision . Once a station sending a frame detects a collision, in addition to immediately stopping sending frames, it also sends a 32-bit or 48 -bit man-made interference signal, so that there are enough collision signals so that all stations can detect the collision.

Contention period:

image-20210601211513664

image-20210601211604129

Only when the sender has not detected a collision after the contention period can it be sure that there is no collision in this transmission.

The more hosts that send frames in the Ethernet, the greater the end-to-end round-trip propagation delay, and the greater the probability of collision. Therefore, shared Ethernet cannot connect too many hosts, nor can the bus used be too long.

10Mb/s Ethernet defines the contention period as 512-bit transmission time , that is, 51.2us, so the bus length cannot exceed 5120m, but other factors such as signal attenuation must also be considered. Ethernet stipulates that the bus length cannot exceed 2500m .

Minimum frame length:

image-20210602000947266

Assume that host A sends a very short frame to host D, and detects collisions while sending. Host A finishes sending the frame soon, and then no longer performs collision detection on the frame. During the transmission of the frame, host C also sends a frame. Host C sends the frame immediately after detecting the 96-bit idle time on the bus. resend the frame.

The frame length of the Ethernet using the CSMA/CD protocol cannot be too short.

Ethernet stipulates that the minimum frame length is 64 bytes, that is, 512 bits, and the 512-bit time is the contention period.

  • If the data to be sent is very small, some padding bytes need to be added to make the frame length not less than 64 bytes.

Ethernet's minimum frame length ensures that the host can detect whether a frame has collided during transmission before the frame is sent.

  • If no collision occurs during the contention period (a total of 64 bytes are sent), the data sent subsequently will definitely not collide.
  • If a collision occurs during the contention period, the transmission will be terminated immediately. At this time, the data that has been sent must be less than 64 bytes, so any frame that is less than 64 bytes is an invalid frame terminated abnormally due to collision, and the receiver will discard it.
Maximum frame length:
image-20210602001051373

If the frame is very long, the sender will occupy the bus resources all the time, even if other hosts have frames to send, there is no way. In addition, because the frame is very long, the buffer of the receiver may not be able to hold the frame and overflow. Therefore there should be a limit to the maximum length of a frame.

image-20210601231720786

For example, in the figure above, the maximum data payload field of the Ethernet version 2 MAC frame is 1500 bytes, plus 18 bytes for the header and tail, and the maximum frame length is 1518 bytes. The minimum length of the data payload field is 46 bytes, plus 18 bytes for the header and trailer, and the minimum length of the frame is 64 bytes.

image-20210601231950049

The same is true for the above picture

Calculation method of backoff time:

Truncated binary exponential backoff algorithm:

image-20210602000833474

If collisions occur continuously, it indicates that there are more hosts competing for the channel. The above-mentioned algorithm can make the average delay time of retransmission increase with the number of retransmissions , thus reducing the probability of collision.

When the number of retransmissions is as many as 16 and still unsuccessful, it indicates that there are too many hosts intending to send frames at the same time, so that collisions occur continuously, and the frame is discarded and reported to the upper layer.

Channel Utilization:

image-20210602001440670

Therefore, the average time to send a frame is = multiple contention periods + a frame sending experiment T0 + one-way end-to-end propagation delay t.

Consider the following ideal situation:

  • The frames sent by each host will not collide.
  • The master sends frames as soon as the bus is free.

So the time required to send a frame is T0+t, and the delay of sending a frame is T0, so

image-20210602002008649

In order to improve channel utilization, the value of a should be as small as possible, then,

  • The value of t should be as small as possible, indicating that the end-to-end distance of Ethernet should be limited and should not be too long;
  • The value of T0 should be as large as possible, indicating that the Ethernet frame length should be as large as possible, but as mentioned above, too long a frame is not good.
Frame sending process:

image-20210602002525167

Frame acceptance process:

image-20210602002630132

Practice questions:

image-20210602003609977

(2) Random access - CSMA/CA protocol

Protocol used by bus LAN: CSMA/CD

Protocol used by wireless LAN: CSMA/CA

basic concept:

Carrier sense multipoint access/collision avoidance:

Why can't CSMA/CD be used in wireless LAN?

Answer: In WLAN, carrier sense and multiple access CSMA can still be used, but collision detection cannot be used for the following reasons:

  • Due to the special transmission conditions of the wireless channel, the dynamic range of its signal strength is very large, and the signal strength received by the wireless network card is often much smaller than the strength of the sent signal (may be a million times different). If collision detection is to be implemented on a wireless channel, the hardware requirements are very high .
  • Due to the particularity of radio wave propagation, there is the problem of hidden stations , and the significance of collision detection is not great.

Therefore, the 802.11 WLAN uses the CSMA/CA protocol to implement the collision avoidance function instead of the collision detection function.

Since it is impossible to avoid all collisions and the bit error rate of the wireless channel is high, the 802.11 standard** also implements the confirmation mechanism (stop and wait protocol)** of the data link layer to ensure the correctness of the data.

The 802.11 MAC layer standard defines two different media access control methods:

  • Distributed coordination function DCF: In the DCF mode, there is no central control station, and each station uses the CSMA/CA protocol standard to obtain the transmission right by competing for the channel, which is the default method of 802.11.
  • Point coordination function PCF: The PCF method uses a centralized control access algorithm and is an optional method for 802.11, but it is rarely used in practice.
Interframe interval IFS (InterFrame Space):

The 802.11 standard stipulates that all stations must continue to detect that the channel is idle for a specified period of time before sending frames. This period of time is called the inter-frame interval.

The length of the interframe space depends on the priority of the frames to be sent :

  • High-priority frames need to wait for a shorter time, so they can be sent first.
  • Low priority frames need to wait longer.

Two commonly used interframe intervals :

  • Short inter-frame space SIFS: The length is 28us, which is the shortest time interval and is used to separate the frames belonging to a conversation. A station should be able to switch from sending mode to receiving mode during this time. The frame types that use SIFS include ACK frames, CTS frames, data frames that are too long and fragmented, and all frames that answer AP inquiries and any frames sent by the access point AP in PCF mode.
  • DCF interframe interval DIFS: The length is 128us, which is longer than the short frame interframe interval SIFS, and is used to send and manage data frames in DCF mode.
working principle:

image-20210603215150279

When the sender detects that the channel is idle, it sends the first frame after the DIFS interval, and the receiver sends an ACK confirmation frame after receiving the data after the SIFS interval.

Thinking: Why does the sender wait for the inter-frame interval DIFS before sending a data frame after detecting that the channel is idle?

Answer: This is because other stations may have high priority frames to send. If so, allow high priority frames to be sent first.

Thinking: Why does the receiver have to wait for the inter-frame interval SIFS before sending a confirmation frame after correctly receiving the data frame?

Answer: SIFS is used to divide each frame of a conversation, and the sender switches from the sending mode to the receiving mode during this period.

image-20210603223810502

When the channel changes from the busy state to the idle state, and after the inter-frame interval DIFS, other wireless stations that want to send data need to back off for a random period of time before sending.

Thinking: After the channel changes from busy to idle and the inter-frame interval DIFS passes, why do we need to back off for a period of random events before sending data?

Answer: Prevent collisions caused by multiple stations sending data at the same time.

So when to use the backoff algorithm?

  • The channel is detected to be busy before the data frame has been sent
  • Every time a data frame is retransmitted
  • When the next frame is to be sent continuously after each successful transmission (this is to avoid a station occupying a channel for a long time)

In other words: when a station detects that the channel is idle, and the data frames sent are not data frames sent continuously after one frame is sent, then there is no need to use the backoff algorithm.

Backoff algorithm:

When executing the backoff algorithm, the station sets a random time for the backoff timer

  • Start sending data after the backoff timer has been decremented to zero
  • When the time of the backoff timer has not been reduced to zero, and the channel is detected to be busy from the idle state, the time of the backoff timer is frozen, the channel becomes idle again, and after the DIFS interval, the backoff timer is restarted.

When performing the i-th backoff, randomly select one of the time slot numbers {0, 1..., 2 2 +i -1} for the backoff time, and then multiply it by the basic backoff time (that is, the length of a time slot) to obtain a random backoff time. This is done to reduce the probability that different stations choose the same backoff time. After reaching the 6th retreat times, it will no longer increase.

image-20210603225359546

Channel reservation and virtual carrier sense:
  1. Channel reservation:

image-20210603232431476

In order to reduce the probability of collision and the impact of collision as much as possible, the 802.11 standard allows the stations to send data to reserve channels .

(1) The source station sends a short control frame before sending the data frame, called RTS (Request To Send), which includes the source address, destination address, and the duration required for this communication.

(2) If the destination station correctly accepts the RTS frame sent by the source station, and the media is idle, it sends a response control frame called CTS (Clear To Send), which also includes the time required for this communication (copy this duration from the RTS frame to the CTS).

(3) After receiving the CTS frame, the source station waits for an inter-frame interval SIFS before sending data.

(4) After the destination station correctly receives the data frame sent by the source station, after waiting for the time SIFS, it sends an acknowledgment frame ACK to the source station.

Other stations except the destination station and the source station , after receiving the CTS frame, delay access to the WLAN , thus ensuring that the communication between the source station and the destination station will not receive interference from other stations.

If the RTS frame collides and the source station cannot receive the CTS frame, it needs to execute the backoff algorithm to retransmit the RTS frame.

Since the RTS frame and the CTS frame are very short, the probability of sending a collision, the overhead caused by the collision, and the overhead itself are very small.

For general data frames, the transmission delay is often greater than the propagation delay, and the probability of collision is high. Once the data frame needs to be retransmitted after collision, more time and resources will be wasted. Therefore, it is worthwhile to reserve the channel at a small cost.

The 802.11 standard specifies 3 situations for users to choose:

  • Use RTS frame and CTS frame
  • Not applicable to RTS frame and CTS frame
  • Only when the length of the data frame exceeds a certain value, the RTS frame and the CTS frame are used
  1. Virtual carrier sense:

In addition to the RTS frame and CTS frame will carry the time required for communication, the data frame will also carry the time required for communication, which is called the virtual carrier sense mechanism of 802.11.

Due to the use of the virtual carrier sense mechanism, other stations only need to monitor any one of the RTS frame, CTS frame, or data frame to know the time when the channel is occupied, without actually monitoring the signal on the channel, so the virtual carrier sense mechanism can reduce the collision problem caused by hidden stations.

image-20210603233820484 image-20210603233844487

Practice questions:

image-20210603234308971 image-20210603234500720

3.7MAC address, IP address and ARP protocol

  • The MAC address is the address used by the MAC sublayer of Ethernet and belongs to the data link layer
  • The IP address is the address used by the Internet layer of the TCP/IP architecture and belongs to the Internet layer
  • The ARP protocol can obtain its MAC address through the IP address assigned to the device, which belongs to the Internet layer

MAC address

1. Basic introduction:

image-20210604001716590 image-20210604002055581

Frames sent by each host in the shared channel must carry addresses identifying the sending host and the receiving host, which are called MAC addresses.

The MAC address is generally solidified in the EEPROM of the network card (network adapter), so the MAC address is also called the hardware address.

image-20210604002405162

Generally, the user host will contain two network adapters: a wired LAN adapter (wired network card), and a wireless LAN adapter (wireless network card).

Each network adapter has a globally unique MAC address, and switches and routers often have many network interfaces, so they have many MAC addresses.

Therefore, strictly speaking, the MAC address is a unique identifier for each interface on the network , rather than a unique identifier for each device on the network.

2. MAC address format of IEEE 802 LAN:

image-20210604183029045

There are 48 bits in total, divided into 6 bytes.

When b0 is set to 0, it indicates that the address is a unicast address, and when it is set to 1, it indicates that the address is a multicast address, also called a multicast address.

When b1 is 0, it means that the address is globally managed, that is, it is globally unique; when it is 1, it means that the address is managed locally.

image-20210604184145979

3. The sending order of MAC address in IEEE 802 LAN:

image-20210604184519178

Byte sending order: first byte —> sixth byte

Bit transmission order within a byte: b0 —> b7

4. Unicast MAC address, multicast MAC address and broadcast MAC address:

(1) Unicast MAC address:

image-20210604185425500

The NIC of host A finds that the destination MAC address of the unicast frame is not its own MAC address, and discards it.

The network card of host C finds that the destination MAC address of the unicast frame matches its own MAC address, accepts it and submits it to the upper layer for processing.

(2) Broadcast MAC address:

image-20210604185717443

Host A and host C find that it is a broadcast frame, both accept it and hand it over to the upper layer for processing.

(3) Multicast MAC address:

image-20210604190600969

Shared standard multicast addresses must not be used when configuring multicast group lists for hosts.

IP address

1. Basic introduction:

image-20201015104441580

2. Changes in IP address and MAC address during datagram forwarding:

image-20210605000041432

The source IP address and destination IP address will not change during data packet forwarding.

During data packet forwarding, the source MAC address and destination MAC address change link by link or network by network.

image-20201015105619301

How to find out the corresponding MAC address from the IP address requires the use of the ARP protocol.

ARP protocol

Address Resolution Protocol ARP Protocol

image-20201015114052206

When host B wants to send a data packet to host C, it will search its own ARP cache table to see if there is a MAC address corresponding to the host CIP address, but it cannot find it. At this time, host B will send an ARP request message (broadcast) to obtain the MAC address of host C.

image-20210605001838702

All hosts on the bus can receive the broadcast frame. After receiving the broadcast frame, the network card of host A passes it to the upper layer for processing. The ARP process of the upper layer parses the ARP request message and finds that the inquired IP address is not its own IP address, so ignore it.

image-20201015114811501

After host C receives it, it will be processed by the upper layer. When it finds that the inquired IP address is its own IP address, it first records the IP address and MAC address of host B carried in the request message into its own ARP cache table, and then sends an ARP response message (unicast ) .

In this way, host B updates the ARP cache table after receiving the ARP response message, and then can send data.

Each record in the table has its type, which is divided into dynamic type and static type:

  • Dynamic type: obtained automatically by the host, with a life cycle of two minutes. When the life cycle ends, the record is automatically deleted.
  • Static type: manually configured by users or network maintenance personnel. The statement period is different under different operating systems.

The ARP protocol can only be used on a link or a network, and cannot be used across networks.

3.8 The difference between a hub and a switch

1. Hub

image-20201015144628691

  • Traditional Ethernet used thick coaxial cables, then evolved to use thin coaxial cables, and finally evolved to use twisted pair cables.

  • The Ethernet using the hub is still a bus structure logically, and still uses the CSMA/CD protocol to coordinate the hosts. It can only work in half-duplex communication, and the sending and receiving frames cannot be carried out at the same time.

Use a hub to extend Ethernet at the physical layer:

image-20210605154643851

2. Switch

image-20210605155613930

When a host sends a unicast frame, the switch will send the unicast frame to the destination host instead of all hosts on the network.

A switch usually has multiple interfaces, each of which can be directly connected to a host or another switch, and generally work in full-duplex mode.

The switch has parallelism, and can connect multiple pairs of interfaces at the same time, so that multiple pairs of hosts can communicate at the same time, without collision, without using CSMA/CD protocol.

Switches generally have interfaces with multiple rates, for example: various combinations of 10Mb/s, 100Mb/s, 1Gb/s, and 10Gb/s interfaces.

After the switch receives the frame, it searches the frame switching table for the interface number corresponding to the destination MAC address of the frame, and then forwards the frame through the interface.

A switch is a plug-and-play device, and its internal frame switching table is automatically established through a self-learning algorithm.

There are two forwarding methods for the switch to frame:

  • store and forward
  • Straight-through switching: use hardware-based cross-connect matrix (the switching delay is very small, but does not check whether the frame has errors)

3. Comparing Hubs and Switches

prerequisites:

  1. ignore ARP process
  2. Assume that the frame switching table of the switch has been learned

(1) For unicast:

image-20210605165652623 image-20210605165720666

  • Hub: Unicast frames are sent to other hosts on the network, and the network cards of each host are identified.
  • Switch: After receiving the unicast frame, the switch forwards the unicast frame to the destination host according to the frame switching table and the destination MAC address.
  • Summary: There is a difference

(2) For broadcast frames:

image-20210605165752747 image-20210605165805394

  • Hub: The broadcast frame will be sent to each host on the network, and the network card of each host will receive it after detecting that it is a broadcast frame.
  • Switch: After the switch receives the broadcast frame, it detects that it is a broadcast frame, and then forwards it through other interfaces other than the interface that the frame entered.
  • Summary: no difference

(3) When multiple hosts send unicast frames to one host at the same time:

image-20210605165853002 image-20210605165913072

  • Hub: Collisions occur because they are sent at the same time, and the collided frame is propagated to each host on the bus.
  • Switch: When the switch receives multiple frames, it will buffer them and forward them to the destination host one by one without collision.

(4) The difference between using a hub to expand Ethernet and using a switch to expand Ethernet:

Unicast:

image-20201015155408692

broadcast:

image-20201015155440402 image-20201015155706698
  • hub: broadcast domain increased, collision domain increased
  • Switches can isolate collision domains

4. Summary

image-20201015160146482

The performance of the Ethernet switch working at the data link layer far exceeds that of the hub working at the physical layer, and the price is not expensive, which makes the hub gradually eliminated by the market.

3.9 Process of Ethernet switch self-learning and frame forwarding

1. Examples of self-learning and forwarding frames:

The following examples assume that each host knows the MAC addresses of other hosts on the network (no ARP required)

A —> B

image-20201015161458528

  1. A sends a frame to B, which enters switch 1 from interface 1

  2. Switch 1 writes the source MAC address of the frame into the frame switching table, and checks whether the frame switching table has a record of the destination MAC address

  3. If not found, broadcast the frame to all interfaces except interface 1

  4. Host C detects that the destination MAC address is not its own address, and discards it. Host B detects that the destination MAC address is its own address and accepts

  5. The frame is forwarded from interface 4 to interface 2 of switch 2, switch 2 writes the source MAC address A of the frame into the frame switching table, and checks whether the frame switching table has a record of the destination MAC address

  6. If not found, broadcast the frame to all interfaces except interface 2

  7. Hosts D, E, and F detect that the destination MAC address is not their own, and discard

B —> A

image-20201015162310922

  1. The unicast frame sent by host B enters switch 1 through interface 3

  2. Switch 1 records the source MAC address B and the corresponding interface 3 in the frame switching table, and checks whether the frame switching table has a record of the destination host

  3. found, the frame is forwarded directly from interface 1

E —> A

image-20201015162622462

  1. The unicast frame sent by E enters switch 2 from interface 3,

  2. The switch 2 records the source MAC address E and the corresponding interface 3 in the frame switching table, and searches whether there is a record of the destination host in the frame switching table.

  3. Found, switch 2 forwards the frame from interface 2 to interface 4 of switch 1

  4. Switch 1 records the source MAC address E and the corresponding interface 4 into the frame switching table, and checks whether there is a record of the destination host in the frame switching table

  5. found, switch 1 forwards the frame out of interface 1

G —> A

Host A and host G are connected by a hub and share a bus

image-20201015163157140

  1. When host G sends a data frame, both host A and interface 1 of switch 1 can receive it.

  2. Host A detects that the destination MAC address is its own address after receiving it, and receives it.

  3. The data frame enters switch 1 from interface 1, and the switch checks whether there is a record of the destination host in the frame switching table

  4. Found, but found that the forwarding interface is the interface that the frame entered, so the frame was discarded.

Each record in the frame switching table has its effective time and will be automatically deleted after expiration, because the correspondence between MAC addresses and interfaces is not permanent. For example, the interface of the switch is replaced by the host, or the network card of the host is replaced, which will cause the record to become invalid.

2. Summary:

image-20201015170656500

image-20201015170739679

3.10 Spanning Tree Protocol STP for Ethernet Switches

1. How to improve the reliability of Ethernet

image-20210605203758537

As shown in the figure, when the link between A and B fails, communication between A and B cannot be performed. Therefore, it is necessary to improve the reliability of Ethernet by adding redundant links .

image-20201015171515481

As shown in the figure, a link is added between BCs. However, adding redundant links can cause some problems— the formation of network loops .

Network loops can cause some problems:

  • Broadcast storm: Data frames are forwarded in the network all the time , consuming a lot of network resources, making the network unable to forward other data frames normally.

  • The host receives repeated broadcast frames: consumes a lot of host resources

  • The frame exchange table of the switch fluctuates (drifts): During the broadcast storm, the data in the frame exchange table on the switch is constantly refreshed.

image-20210605222216758

2. Spanning tree protocol solves the loop problem

In order to increase redundant links and improve network reliability while avoiding the impact of network loops, Ethernet switches use the spanning tree protocol.

Regardless of the physical connection between the switches, the switch can automatically calculate and build a logically loop-free network, that is, its logical topology is a tree.

The final logical tree structure must ensure that the entire network can be connected.

image-20210605223248525

3.11 Virtual Local Area Network

1. Overview of virtual local area network (VLAN)

As the scale of switched Ethernet expands, the broadcast domain also expands accordingly, and a huge broadcast domain will bring many disadvantages:

  • broadcast storm
  • Difficult to manage and maintain
  • potential security issues

Many protocols in the TCP/IP protocol stack use broadcasting:

  • Address Resolution Protocol ARP
  • Routing Information Protocol RIP
  • Dynamic Host Configuration Protocol DHCP

Methods for splitting broadcast domains:

  • Broadcast domains can be isolated using routers :

    • Routers do not forward broadcast packets by default
    • But the router is very expensive, it is not practical to use the router to isolate
  • Virtual local area network (VALN) technology:

    • A technique for dividing devices within a LAN into logical groups independent of physical location that share common requirements.

    image-20210605224720717

2. Implementation mechanism of virtual local area network (VLAN)

First, the switch needs to be able to implement the following two functions:

  • Capable of processing frames with VLAN tags, also called IEEE 802.1Q frames.
  • Each port of a switch can support different port types, and different port types process frames in different ways.

(1) IEEE 802.1Q frame:

  • Also called Dot One Q frame, it extends the Ethernet MAC frame and inserts a 4-byte VLAN tag.

  • The last 12 bits of the VLAN tag are called the VLAN identifier VID , which uniquely marks which VLAN the Ethernet frame belongs to.

  • The value of VID is 0-4095 (0-2 12 -1), where 0 and 4095 are not used to represent VLAN

  • 802.1Q frames are handled by the switch, not the host.

    • When the switch receives an ordinary Ethernet frame, it will insert a 4-byte VLAN tag into an 802.1 Q frame, referred to as "tagging"
    • When a switch forwards an 802.1Q frame, it may remove its 4-byte VLAN tag and convert it into a normal Ethernet frame, referred to as "de-tag"

image-20210605225413940

(2) The port type of the switch:

There are three types of ports on a switch:

  • Access
  • Trunk
  • Hybrid:

Cisco switches do not have Hybrid ports,

The default VLAN ID of each port of the switch:

  • It is called Native VLAN on Cisco switches, that is, intrinsic VLAN, which belongs to VLAN1 by default.
  • It is called Port VLAN ID on Huawei switches, that is, port VLAN ID, or PVID for short.

Each port on a switch has one and only one PVID.

Access port:

  • Access ports are generally used to connect to user computers

  • The Access port can only belong to one VLAN, that is, it can only receive and send a frame with the same VLAN

  • The PVID value of the Access port is the same as the VLAN ID to which the port belongs (the default is 1)

  • Access port receiving processing method:

    • Generally, only "unprocessed" ordinary Ethernet MAC frames are accepted, and the frame is tagged according to the PVID value of the port that accepts the frame, that is, a 4-byte VLAN tag field is inserted, and the VID value in the field is the same as the PVID value of the port.
  • Access port sending processing method:

    • If the VID value in the frame is equal to the PVID value of the port, then "remove the label" and forward the frame, otherwise it will not forward it.
    image-20210605232105821

    After dividing the virtual LAN:

image-20210605233408625

Trunk port:

  • Trunk ports are generally used for interconnection between switches or between switches and routers.
  • Trunk ports can belong to multiple VLANs, that is, they can send and receive frames from multiple VLANs
  • The user can set the PVID value of the trunk port. By default, the PVID value is 1.
  • Trunk port sending processing method:
    • For frames with VID equal to PVID: "de-tag" and forward
    • For frames whose VID is not equal to PVID: direct forwarding
  • Trunk port accepts processing method:
    • For "untagged" frames, the frame is "tagged" according to the PVID value of the port receiving the frame
    • For "tagged" frames, receiving

A broadcasts:

image-20210605234914957

C broadcasts:

image-20210605235237356

Practice questions:

image-20201015210417695

Huawei-specific Hybrid ports:

image-20210606001744495 image-20210606002636750

A ----> C:

image-20210606002623469

B —> C:

image-20210606003001758

A ----> B

image-20210606003446064

The same is true for going from B to A.

Guess you like

Origin blog.csdn.net/OYMNCHR/article/details/119113417