Computer network - data link layer

Bandwidth refers to the maximum speed supported by the network equipment, which is independent of the propagation speed of the signal in the medium,
Determined by the sending capability of the sender?
The bandwidth provided by the network operator is determined by the outlet bandwidth of the router on the link,
If the router exit bandwidth is insufficient and the data is waiting in the router, the protocol of the data link layer,
The sender will automatically reduce the transmission speed, so as to realize flow control.

If the bandwidth of a link is 1Mb/s, the sender can send 1bit data to the link within 1us,
That is, transmission delay = data length / channel bandwidth (transmission rate)

What is end-to-end and point-to-point?
End to end, from sender to receiver; Point to point, node to node.

1. Can both analog and digital signals be amplified?
2. No store and forward
Multiple ports transmit signals from multiple ports, and the working host connected to the hub divides the bandwidth equally
Conflict domains are not quarantined. What is a conflict domain?

The flow control of data link layer is point-to-point, while the flow control of transport layer is end-to-end.

Functions of data link layer:

Provide services for the network layer and "reliably" transmit the data of the network layer to the target network layer of adjacent nodes (reliability here refers to?).
The possible error physical connection provided by the physical layer is transformed into a "logically error free data link" to make it appear as an error free link to the network layer.
(1) Provide services for the network layer:
No connection, no confirmation (good communication quality, wired transmission link)
No connection confirmed
Connection oriented acknowledgement (wireless transmission link with poor communication quality)
(2) Framing:
Add the header and tail to the upper layer data and send it to the physical layer. The head and tail are used for frame delimitation.
(what is the length of the head and tail?)
The data part of a frame has a maximum length limit called MTU
Four methods of framing:

  • Character counting method: there is a field at the head of the frame to represent the data length of the frame.
    Shortcomings, one mistake, all wrong

  • Character filling method
    SOH and EOT bytes are used to represent the beginning and end of the frame respectively. When the original data of the frame contains control bytes,
    Add an escape character before the control byte in the original data, and the receiver removes the escape character

  • Zero bit filling method
    01111110 is used to indicate the beginning and end of the frame. Only this byte has 6 consecutive 1
    In the data part of the frame, once five consecutive 1s are encountered, 0 is added later; The receiver looks for the delimiter first, and then deletes 0 if it is 0 after 5 1s.
    In this way, the data part of the frame will not be found when looking for the frame delimiter.
    The transparent transmission is realized, and the judgment error of frame boundary will not be caused

  • Violation coding method
    In Manchester coding, 1 or 0 is represented by low high or high low in one bit, and the illegal high high and low low are used to represent the beginning and end of the frame.

Error control:

- Why is there a mistake?
	The error comes from noise,
- Result of error
	Frame error (loss, repetition, out of order)
	Dislocation (bit error)

In case of bit error, there is error control, including error detection coding and error correction coding (both for a group of bits)
	- Error detection code: parity check code CRC Cyclic redundancy code
	- Error correction code: Hamming code
	(This requires the receiver to check and respond to the received data?)

Through bit dislocation error detection and error correction coding, the received frames are error free, but reliable transmission can not be guaranteed, that is, "what the sender sends, the receiver receives", because this is only the bit error detection mechanism.

[reliable transmission at the data link layer is usually completed by two mechanisms: acknowledgement and timeout retransmission]
Flow control of data link layer: if the receiver cannot receive it, it will not reply to confirmation.
Traffic control of transport layer: the receiving end sends a window announcement to the sending end.
(these three protocols are used to realize reliable transmission, so they can also be used in the transport layer?)
Flow control and reliable transmission
In the data link layer, the flow control mechanism and reliable transmission mechanism are intertwined. According to the confirmation and retransmission mechanism, when the reliable transmission is realized, the flow control is automatically realized.
Packet loss may occur in the underlying channel, so an acknowledgement mechanism is required.
Flow control / reliable transmission method: stop waiting protocol, sliding window protocol (back N frames, select retransmission).
(1) Stop waiting for agreement:
Send confirm send confirm... Low channel utilization
Normal and abnormal conditions:
-Normal, send confirm, resend, reconfirm
-Sending frame error or missing
-Confirm ack loss
-Acknowledge ack delay
A copy is required for sending data, a timer is required after sending, and retransmission is required when the timer is exceeded
Does the transmitted frame need to be numbered? Because frames are sent one by one, the next frame will not be sent until the previous confirmation is clearly received,
When there is an acknowledgement delay of a frame, it is assumed that a frame has just been sent and an acknowledgement frame of a previously sent frame has been received,
According to the truth, we should discard it immediately and do nothing, so how to complete it?
It should be that the confirmation frame contains a sequence number. When it is received, compare this sequence number with the current sequence number. If it is found to be small, it will be ignored?
In the video, the sequence number of the transmitted frame is only 0 and 1, and the corresponding ack is ack0 and ack1
Since the proportion of data transmission time in the whole cycle of the stop waiting protocol is too low, most of the time is waiting for frame confirmation,
Therefore, to improve the pipeline technology and continuously send multiple frames, it is necessary to:
Increase frame sequence number range
Multiple frames need to be cached
Two sliding window protocols are extended

 (2)back off N Frame protocol-GBN
 	Send window is N,The receive window is 1
 	The sending window is divided into four parts: sent and confirmed (outside the window), sent and other confirmed (inside the window), able to send but not sent (inside the window), unable to send (outside the window)
 	Basic sending process: sending, confirming, sending window and receiving window moving forward(For the sender, it moves forward only after receiving the confirmation of the window lower limit frame; For the receiver, the frame that receives the lower limit of the window moves forward)

 		GBN The receiver does not have to reply to the confirmation of each frame, but can reply to the confirmation of the latest frame later.
 		this N Confirmation of frame No., indicating N No. frame and its previous frames are successfully received by the receiver.

 		In case of timeout, the sender will retransmit all transmitted unconfirmed frames.

 		The receiver maintains a desired frame sequence number, expectseqnum,The sequence number of the next sequentially received frame.
 		Only when received correctly and in order N Reply at frame ack,In other cases, the frame is discarded and a message of the most recently received frame in sequence is replied again ack. 

 		If the sliding window for transmission is particularly large, the more data can be transmitted in the window;
 		When a frame is retransmitted, the number of retransmitted frames is also greater;
 		If used n If the frame is numbered by bits, the transmission window is displayed W The range of is 1 <= W <= 2**W - 1,It is equivalent to reserving one bit of frame serial number in the window,
 			Otherwise, if it starts from 0 next time, it may be a retransmitted 0 or a new frame 0 with exhausted sequence number
 	a key:
 		1. Cumulative confirmation(Occasional confirmation)
 		2. The receiver only receives frames in order, and discards them if they are not in order
 		3. The confirmation sequence number is the frame with the largest sequence number received
 		4. The receiving window is 1 and the maximum sending window is 2**n - 1

 	Disadvantages: one frame is on business trip, and subsequent frames need to be retransmitted

 	(3) Select retransmission protocol-SR
 		Change from cumulative confirmation to single confirmation, increase the receiving window, set the receiving cache, and cache the frames arriving out of order.
 		In this way, when an error occurs, you only need to retransmit the frame.

 		SR There are sending window and receiving window, sending window and GBN Similarly, it is divided into four states: sent and confirmed (outside the window), sent and other confirmed (inside the window), can send but not sent (inside the window) and cannot send (outside the window). The receiving window has received (outside the window), not received (inside the window), received and cached(In window),Waiting to receive (in the window) and unable to receive (out of the window).
 		The frames in the transmission window arrive out of order. Only when the frame at the bottom of the window arrives, the data will be delivered to the upper network layer and the window will be moved.

 			1. Send window movement
 				Reply received in window frame ack,If it is the lower bound of the window, move the window to the connected received ack And cached frame position
 			2. The receiver does not refuse the frame in the window. If it is not the lower bound, it will cache; Direct reply to frames outside the window ack(The out of window here refers to the received data outside the current window, and it cannot be too long ago?)
 			3. Receive window movement
 				The data cache is received out of order, and the window is not moved until the next frame of the window is received
 		The size of receiving window and sending window is the same, and the maximum value is 2**(n-1),n It is a bit representing the frame sequence number, mainly to distinguish the new frame from the old frame

Media access control

Two transmission links: 
	- Point to point link, two nodes are connected through a link without a third party. Application wide area network, such as ppp agreement
	- Broadcast link, communication link shared by all hosts (data sent is received by all hosts?), application: early bus network and wireless LAN, commonly used in LAN, typical topology: bus type and star type (logical bus type)

Static access control: multiple signals are combined on one physical channel for transmission through multiplexing technology, and multiple terminals share channel resources to improve channel utilization
	There are frequency division, time division, wavelength division and code division multiplexing technologies

Dynamic access control: the channel is not fixed to users during communication. It is divided into random access control and polling access control.
	Random access: all users can send information randomly, which occupies all bandwidth (different from the shared bandwidth of statically divided channels)
		- ALOHA agreement(Don't listen)
			pure ALOHA,Do not monitor the channel, do not send according to the time slot, and retransmit randomly, that is, send as you want.
			(The sender detects whether there is a conflict according to the level change. If there is a conflict, it will not reply for confirmation. If the sender does not receive a reply after timeout, it will be considered as a conflict and resend the data frame immediately)
		- Time slot ALOHA agreement()
			The sending time slice is divided into multiple time slots, and data frames can only be sent at the beginning of the time slice
		- CSMA agreement(Listen first)
			Monitor the channel before sending, send when idle, and wait when busy
			There are 1 insistence, non insistence p insist
			(The sender still judges whether there is a conflict according to whether there is a confirmation frame returned)
		- CSMA-CD agreement(Listen first and speak while listening), Collision detection
			Monitor the channel before transmission and detect the change of signal voltage on the channel while transmitting (belonging to half duplex network)
			Whether collision occurs is detected after the receiving end receives the frame. If there is a collision during the propagation of the data frame, it will be detected and the frame will be discarded.
			After the transmitting end sends data, if the data collides with the transmitted frame from the receiving end during the journey, the transmitting end shall experience 2 at the latest T The collision is detected when the collision frame at the receiving end is received in time.

			Cannot resend immediately after collision is detected
			Truncated binary exponential avoidance algorithm, the exit time of retransmission increases with the increase of retransmission times, reducing the probability of collision, and the upper limit of retransmission is 16 times

			In order to make the frame not end when collision is detected, so that CSMA-CD If the protocol is meaningful, the minimum frame length needs to be defined.
			Then the transmission delay of data frame is required >= 2T, Minimum frame length = Bus propagation delay * Data transmission rate * 2 = 2T * Data transmission rate

			The minimum frame length specified by Ethernet is 64 bytes
		- CSMA-CA agreement(Listen first), Avoid collision
			CD The protocol is applied to wired networks, bus networks, CA Application of protocol in wireless LAN
			good form?

			Before sending data, check whether the channel is idle
			When idle, issue first RTS,wait for CTS frame(It is equivalent to establishing a connection first in order to solve the problem of concealed stations),At the same time, reserve the channel (the sender tells other stations how long they want to transmit data)

			And CD Differences between:
				Different media
				Different ways of monitoring channels
				One detects collision and the other avoids collision
	Polling media access control
		There is no conflict and it takes up all the bandwidth when sending.
		- In the polling protocol, the master node "invites" the slave node to send data in turn
			Problem 1 polling overhead 2 latency 3 single point of failure
		- token-passing protocol 
			The token is transmitted in the ring network. The host that needs to send data obtains the token, attaches the data frame to the token, and then transmits the token.
			Only one node monopolizes the channel at a certain time without collision.
			Each node can obtain the right to send data within a certain time (token holding time), rather than holding tokens indefinitely.

				1. Token overhead 2. Wait delay 3. Single point of failure
			Applied to token ring network (physical star, logical ring)
			It is often used in networks with heavy network load and large traffic

CSMA-CD protocol does not have an acknowledgement mechanism. If no conflict is detected, it is considered that the frame has been correctly received. If it has not been received, the upper transport layer will automatically retransmit (based on the acknowledgement mechanism of the transport layer)
CSMA-CA protocol has a confirmation mechanism,


The broadcast channel is used. Each station is equal and shares the transmission channel

The three elements that determine LAN: topology, transmission medium and medium access control method

Topology: star, bus, ring, tree
 Transmission medium: wired (optical fiber, twisted pair, coaxial cable), wireless (electromagnetic wave)
Mechanism access control method: CSMA-CD(Bus type, tree LAN), token bus, token ring

	- Ethernet: logical topology bus type, using CSMA-CD agreement
	- Token ring network: logical ring topology
	- FDDI Nets: logical ring topology
	- ATM Network: a relatively new unit switching technology, which uses units with a fixed length of 53 bytes for switching
	- WLAN: Using IEEE 802.11 standard


Baseband bus LAN specification, using CSMA-CD Protocol, so it provides connectionless and unreliable services
 No connection: there is no handshake between the sender and the receiver
 Unreliable: the data frame number of the sender is not, the receiver does not confirm to the sender, the error frame is directly discarded, and the error correction is the responsibility of the high level
 Only error free reception is realized, and reliable transmission is not realized

MAC Frame composition
 Destination address | source address | type | data    | FCS
6		|    6  |  2   | 46~1500 | 4

Ethernet MAC The minimum frame length is 64, so the minimum data part is 64-6-6-2-4=46 byte

Wireless LAN

802.11 of MAC frame format

Tags: computer networks

Posted on Thu, 14 Oct 2021 16:53:18 -0400 by archbeta