计网5:数据链路层

2016-06-25  本文已影响55人  susu2016

5.数据链路层

链路层的特点和功能

data-link layer has responsibility of transferring datagram from one node to physically adjacent node over a link

结点(node)和链路(link)的定义

two types of “links”:

奇偶校验

循环冗余校验

校验和

求下面三组数据的校验和:

首先将三组数据求和,如果最高位溢出则还要在结果上加1

0110011001100000

0101010101010101

1000111100001100

The sum of first two of these 16-bit words is

0110011001100000

0101010101010101

1011101110110101

Adding the third word to the above sum gives

1011101110110101

1000111100001100

0100101011000010

最后求反码
1011010100111101

At the receiver, all four 16-bit words are added,
including the checksum. If no errors are introduced into the packet, then clearly the
sum at the receiver will be 1111111111111111.

CSMA CSMA/CD 指数回退

用于以太网上多点接入技术

CSMA (carrier sense multiple access) :

每个站在发送数据之前,先检测信道是否空闲,空闲则发送数据,不空闲则等待放弃碰撞的传输,减少信道浪费。

CSMA/CD (collision detection) :

如果碰撞,使用二进制指数退避算法等待一段时间在发送,在短时间内检测到碰撞。

CSMA/CD 碰撞检测图:

二进制指数回退法:

Let’s look at an example. Suppose that a node attempts to transmit a frame for the first time and while transmitting it detects a collision. The node then chooses K 0 with probability 0.5 or chooses K 1 with probability 0.5. If the node chooses K0, then it immediately begins sensing the channel. If the node chooses K 1, it waits 512 bit times (e.g., 0.01 microseconds for a 100 Mbps Ethernet) before beginning
the sense-and-transmit-when-idle cycle. After a second collision, K is chosen with equal probability from {0,1,2,3}. After three collisions, K is chosen with equal probability from {0,1,2,3,4,5,6,7}. After 10 or more collisions, K is chosen with equal probability from {0,1,2, . . . , 1023}. Thus, the size of the sets from which K is chosen grows exponentially with the number of collisions; for this reason this algorithm is referred to as binary exponential backoff.

MAC地址 ARP

32-bit IP地址:
网络层地址
用于使数据报到达目的IP子网

MAC地址:
48 bit,用于使数据报从一个接口到达另一个物理连接的接口。

ARP: 地址解析协议:

以太网

以太网是无连接不可靠的,MAC协议为unslotted CSMA/CD wth binary backoff

以太网帧结构:

交换机原理

交换机表:

上一篇 下一篇

猜你喜欢

热点阅读