A few minutes to quickly understand the data link layer and switch

A: the data link layer

1.1 data link layer establishing, maintaining and dismantling

1.2 Packaging, frame transmission, frame synchronization

Error Recovery 1.3

1.3.1 method retransmitted.

1.4 Flow Control

1.4.1 ensure stable transmission and the transceiver device matches both the intermediate transmission rate.

Two: Ethernet frame format

2.1 Ethernet MAC address

Used to identify a device on a single Ethernet or a group of devices.

A few minutes to quickly understand the data link layer and switch

Because the MAC address is composed of 48-bit binary number, it is usually divided into six sections. Of which the first 24 are the manufacturers want to IEEE application vendor number 24 after a network interface card serial number. MAC address of the eighth bit is 0, indicating that the MAC address is a unicast address is 1, indicates that the MAC address as the multicast address.

2.2 Ethernet frame format

There are a variety of Ethernet frame format, describes the most commonly used Ethernet II frame format where the frame contains six domains.

mark

The preamble comprises a figure-eight knot, a layer containing a start frame delimiter. In Ethernet, the preamble is considered to be part of the physical layer of the package, rather than encapsulating the data link layer.

Contains six bytes of the destination address, it identifies the MAC address of the destination station frame. The destination address can be a unicast address (single destination), a multicast address (destination group) or a broadcast address.

Contains six bytes of source address, source address identifies the sender MAC address of the station frame. Source address must be a unicast address. (Eighth bit is 0)

Type field comprises two bytes for indicating a type of upper-layer protocols, such as IP protocol indicates 0800H.

Data field contains 46-1500 bytes. It encapsulates the data field information through higher layer protocols of Ethernet transmission. <U> Type field and the data field can be understood as a data packet </ u>

It comprises a four-byte frame check sequence, data from the destination address field to check the end of this section.

Three: Forwarding principle of the switch.

3.1 Environment: The initial state of the switch, the three MAC address known to the switch connected to the PC UTP.

mark

3.2 Process:

A host wants to send data to the host B frame.

3.3 Principles:

1. MAC address learning

mark

Due to the switch in the initial state, so there is no MAC address table of the switch. In this case, the host A wants to send a data frame to host B, No. 1 bound via the interface enters the switch case, the switch will be the source address of the host A and income to the interface of the data frame number (No. 1 Interface) association, to the MAC address table of the switch.

2. Broadcast the unknown data frame

mark

交换机知道A主机要将信息发送给B主机,但交换机目前只知道A主机的MAC地址,所以交换机在MAC地址表中找不到B主机的MAC地址,所以,交换机采用广播的方式,除了1号接口之外的所有接口都将转发这个数据帧,于是,B主机和C主机都会收到这个数据帧。

3. 接收方回应消息

mark

B主机和C主机都接收到数据帧后,C主机查看数据帧,发现和自己没关系,所以不做回应。B主机发现对方的数据帧正式发给自己的,所以B主机会响应这个广播,并回应一个数据帧(B主机的源地址22...目标地址11...),此时,数据帧通过2号接口经过交换机,交换机便会将这个数据帧的源地址和接口编号(2接口)对应起来,添加到MAC地址表中。

4. 交换机实现单播通信

此时,A主机和B主机的通信便不需要借助广播了,因为交换机MAC地址表中已经记录了它们的条目。所以现在A主机和B主机通信,交换机会直接将数据通过对应接口发送给对方。

四:交换机的命令行配置

mark

4.1用户模式

交换机启动完按下Enter键,首先进入的就是用户模式。该模式下,用户受到极大的限制,只能查看一些统计信息。

4.2特权模式

用户模式下输入enable(可以简写为“en”)命令就可以进入特权模式,该模式可以查看并修改Cisco设备的配置。

4.3全局配置模式

特权模式下输入config terminal(可简写为“conf t”)命令就可以进入全局配置模式,用户在该模式下可修改交换机的全局配置。

4.4接口模式

在全局配置模式下输入interface fastetherent 0/1(可简写为“int f0/1”)命令就可以进入接口模式。与全局模式不同,用户在该模式下所做的配置都是针对f0/1这个接口所设定的。

mark

4.5查看MAC地址表

特权模式输入命令:show mac-address-table[dynamic],"dynamic"是可选参数,可以使交换机只显示交换机动态学习到的MAC地址。

4.6配置接口的双工模式和速率

4.1.1配置指定接口的通信速率

Command line is as follows: Switch (config-if) #speed [10/100/1000 / auto]

speed: configure the interface rate keywords

10/100/1000: Configure particular rate value as an excuse. <U> We are now generally set 100 </ u>

auto: interface negotiation peer communication rate automatically.

mark

mark

4.1.2 duplex mode specified interface

Command line as follows: switch (config-if) #duplex [full / half / auto]

duplex: Keyword-duplex mode

full: The duplex mode is designated as a full-duplex

half: The duplex mode is designated as the half-duplex

auto: The duplex mode of the interface is specified as auto-negotiation

Duplex mode generally two switches to full duplex. duplex full

mark

4.1.3 View interface duplex and speed

Command: show interface f1 / 0, in privileged mode can be.

mark

As can be seen from the displayed results, the link is established, full duplex duplex mode negotiation, mode negotiation rate 100M / S communication rate.

Guess you like

Origin blog.51cto.com/14557670/2443404