Notes on data link layer of computer network

foreword

  1. Functions of the data link layer
  2. Two types of channels in the data link layer
  3. LAN, WAN
  4. Data Link Layer Devices

A Primer on the Data Link Layer

insert image description here

1.1, the basic concept of the data link layer

(1) Node (node): host, router;

(2) Link : The physical channel between two nodes in the network . The transmission media of the link mainly include twisted pair, optical fiber and microwave. Divided into wired link and wireless link.

(3) Data link : A logical channel between two nodes in the network . The data link is formed by adding the hardware and software to realize the control data transmission protocol to the link.

(4) Frame : The protocol data unit of the link layer, encapsulating the network layer datagram.

1. 数据链路层:负责通过一条链路从一个结点向另一个物理链路直接相连的相邻结点传送数据报。
2. 数据链路层可说个是搬运工!

insert image description here

1.2. Brief description of the functions of the data link layer

(1) The data link layer provides services to the network layer on the basis of the services provided by the physical layer . Its most basic service is to reliably transmit data from the network layer to the target machine network of adjacent nodes. Its main function is to strengthen the function of the physical layer to transmit the original bit stream , transform the possible error-prone physical connection provided by the physical layer into a logically error-free data link , and make it appear as an error-free link to the network layer.

(2) Specific functions of the data link layer:

  • Function 1: Provide services for the network layer. Unconfirmed connectionless services, confirmed connectionless services, and confirmed connection-oriented services .

    有连接一定有确认!俗话:即想(合规合法)牵手就得有同意!

  • Function 2: Link management, that is, connection establishment, maintenance, and release (for connection-oriented services).

  • Function 3: framing.

  • Function 4: flow control.限制发送方的发送

  • Function 5: Error control (frame error/bit error).

Encapsulation into framing & transparent transmission

2.1. Encapsulation and framing

insert image description here
(1) Encapsulation into a frame : It is to add a header and a tail before and after a piece of data, thus forming a frame. After receiving the bit stream submitted by the physical layer, the receiving end can identify the start and end of the frame from the received bit stream according to the header and tail marks.

The header and tail contain a lot of control information, and they play an important role: frame delimitation (determine the boundaries of the frame).

(2) Frame synchronization : The receiver should be able to distinguish the start and end of the frame from the received binary bit stream.
insert image description here

(3) Four methods of framing :

  1. character counting;
  2. Character (section) filling method;
  3. Zero bit padding method;
  4. Violation of coding laws;

2.2. Transparent transmission

(1) Transparent transmission : It means that no matter what kind of bit combination the transmitted data is, it should be able to be transmitted on the link. Therefore, the link layer "sees" what is preventing data transmission.

(2) When the bit combination in the transmitted data happens to be exactly the same as a certain control information, appropriate measures must be taken so that the receiver will not mistake such data for some kind of control information. Only in this way can the transmission of the data link layer be transparent.

2.3. Four methods of framing

1) Character counting method
insert image description here

  • The frame header uses a count field (the first byte, 8 bits) to indicate the number of characters in the frame.
  • Pain point: All eggs are in one basket.
1. 当上图的第1个帧的第一个字节出错(由5出错为4)时,就会导致告诉接收方这个帧有4个字符,进一步导致第2个帧的首个字符由原来的5向前换成原来第一个帧的最后一个字符4;最终导致后面的帧都发生错误。
2. 即一步错,步步错。因而不常用。

2) Character (section) filling method;
insert image description here

1. SOH、EOT为定界符,用来定界帧的起始和终止;
2. 当接收方看到00000001时,就知道是帧的开端;当接收方收到00000010,就知道是帧的末端;但这种方式只适合文本文件。文本文件的字符都是从键盘上输入的,都是ASCII码,不会有重复字符(字节);
3. 当传送的帧是由非ASCII码的文本文件组成时(二进制代码的程序或图像等),可能会有重复字符(字节);进而导致错误地找到帧的边界,也把帧后面的数据丢弃了;
  • The specific implementation process of the character (section) filling method:
    • Add the escape character ESC;
      insert image description here
  • When the transmitted frame is composed of a text file (the characters of the text file are all input from the keyboard, and they are all ASCII codes). No matter what characters are input from the keyboard, they can be passed in the frame, that is, transparent transmission .
  • When the transmitted frame is composed of non-ASCII text files (binary code programs or images, etc.), it is necessary to use the character filling method to realize transparent transmission .

3) Zero bit filling method;
insert image description here

1. 利用标志符01111110,在发送时数据部分逢5个1填充0,在接受时数据部分逢5个1删掉0;
2. 过程简单,很好地实现了透明传输;

operate:

  1. At the sending end, the entire information field is scanned, and as long as there are 5 consecutive 1s, a 0 is immediately filled.
  2. At the receiving end, when receiving a frame, first find the flag field to determine the boundary, and then use hardware to scan the bit stream. When 5 consecutive 1s are found, delete the subsequent 0s.
    insert image description here

Transparent transmission is ensured: any bit combination can be transmitted in the transmitted bit stream without causing misjudgment of frame boundaries.

4) Violation of coding laws;
insert image description here

1. 如曼切斯特编码:每个比特都是高-低、低-高其实是在物理层比特编码的时候来实现透明传输的一种方法,如曼切斯特编码:每个比特都是高-低、低-高这两种,因而可以用"高-高","低-低"来定界帧的起始和终止。
  • You can use " high-high ", " low-low " to delimit the start and end of the frame.

  • Due to the fragility of the Count field of the byte counting method (if its value is wrong, it will lead to catastrophic consequences) and the complexity and incompatibility of the implementation of character filling, the more commonly used frame synchronization methods are bit stuffing and illegal coding . .

error control

1. Where did the error come from?

(1) Generally speaking, it is caused by noise.

【Overall】

  • The random noise (thermal noise) generated by the electrical characteristics of the line itself is inherent in the channel and exists randomly.

  • Solution: Improve the signal-to-noise ratio to reduce or avoid interference.(对传感器下手)

[locality]

  • The impact noise caused by external specific short-term reasons is the main cause of errors.

  • Solution: Usually use coding technology to solve.

(2) Two types of errors:

  • Bit error [bit error, 1 becomes 0, 0 becomes 1]
  • Frame error: sending [#1]-[#2]-[#3]
    • Lost: Received [#1]-[#3]
    • Repeat: Received [#1]-[#2]-[#2]-[#3]
    • Disorder: Received [#1]-[#3]-[#2]

(3) The link layer provides services for the network layer:

  • No confirmation and no connection service - good communication quality, wired transmission link
  • Confirmed connectionless service - poor communication quality, wireless transmission link
  • Acknowledged connection-oriented service - poor communication quality, wireless transmission link

2. Error control at the data link layer

insert image description here

(1) Error control (bit error):

  • error detection coding
    • parity code
    • cyclic redundancy code
  • Error Correction Coding
    • Hamming Code

(2) Redundant coding

Before the data is sent, a certain redundant bit is added according to a certain relationship to form a code word conforming to a certain rule and then sent. When the effective data to be sent changes, the corresponding redundant bits also change, so that the code word follows the same rule. The receiving end judges whether there is an error according to whether the received codeword still complies with the original rules.

(3) Differences in coding:

  1. Data link layer coding is different from physical layer coding and modulation .
  2. The physical layer coding is aimed at a single bit and solves problems such as bit synchronization during transmission, such as Manchester coding.
  3. The coding of the data link layer is aimed at a group of bits , and it uses redundant code technology to realize whether a group of binary bit strings have errors during transmission.

3. Error detection coding - parity code

insert image description here

Practice: If the ASCII code of a character S is 1100101 from high to low, and odd parity is used, which kind of error cannot be detected in the following received transmitted characters?

A. 11000011 B. 11001010 C. 11001100 D. 11010011
insert image description here

The characteristics of the parity check code:

  • Only an odd number of bit errors can be detected, and the error detection capability is 50%.

4. Error detection coding - CRC cyclic redundancy code

(1) The idea of ​​CRC cyclic redundancy code
insert image description here
(2) Knowledge required to use CRC cyclic redundancy code

1. 最终发送的数据:
   要发送的数据 + 帧检验序列/冗余码,即FCS
2. 如何计算冗余码
(1)加0	假设生成多项式G(x)的阶为r,则加r个0
(2)模2除法  数据加0后除以多项式,余数为冗余码/FCS/
	CRC检验码的比特序列
3. 10011表示成多项式为:
	x4 + x1 + x0
= x4 + x1 + 1
阶为4

4. 区别:
   CRC是检错编码的方法;
   FCS是冗余码;

(3) Error detection process at the receiving end:

  1. Divide each frame received by the same divisor, and then check the remainder R;
  2. If the remainder is 0, it is judged that the frame has no error; receive ;
  3. If the remainder is not 0, it is judged that the frame has an error (unable to determine the position); discard ;

The generation of FCS and the CRC check at the receiving end are all realized by hardware , and the processing is very fast, so the transmission of data will not be delayed.

(4) Examples:

1. 例如:要发送的数据是1101 0110 11,采用CRC校验,生成多项式是10011,那么最终发送的数据应该是?

insert image description here

(6) Supplementary knowledge of CRC cyclic redundancy code

1) Only using cyclic redundancy check CRC error detection technology in the data link layer can only achieve error-free reception of frames, that is, "every frame received by the data link layer at the receiving end, we can be very close to 1 The probability that these frames have not produced errors in the transmission process". Although the frame discarded by the receiving end was received, it was eventually discarded due to an error. "All frames received by the data link layer at the receiving end are error-free."

2) "Reliable transmission": whatever is sent by the sending end of the data link layer, what is received by the receiving end.

3) The link layer uses CRC checks to achieve bit error-free transmission, but this is not reliable transmission.

5. Error Correction Coding——Hamming Code

insert image description here
work process:

  1. Confirm check code
  2. Determine the location of the checksum and data
  3. Find the value of the checksum
  4. error detection and correction

insert image description here
insert image description here
insert image description here
calculation process:
insert image description here
insert image description here
insert image description here
insert image description here

补充:假设要检测的有效信息为n位,需要增加的校验码位为k位,则校验码的长度为n+k位。校验位的状态组合,应当具有指出n+k位中任意一位有错或无错的能力,即需要区别出n+k+1种状态。应满足以下关系式:2的k次幂>=n+k+1,这个关系式称为海明不等式。若信息位长度n确定后,由此可得到校验位k的最短长度。

Channeling Media Access Control

1. Two types of links used for data transmission

  1. Point-to-point link
    Two adjacent nodes are connected by a link without a third party.
    Application: PPP protocol, commonly used in wide area network.
  2. Broadcast link
    All hosts share the communication medium.
    Application: Early bus Ethernet, wireless local area network, often used in local area network.
    Typical topology: bus, star (logic bus)
    insert image description here

2. Introduction to 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.
insert image description here

3. Channel partitioning media access control

Channel division access control: isolate each device using the medium from communications from other devices on the same channel , and allocate time domain and frequency domain resources to devices on the network reasonably.
insert image description here
insert image description here

4. Frequency division multiplexing FDM

insert image description here

  • After a user is allocated a certain frequency band, he will occupy this frequency band from beginning to end during the communication process. All users of frequency division multiplexing occupy different bandwidth (frequency bandwidth) resources at the same time.
  • Make full use of the transmission medium broadband, the system efficiency is higher ; because the technology is relatively mature, it is relatively easy to realize .
1. 频率由高到低,波形的周期的宽度由小到大。

5. Time division multiplexing TDM

insert image description here

  • Divide time into time-division multiplexing frames (TDM frames) of equal length. Each time-division multiplexing user occupies a time slot with a fixed sequence number in each TDM frame , and all users occupy the channel in turn.
  • A TDM frame is a frame divided by a bit stream transmitted at the physical layer, rather than a frame encapsulated at the data link layer.
频分复用 —— 类似于操作系统的"并行"
时分复用 —— 类似于操作系统的"并发"

6. Improved time division multiplexing - statistical time division multiplexing STDM

insert image description here

The number of time slots in each STDM frame is less than the number of users connected to the concentrator. Each user sends data to the input buffer of the concentrator at any time when they have data , puts the input data in the buffer into STDM frames, and sends out a STDM frame when it is full. The STDM frame does not allocate time slots fixedly, but dynamically allocates time slots on demand.

1. 假设TDM的信道最高输速率为8000b/s,则其每人(A,B,C,D)最高传输速率为2000b/s。而在当TDM的信道最高传输速率为8000b/s,则其每人(A)最高传输速率为8000b/s。

7. Wavelength division multiplexing WDM

Wavelength division multiplexing is frequency division multiplexing of light . Multiple optical signals of different wavelengths (frequency) are transmitted in one optical fiber. Due to different wavelengths (frequency), each optical signal does not interfere with each other. Finally, Then use a wavelength division multiplexer to decompose each wavelength.
insert image description here

8. Code division multiplexing CDM

Code Division Multiple Access (CDMA) is a form of code division multiplexing.

1 bit is divided into multiple chips/chips (chip), and each site is assigned a unique m-bit chip sequence.

When sending 1, the station sends the chip sequence; when sending 0, it sends the inverse code of the chip sequence (usually write 0 as -1)

1. 如何不打架:多个站点同时发送数据的时候,要求各个站点芯片序列相互正交。
2. 如何合并:各路数据在信道中被线性相加。
3. 如何分离:合并的数据和源站规格化内积。

example:
insert image description here

ALOHA agreement

ALOHA一词来源于美国的夏威夷的ALOHA!,读作“鹅落哈”

1. Pure ALOHA protocol

The idea of ​​pure ALOHA protocol: do not monitor the channel, do not send according to time slots, and send randomly.想发就发
insert image description here

1. 冲突如何检测?
如果发生冲突,接收方就会检测出差错,然后不予确认,发送方在一定时间内收不到确认,就会判断发生冲突。
2. 冲突如何解决?
超时后等一随机时间再重传。

2. Slotted ALOHA protocol

The idea of ​​the slotted ALOHA protocol : Divide the time into several identical time slots (time slots) , and all users access the network channel at the beginning of the time slot. If a conflict occurs, they must wait until the beginning of the next time slot before sending.

Essence: Control the randomness of posting as you like .
insert image description here

3. Things to know about ALOHA

  1. Pure ALOHA protocols have lower throughput and are less efficient than slotted ALOHA.
  2. The pure ALOHA protocol can send as much as you want, and the slotted ALOHA can only be sent when the time segment starts.

CSMA agreement

1. Introduction to the CSMA protocol

CSMA协议,即载波监听多路访问协议;CSMA,即carrier sense multiple access

CS : Carrier Sense/Sense, each station should check whether there are other computers sending data on the bus before sending data.

# 当几个站同时在总线上发送数据时,总线上的信号 电压摆动值 将会增大(互相叠加)。当一个站检测到的信号 电压摆动值 超过一定门限值时,就认为总线上至少有两个站同时在发送数据,表明产生了碰撞,即发生了冲突。

MA : Multi-point access , which means that many computers are connected to a bus in a multi-point access manner.


The idea of ​​​​the CSMA protocol: Before sending a frame, listen to the channel.
insert image description here

2. 1- Stick to CSMA

(1) Persistence refers to the persistence after the monitoring channel is busy .

(2) 1- Adhere to the idea of ​​CSMA agreement:

如果一个主机要发送信息,那么它先监听信道。
空闲则直接传输,不必等待。
忙则一直监听,直到空闲马上传输。
如果有冲突(一段时间内未收到肯定回复),则等待一个随机长的时间再监听,重复上述过程。

(3) 1- Advantages and disadvantages of adhering to the CSMA agreement:

  • Advantages: As long as the media is free, the site will send it immediately, avoiding the loss of media utilization.

  • Disadvantage: If two or more stations have data to send, conflicts are inevitable.

3. Non-adhere to CSMA

(1) Non-persistence refers to not continuing to monitor after the monitoring channel is busy.

(2) Non-adherence to the idea of ​​​​the CSMA agreement:

如果一个主机要发送消息,那么它先监听信道。
空闲则直接传输,不必等待。
忙则等待一个随机的时间之后再进行监听。

(3) Advantages and disadvantages of non-adhere to the CSMA agreement:

  • Advantages: Using a random retransmission delay time can reduce the possibility of collisions.
  • Disadvantages: There may be delays and waiting for everyone, so that the media may still be in an idle state, and the media usage rate is reduced.

4. p-Stick CSMA

(1) p-persist refers to the processing of listening idle.

(2) p- adhere to the idea of ​​CSMA protocol:

如果一个主机要发送消息,那么它先监听信道。
空闲则以p概率直接传输,不必等待;概率为1-p等待到下一个时间槽再传输。
忙则等待一个随机的时间之后再进行监听。

(3) p-adhere to the advantages and disadvantages of the CSMA protocol:

  • Advantages: It can not only reduce conflicts like non-persistent CSMA protocols, but also reduce media idle time like 1-persistent CSMA protocols.
  • Disadvantage: After a conflict occurs, the data frame is still sent, resulting in waste.

有没有什么办法可以减少资源浪费,一冲突就能发现呢? 先思考思考!

5. Comparison and summary of 3 kinds of CSMA

insert image description here

将3种CSMA协议看做是三个想喝奶茶的人儿~

insert image description here

CSMA/CD agreement

1. Introduction to CSMA/CD protocol

CSMA/CD:(carrier sense multiple access with collision detection),即载波监听多点接入/碰撞检测。

CS : Carrier Sense/Sense, each station must check whether there are other computers sending data on the bus before sending data and when sending data.

MA : Multi-point access , which means that many computers are connected to a bus in a multi-point access manner.

CD : Collision detection (collision detection), "listening while sending", the adapter detects the signal voltage on the channel while sending data, to judge whether other stations are also sending data when it is sending data.

1. 为什么先监听后发数据还是会发生冲突呢?
答:因为电磁波在总线上总是以有限的速率传播的,加上传输数据的信道可能很长(出现传播时延),因而会发生冲突。

2. Effect of propagation delay on carrier sense

insert image description here

1. A站正在向B站发数据,B站也想向A站发数据。但由于信道太长,A站发的数据还在信道上,B站还没接收A的数据,B站检测到信道是空闲的,这时B站就发数据,A-->B A<--B,这时碰撞(冲突)就出现了。
2. 单程端到端传播时延:τ,读作"涛"。即数据从A站端到B站端的所花的时间。

insert image description here

3. 最迟多久才能知道自己发送的数据没和别站碰撞?
做多是两倍的总线端到端的传播时延(2τ)
2τ也是 总线的端到端往返传播时延
2τ也叫做 争用期/冲突窗口/碰撞窗口
4. 启示:
只要经过2τ的时间还没有检测到碰撞,就能肯定这次发送不会发生碰撞。

3. How to determine the timing of retransmission after collision?

重传时间随意的话,还是会发生碰撞。

这部分慢慢琢磨,这是重点

  • Use truncated binary exponents to circumvent the algorithm
    insert image description here
例题:在以太网的二进制回退算法中,在11次碰撞之后,站点会在 0~? 之间选择一个随机数。

先思考一下~

# 解:11次碰撞,k不再增大,k=10, ? 等于2的10次幂减去1,即?等于1023

4. Minimum frame length

Phenomenon: station A sent a very short data frame, but a collision occurred, but the collision was detected only after the frame was sent, and the sending could not be stopped. Because the frame is sent out.

Processing method: make
insert image description here

That is:
insert image description here

5. Summary

insert image description here

CSMA/CA protocol

1. Introduction to CSMA/CA protocol

CSMA/CA: (carrier sense multiple access with collision avoidance), that is, carrier sense multiple access/collision avoidance .
insert image description here

2. Working principle of CSMA/CA protocol:

  1. Before sending data, first check whether the channel is idle.

  2. If the channel is idle , RTS (request to send) will be sent . RTS includes information such as the address of the transmitter, the address of the receiver, and the time for the next data to be sent continuously; if the channel is busy, it will wait.

  3. After receiving RTS, the receiver will respond with CTS (clear to send) .

  4. After receiving the CTS, the sender starts to send data frames (at the same time reserve the channel : the sender tells other stations how long it will transmit data).

  5. After receiving the data frame, the receiving end will use CRC to check whether the data is correct, and if it is correct, it will respond with an ACK frame .

  6. After receiving the ACK frame, the sender can send the next data frame. If not, it will retransmit until the specified number of retransmissions (the binary exponential backoff algorithm is used to determine the random delay time).

# 理解记住这些玩意:
1. 预约信道
2. ACK帧
3. RTS/CTS帧(可选)

3. Similarities and differences between CSMA/CD and CSMA/CA

Same point:

Both CSMA/CD and CSMA/CA mechanisms are subordinate to the idea of ​​CSMA, the core of which is to stop before talking . In other words, both need to listen before accessing the channel. Only when the channel is found to be idle can it be accessed.

difference:

  1. The transmission media are different : CSMA/CD is used for bus Ethernet [wired], while CSMA/CA is used for wireless local area network [wireless].
  2. Different carrier detection methods : Due to different transmission media, the detection methods of CSMA/CD and CSMA/CA are also different. CSMA/CD is detected by the voltage change in the cable. When the data collides, the voltage in the cable will change accordingly; while CSMA/CA uses energy detection (ED), carrier detection (CS) and energy carrier hybrid detection 3 ways to detect channel idle.
  3. CSMA/CD detects collisions , and CSMA/CA avoids collisions , and both will retransmit with an upper limit after a collision occurs.

Polling Access Media Access Control

1. Media Access Control

Channel division medium access control (MAC Multiple Access Control) protocol:

  • Resources are divided based on multiplexing techniques.
  • Heavy network load: shared channels are highly efficient and fair.
  • Light network load: shared channel is inefficient.

Random access MAC protocol:冲突

  • Users randomly send information according to their wishes, and can monopolize the channel bandwidth when sending information.
  • Heavy network load: Conflict overhead.
  • Light network load: shared channel is highly efficient, and a single node can utilize the full bandwidth of the channel.

Polling Access MAC Protocol/Rolling Protocol/Turning Access MAC Protocol:

  • It is necessary not to cause conflicts, but also to occupy the entire bandwidth when sending.

  • Including polling protocol, token passing protocol.

1. 多个主机需要通过一条“共享介质”发送和接收数据被称为“多路访问/多路存取”。
2. 这里的MAC可以是多路访问控制(Multiple Access Control)、介质访问控制(Mediu Access Control)。
	原因:是由于1。

2. Polling protocol

Polling protocol: Master nodes take turns "inviting" slave nodes to send data.这个头儿真体贴!
insert image description here

Problems: 1) Polling overhead 2) Waiting for a round trip 3) Single point of failure

3. Token Passing Protocol

Token:

  • A specially formatted MAC control frame that contains no information.

  • The use of the control channel ensures that only one node monopolizes the channel at the same time.

  • Token Ring Collision-Free

  • Each node can obtain the right to send data within a certain period of time (token holding time), instead of holding tokens indefinitely.
    insert image description here

Token Passing Protocol:

  • Applied to token ring network (physical star topology, logical ring topology).
  • Problems: 1) token overhead 2) wait latency 3) single point of failure
  • Token-passing networks are often used in heavily loaded, high-traffic networks.
# 为什么令牌传递协议常用于负载较重、通信量较大的网络?
先思考一下~
# 答:(1)因为在负载较轻、通信量较小的网络中,也说明该网络中想发数据的结点少,比如此时间自由结点A想发很多的数据,其它的结点都不想发数据。结点A在令牌持有时间中发数据,时间一到,就要等一轮的循环时间才能再次发数据,而且在这循环时间中,其它结点都不想发数据,就降低通信效率。
#  (2)因为在负载较重、通信量较大的网络中,也说明该网络中想发数据的结点很多,用于令牌传递协议,可以让各结点的都能分配到一定的令牌持有时间,来发数据,避免“某个结点想发数据却没法发数据”的现象。
#  (3)采用令牌传送方式的网络常用于负载较重、通信量较大的网络。

local area network

1. The basic concept of LAN

Local Area Network: LAN for short, refers to a computer group formed by interconnecting multiple computers in a certain area, and uses a broadcast channel.

Features of LAN:

  • Feature 1: The geographic scope covered is small, and it is only inlined in a relatively independent local area, like one or a concentrated building complex.

  • Feature 2: Use specially laid transmission media (twisted pair, coaxial cable) for networking, and the data transmission rate is high.

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

  • Feature 4: Each station is in an equal relationship and shares the transmission channel.

  • Feature 5: Distributed control and broadcast communication are mostly used, and broadcast and multicast can be performed.

The characteristics of a LAN are determined by the main elements of the LAN, including network topology, transmission media, and media access control methods .

2. LAN topology

insert image description here

Star topology : The central node is the control center. The communication between any two nodes only needs two steps at most , the transmission speed is fast, and the network topology is simple, easy to build, and easy to control and manage. However, this kind of network system has low network reliability, poor network sharing capability, and a single point of failure problem.

Bus topology : high network reliability, fast response between network nodes, strong resource sharing capability, less equipment investment, low cost, easy installation and use, when a workstation node fails, it will have little impact on the entire network system.

Ring topology : The communication equipment and lines in the system are relatively economical. There is a single point of failure problem; 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.

Tree topology : easy to expand, easy to isolate faults, and prone to single point of failure problems.

3. LAN transmission medium

insert image description here

4. LAN media access control mode

  1. CSMA/CD is commonly used in bus-type LANs and also in tree-type networks.
  2. Token bus is commonly used in bus-type LAN and also in tree-type network.
    • It arranges each workstation in a bus or tree network in a certain order (such as arranging according to the size of the interface address to form a logical ring 0). Only token holders can control the bus and have the right to send messages.
  3. Token Ring is used in a ring local area network, such as a Token Ring network.

5. Classification of LAN

  1. ethernet
    • Ethernet is the most widely used local area network, including standard Ethernet (10Mbps), Fast Ethernet (100Mbps), Gigabit Ethernet (1000 Mbps) and 10G Ethernet, all of which comply with IEEE802.3 series standard specifications. The logical topology is bus, and the physical topology is star or extended star. Use CSMA/CD.
  2. Token Ring
    • A star topology is adopted physically, and a ring topology is logically adopted. It can be said that it is too early.
  3. FDDI网(Fiber Distributed Data Interface)
    • Physically, a dual-ring topology is adopted, and logically, it is a ring topology.
  4. ATM网(Asynchronous Transfer Mode)
    • It is a relatively new type of unit exchange technology, which uses a fixed-length unit of 53 bytes for exchange.
  5. Wireless Local Area Network (WLAN)
    • Adopt IEEE 802.11 standard.

6. IEEE 802 standard

IEEE 802 series standards are local area network and metropolitan area network technical standards formulated by the IEEE 802 LAN/MAN Standards Committee (established in February 1980). The most widely used are Ethernet, Token Ring, Wireless Local Area Network, etc. Each sub-standard in this family of standards is covered by a dedicated working group within the committee.
insert image description here

# 上图画红色下划线的4个标准协议得记记!

7. MAC sublayer and LLC sublayer

The LAN reference model described in the IEEE 802 standard only corresponds to the data link layer and physical layer of the OSI reference model. It divides the data link layer into the logical link layer LLC sublayer and the medium access control MAC sublayer .
insert image description here

LLC sublayer : Responsible for identifying network layer protocols and then encapsulating them. The LLC header tells the data link layer what to do with the packet once the frame is received. Provide services for the network layer: no connection without confirmation, connection-oriented, connectionless with confirmation, high-speed transmission .

MAC sublayer : responsible for encapsulation/unpacking of data frames, addressing and identification of frames, receiving and sending of frames, management of links, error control of frames, etc. The existence of the MAC sublayer shields the differences of different physical link types.

8. Summary

insert image description here

ethernet

1. Overview of Ethernet

(1) Ethernet (Ethernet) refers to the baseband bus LAN specification created by Xerox Corporation and jointly developed by Xerox, Intel, and DEC Corporation. It is the most common communication protocol standard used by existing LANs today. Ethernet uses CSMA/CD (Carrier Sense Multiple Access with Collision Detection) technology.

(2) Ethernet occupies a dominant position in various technologies of LAN. Why is it so strong?

  1. Low cost (Ethernet network card is less than 100 yuan);
  2. It is the most widely used LAN technology;
  3. Cheaper and simpler than Token Ring and ATM networks;
  4. Meet the network rate requirements: 10Mb/s~10Gb/s;

(3) Two standards of Ethernet:

  • DIX Ethernet V2: The first LAN product (Ethernet) protocol.
  • IEEE 802.3: The first IEEE Ethernet standard formulated by the 802.3 Working Group of the IEEE 802 Committee. (The frame format has changed slightly)

802.3 LAN AKA Ethernet

2. Ethernet provides connectionless, unreliable services

(1) No connection: "handshake process" between the sender and the receiver.

(2) Unreliable: The sender's data frame is not numbered, the receiver does not confirm to the sender, the error frame is directly discarded, and the error correction is the responsibility of the upper layer.

(3) Ethernet only realizes error-free reception, not reliable transmission.

3. Development of Ethernet transmission media and topology

insert image description here

The Ethernet using the hub is still a logical bus network, each station shares the logical bus, and the CSMA/CD protocol is used.

Ethernet topology: logically bus type, physically star type.

4. 10BASE-T Ethernet

10BASE-T is a twisted pair Ethernet that transmits baseband signals. T means twisted pair. Now 10BASE uses unshielded twisted pair (UTP), and the transmission rate is 10Mb/s.

  • Physically adopts star topology, logically adopts bus type, and the maximum length of each twisted pair is 100m.

  • Manchester encoding is used.

  • Adopt CSMA/CD media access control.

5. Adapter and MAC address

insert image description here

(1) The connection between the computer and the external LAN is through a communication adapter.

(2) Network interface board, that is, network interface card NIC (Network Interface Card). But now, a separate network card is no longer used.

(3) Now, the processor and memory (including RAM and ROM) are installed on the adapter, and the ROM has the computer hardware address - MAC address.

(4) In the local area network, the hardware address is also called the physical address, or MAC address. [actually an identifier]
insert image description here

(5) MAC address: Each adapter has a globally unique 48-bit binary address, the first 24 bits represent the manufacturer (specified by IEEE), and the last 24 bits are designated by the manufacturer. Commonly used six hexadecimal numbers, such as 02-60-8a-dc-21.

6. Ethernet MAC frame

The most commonly used format is Ethernet V2.
insert image description here

Differences from IEEE 802.3:

  1. The third field is length/type;
  2. When the length/type field is less than 0x0600, the data field must be loaded into the LLC sublayer.

7. High-speed Ethernet

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

  1. 100BASE-T Ethernet
    • The star Ethernet that transmits 100Mb/s baseband signals on twisted pairs still uses the CSMA/CD protocol of IEEE 802.3.
    • Support full-duplex and half-duplex, can work in full-duplex mode without conflict.
  2. Gigabit Ethernet
    • Transmit 1Gb/s signal on optical fiber or twisted pair.
    • Support full-duplex and half-duplex, can work in full-duplex mode without conflict.
  3. 10 Gigabit Ethernet
    • 10 Gigabit Ethernet transmits 10Gb/s signals over optical fiber.

8. Summary

insert image description here

IEEE 802.11 Wireless LAN

1、IEEE 802.11

IEEE 802.11 is a common standard for wireless local area networks , and it is a standard for wireless network communication defined by IEEE.
insert image description here

1. 无线局域网 与 Wifi是一样的不?
答:当然是不一样诶!无线局域网所覆盖的范围要比Wifi所覆盖的范围大得多,如无线局域网覆盖范围为一个大村庄,WiFi覆盖范围为一栋楼房。

MAC帧的帧头是MAC帧最重要的部分嘀~

2. 802.11 MAC frame header format

insert image description here

1. 假如A主机要跟B主机通信,离A主机最近的基站是AP1,离B主机最近的基站是AP2;AP称为无线接入点,也叫基站。通信过程是怎样的?
A主机发数据给AP1,然后AP1把数据发给AP2,最后AP2再把数据发给主机2。
MAC帧存的就是MAC地址。
地址1(RA)存的是MAC(AP2),地址2(TA)存的是MAC(AP1),地址3(DA)存的是MAC(B),地址4(SA)存的是MAC(A)。
2. 为什么我们过省出差、过省旅游,通常会接收“某某省,欢迎你!”的手机消息?
答:因为在我们生活中,存在着很多很多的基站,若是上午离你的手机最近的基站为AP3,那你的手机号就存储于AP3的数据库;但你是大忙人,需要过省出差,下午的时候离你的手机最近的基站为AP4、离AP3已经很远了,那你的手机号就存储于AP4的数据库;基站的数据库时常在更新着,且更新速率很快。

除了上面的这种MAC帧头格式,还有其它的,看看就行~
insert image description here

3. Classification of wireless LAN

  • WLAN with fixed infrastructure
    insert image description here

无线局域网的服务标识符:
insert image description here

  • Ad hoc networks of wireless local area networks without fixed infrastructure
    insert image description here

PPP protocol & HDLC protocol

1. Wide area network

Wide area network (WAN, Wide Area Network), usually spans a large physical range, covering a range from tens of kilometers to thousands of kilometers, it can connect multiple cities or countries, or span several continents and provide remote Distance communication to form an international long-distance network.

The communication subnet of the WAN mainly uses packet switching technology. The communication subnet of the WAN can use the public packet switching network, satellite communication network and wireless packet switching network, which will interconnect the local area networks or computer systems distributed in different regions to achieve resource sharing. the goal of. Such as the Internet (Internet) is the world's largest wide area network.
insert image description here

2. Features of the PPP protocol

Point-to-point protocol PPP (Point-to-Point) is currently the most widely used data link layer protocol, and users generally use the PPP protocol when they use dial-up telephones to access the Internet.

The PPP protocol only supports full-duplex links.

3. The requirements that the PPP agreement should meet:

Simple For link layer frames, no error correction, sequence number, or flow control is required.

Encapsulated into frame frame delimiter

Transparent transmission How data with the same bit combination as the frame delimiter should be processed: asynchronous lines are filled with bytes, and synchronous lines are filled with bits.

Multiple Network Layer Protocols The encapsulated IP datagram can adopt multiple protocols.

Various types of network serial/parallel, synchronous/asynchronous, electrical/optical, etc.

Error Control Get it wrong and drop it.

Detect connection status Whether the link is working normally.

Maximum Transmission Unit The maximum length of the data part MTU.

Network layer address negotiation Know the network layer addresses of the communicating parties.

Data Compression Negotiation

4. The PPP agreement does not need to meet the requirements:

  • error correction

  • flow control

  • serial number

  • Does not support multipoint lines

5. The three components of the PPP agreement

1) A method of encapsulating IP datagrams into a serial link (synchronous serial/asynchronous serial).

2) Link Control Protocol LCP : Establish and maintain data link connections.身份验证

3) Network control protocol NCP : PPP can support multiple network layer protocols, and each different network layer protocol must be configured with a corresponding NCP to establish and configure logical connections for network layer protocols.

6. State diagram of PPP protocol

insert image description here

7. PPP frame format

insert image description here

8. HDLC protocol

High-Level Data Link Control (High-Level Data Link Control or HDLC for short), is a bit-oriented data link layer protocol that transmits data on a synchronous network . It is developed by the International Organization for Standardization (ISO) based on IBM's SDLC (Synchronous Data Link Control) protocol extension developed.

  • The data message can be transmitted transparently, which is used to realize the "0-bit insertion method" of transparent transmission, which is easy to realize by hardware.

  • Full-duplex communication

  • All frames are checked by CRC , and the information frames are numbered sequentially , which can prevent missed receipt or duplicate copies, and the transmission reliability is high.

9. HDLC station

主站、从站、复合站

1) The main function of the master station is to send command (including data information) frames, receive response frames, and be responsible for the initial startup of the control system of the entire link, process control, error detection or recovery, etc.

2) The main function of the slave station is to receive the command frame sent by the master station, send a response frame to the master station, and cooperate with the master station to participate in link control such as error recovery.

3) The main function of the composite station is to be able to send and receive command frames, and to be responsible for the control of the entire link.

Three data manipulation methods:

  1. normal response

  2. asynchronous balancing method

  3. Asynchronous response method

1. 正常响应方式:如果从站想要发送数据,需要经过先经过主站的同意,主站命令从站说可以发送数据,从站才能发送数据。
2. 异步平衡方式:每一个站都可以进行数据传输,每一个的地位相对平等,但场面非常混乱。
3. 异步响应方式:从站胆子肥了,经过先经过主站的同意,就自行发送数据。

10. HDLC frame format

insert image description here
1) The first bit of the signal frame (I) is 0, which is used to transmit data information, or use piggyback technology to confirm data;

2) Supervision frame (S) 10, used for flow control and error control, performing functions such as confirmation of information frames, request for retransmission and request for retransmission, and request for suspension of transmission;

3) Unnumbered frame (U) 11 is used to provide multiple control functions such as link establishment and teardown.

11. PPP protocol & HDLC protocol

insert image description here

  • HDLC and PPP only support full-duplex links .

  • can achieve transparent transmission.

  • Both can achieve error control, but not error correction.

来个表比较比较~
insert image description here

12. Summary

insert image description here


link layer device

1. Review the physical layer device - hub

  • A hub (English: Hub) refers to a device that connects multiple Ethernet twisted-pair wires or optical fibers together under the same physical medium.

  • The main function of the hub is to regenerate, reshape and amplify the received signal to expand the transmission distance of the network, and at the same time concentrate all nodes on the node centered on it.

  • It works on the physical layer of the OSI (Open System Interconnection Reference Model) reference model. Like network cards, network cables and other transmission media, it belongs to the basic equipment in the local area network. It adopts CSMA/CD (Carrier Sense Multiple Access Technology with Collision Detection) medium access control mechanism.

2. The hub can't carry it

insert image description here

1. 冲突域里面的主机同一时间只有一台主机(站点)可以发送信号。上图的3个集线器同一时间就各自只有一台主机有3台可以发信号,一个主干集线器同一时间就只有一个集线器可以转发信号。集线器产生冲突域,冲突域又影响集线器,最终导致通信能力大大降低。

2. 既然集线器扛不动着冲突域的重担,就让能隔离冲突域的网桥小哥出手。

3. Bridge

3.1 Introduction to bridges and network segments

insert image description here

Bridge, a link layer device. It forwards and filters frames according to the destination address of MAC frames . When a 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 discards it (that is, filters) .

Network segment : generally refers to the part of a computer network that uses the same physical layer device (transmission medium, repeater, hub, etc.) to communicate directly.

浅橙色含有主机E、F的冲突域就可以说是一个网段。

3.2. Repeaters, hubs, bridges, switches
  1. The repeater is a physical layer device that regenerates and restores the signal, amplifies the attenuated signal, and keeps it the same as the original data, so as to increase the distance of signal transmission and extend the length of the network.
  2. **Hub (Hub)** can be said to be a multi-port repeater, which cannot isolate conflicts.
  3. **Bridge (Bridge) is an early two-port Layer 2 network device used to connect different network segments. The two ports of the bridge have an independent switching channel, instead of sharing a backplane bus, which can isolate the conflict domain. The performance of the bridge is better than that of the hub (Hub), and the conflict domain problem is alleviated. All ports on the hub share the same backplane bus. Later, bridges were replaced by switches** that had more ports and also isolated collision domains .
3.3. Analysis of the advantages of the bridge:
  1. Filter traffic to increase throughput;
    • A bridge is a link layer device working at the link layer, which can separate various collision domains.
    • If the bridge is replaced with a hub (physical layer device), there is no such function of filtering traffic and separating conflict domains.
    • The communication between different network segments does not interfere with each other. For example, host A and host B in the above figure are communicating while host C and host D can also communicate. Unlike the physical layer, the six hosts in the above figure cannot communicate at the same time.
    • If the data transmission rate of each network segment is 10Mb/s, through the bridge, then the combined throughput of the three network segments (bridge) is 30Mb/s.
  2. Extended physical scope;
    • The network bridge in the above figure realizes that host A can communicate with remote hosts E and F, while the hub at the physical layer can only broadcast (transmit data) on the same network segment. From a practical point of view, it also shows the expansion of the physical range.
  3. Improved reliability;
    • If a network segment fails, other network segments will not be affected.
  4. It can interconnect Ethernets with different physical layers, different MAC sublayers and different speeds;
    • The purpose of the production bridge.

4. Bridge classification: transparent bridge, source routing bridge

  • Transparent bridge : "Transparent" means that the station on the Ethernet does not know which bridges the frame to be sent will pass through, and it is a plug-and-play device - through a self-learning method.

insert image description here

1. 网桥1对应转发表1,网桥2对应转发表2;网桥还是有点脑子嘀,自学习算法就是网桥对转发表的使用,本质就是通过记录地址-接口,来判断传来的信号是要从哪个接口转发出去还是丢弃。
2. 为啥透明?其实是网桥不知道当前网络的拓扑结构,需要通过自学习算法来对数据帧进行处理操作。

3. A主机发出信号(即数据帧),想把信号传给B主机。上面的红色线为信号的传送踪迹。
	当这个帧传到主机G时,G判断出不是发给自己,就丢弃。
	当这个帧传到B时,B判断出是发给自己,就接收。但这个帧还是会继续传送下去。
	当这个信号传到网桥1的接口1时,网桥1会查下转发表1,发现并没有A的地址,就将这个帧的接口号1写入转发表1,并将这个帧从网桥1的接口2转发出去。
	主机C、D对这个帧的判断处理跟主机G一样,这个帧传到网桥2的接口1时,网桥2的操作跟网桥1一样,后面的E、F跟G一样。
4. F主机发出信号(即数据帧),想把信号传给C主机。上面的铅笔画的浅灰线为信号的传送踪迹。
5. B主机发出信号(即数据帧),想把信号传给A主机。上面的蓝色线为信号的传送踪迹。
	当这个帧传到A时,A判断出是发给自己,就接收。但这个帧还是会继续传送下去。
	当这个帧传到主机G时,G判断出不是发给自己,就丢弃。
	当这个信号传到网桥1时,网桥1会查下转发表1,发现并存有A的地址,就将这个帧丢弃,这个帧就不再通过网桥1的接口出去。这个帧在网桥上就传送终止。
	
6. 转发表的存储内容是有限的,未满时,继续写入信息;满时,就刷新清除。
  • Source routing bridge : When sending a frame, put the detailed optimal routing information (the least route/shortest time) at the head of the frame.

    Method: The source station broadcasts a discovery frame to the destination station that wants to communicate .

# 其实就是让炮灰(小的帧)探路,然后返回最佳路由的路径信息,再将其放在数据帧的首部。

5. Multi-interface bridge - Ethernet switch

insert image description here

# 就个人理解,以太网交换机:实际上可以类似于多个网桥并在一起,形成的更多接口的以太网交换机,具有隔离冲突域等能力。
Two switching methods of Ethernet switches
  • cut-through switch

    After checking the destination address ( 6B ), it will be forwarded immediately;

    The delay is small , the reliability is low, and the switching of ports with different rates cannot be supported.

  • store-and-forward switch

    Put the frame into the cache and check if it is correct, if it is correct, it will be forwarded, if it is wrong, it will be discarded;

    Large delay, high reliability, can support the switching of ports with different rates .

还有这两种交换方式混合使用

6. Collision domain and broadcast domain

Collision domain: Every node in the same collision domain can receive all sent frames. Simply put, it is the area (or range) where only one device can send information at a time.

Broadcast domain: A collection of all devices in the network that can receive broadcast frames sent by any device. Simply put, a site sends out a broadcast signal, and all the devices that can receive the signal enclose the area (or range).

Isolate collision domains, isolate broadcast domains

insert image description here

As the saying goes~

The conflict is that one person speaks and the others have to shut up, and the multiple hubs connected to the switch can each be spoken by one person without affecting each other, and a hub is like a person. A collision domain is an area where only one person is allowed to speak at a time. The broadcast domain is the area surrounded by the positions of all the people who can hear me when I say a sentence.
insert image description here

答:4个冲突域,1个广播域。

7. Summary

1. MAC帧是以太网的帧格式,用于局域网;PPP用于广域网;
2. 为什么PPP协议帧没有目的地址?
答:因为PPP协议是点对点传输的,不需要用到目的地址;它不光没用地址位,控制位也不携带PPP帧的信息。

insert image description here

Guess you like

Origin blog.csdn.net/xu_yushu/article/details/124532747