2024年1月17日发(作者:)

---------------------------------------------------------------最新资料推荐------------------------------------------------------

实验十七:交换机端口基本配置

实验十七:

交换机端口基本配置 一、 理论基础 1、 端口的速率 华为

Quidway S 系列交换机支持端口速率的手工配置和自适应, 缺省情况下所有端口都是自适应状态, 通过相互交换自协商报文进行速率匹配。

当链路两端一端为自适应, 另一端为固定速率时, 我们建议修改两端的端口速率, 保持端口速率的一致。

如果两端的速率不一致时, 很容易出现通信故障, 应当尽量避免。

可以使用 speed 命令对以太网端口的速率进行设置, 当设置端口速率为自协商状态时,端口的速率在双方自动协商下而定。

需要注意的是:

百兆以太网电端口支持 10Mbit/s、 100Mbit/s 或自协商工作速率, 可以根据需要对其设置。

缺省情况下, 以太网端口的速率处于 auto(自协商) 状态。

2、 端口模式 目前新的交换机端口既支持全双工工作模式, 也支持半双工工作模式。

可以手工配置,也可以自动协商来决定端口到底工作在哪种模式下。

Auto:

1 / 14

表示端口工作在自协商模式。

Full:

表示端口工作在全双工模式。

Half:

表示端口工作在半双工模式。

当希望端口在发送数据包的同时可以接收数据包, 可以将端口设置为全双工属性; 当希望端口同一时刻只能发送数据包或接收数据包时, 可以将端口设置为半双工属性; 当设置端口为自协商状态时, 端口的双工状态由本端口和对端端口自动协商而定。

需要注意的是:

百兆以太网电端口支持全双工、 半双工或自协商工作模式, 可以根据需要对其设置。

缺省情况下, 端口的双工状态为 auto(自协商) 状态。

二、 实验案例 基本端口的配置 1、 实验拓扑图:

2、 配置说明:

交换机 A 加地址: 192. 168. 10. 1 交换机 B 加地址: 192.

168. 10. 2 3、 具体配置:

方法一:

(speed) 交换机 B 的配置:

[SwitchB]int vlan 1 [SwitchB-Vlan-interface1]ip address

192. 168. 10. 2 255. 255. 255. 0 交换机 A 的配置:

[SwitchA]int vlan 1 [SwitchA-Vlan-interface1]ip address

---------------------------------------------------------------最新资料推荐------------------------------------------------------

192. 168. 10. 1 255. 255. 255. 0 [SwitchA-Vlan-interface1]quit

[SwitchA]ping 192. 168. 10. 2 PING 192. 168. 10. 2: 56 data

bytes, press CTRL_C to break Reply from 192. 168. 10. 2:

bytes=56 Sequence=1 ttl=255 time = 50 ms Reply from 192.

168. 10. 2: bytes=56 Sequence=2 ttl=255 time = 20 ms Reply

from 192. 168. 10. 2: bytes=56 Sequence=3 ttl=255 time = 20

ms Reply from 192. 168. 10. 2: bytes=56 Sequence=4

ttl=255 time = 20 ms Reply from 192. 168. 10. 2: bytes=56

Sequence=5 ttl=255 time = 30 ms --- 192. 168. 10. 2 ping

statistics --- 5 packet(s) transmitted 5 packet(s)

received 0. 00% packet loss round-trip min/avg/max =

20/28/50 ms [SwitchA]dis int e0/1 Ethernet0/1 current state :

UP IP Sending Frames’ Format is PKTFMT_ETHNT_2, Hardware

address is 000f-e206-f643 The Maximum Transmit Unit is 1500

Media type is twisted pair, loopback not set Port hardware

type is 100_BASE_TX 100Mbps-speed mode, full-duplex mode

Link speed type is autonegotiation, link duplex type is

autonegotiation Flow-control is not enabled

Port-flow-constrain has not been configured completely The

Maximum Frame Length is 1518 Broadcast MAX-ratio: 100%

PVID: 1 Mdi type: normal Port link-type: access Tagged

3 / 14

VLAN ID : none Untagged VLAN ID : 1 Last 300 seconds input:

0 packets/sec 17 bytes/sec Last 300 seconds output: 0

packets/sec 19 bytes/sec Input(total) : 85 packets, 8722

bytes 47 broadcasts, 32 multicasts Input(normal) :

85 packets, - bytes 47 broadcasts, 32 multicasts

Input: 0 input errors, 0 runts, 0 giants, - throttles,

0 CRC 0 frame, - overruns, 0 aborts, 0 ignored,

- parity errors Output(total) : 129 packets, 11374 bytes

92 broadcasts, 32 multicasts, 0 pauses Output(normal) :

129 packets, - bytes 92 broadcasts, 32 multicasts,

- pauses Output: 0 output errors, - underruns, - buffer

failures 0 aborts, 0 deferred, 0 collisions, 0

late collisions lost carrier, - no carrier 默认的情况下,

E0/1 都是 100M/10M 自适应的端口, 从实验结果可见, 它们最终自动协商的结果是工作在最高速度。

[SwitchA]int e0/1 [SwitchA-Ethernet0/1]speed 10

[SwitchA-Ethernet0/1] %Apr 2 00: 35:04 2019 SwitchA

L2INF/5/PORT LINK STATUS CHANGE: Ethernet0/1: turns into

DOWN state %Apr 2 00: 35:04 2019 SwitchA L2INF/5/VLANIF LINK

STATUS CHANGE: Vlan-interface1: turns into DOWN state %Apr

2 00: 35: 04 2019 SwitchA IFNET/5/UPDOWN: Line protocol on the

interface Vlan -interface1 turns into DOWN state %Apr 2 00:

---------------------------------------------------------------最新资料推荐------------------------------------------------------

35:06 2019 SwitchA L2INF/5/PORT LINK STATUS CHANGE:

Ethernet0/1: turns into UP state %Apr 2 00: 35:06 2019

SwitchA L2INF/5/VLANIF LINK STATUS CHANGE: Vlan-interface1:

turns into UP state %Apr 2 00: 35: 06 2019 SwitchA

IFNET/5/UPDOWN: Line protocol on the interface Vlan

-interface1 turns into UP state [SwitchA]dis int e0/1

Ethernet0/1 current state : UP IP Sending Frames’ Format

is PKTFMT_ETHNT_2, Hardware address is 000f-e206-f643 The

Maximum Transmit Unit is 1500 Media type is twisted pair,

loopback not set Port hardware type is 100_BASE_TX

10Mbps-speed mode, full-duplex mode Link speed type is force

link, link duplex type is autonegotiation Flow-control is

not enabled Port-flow-constrain has not been configured

completely The Maximum Frame Length is 1518 Broadcast

MAX-ratio: 100% PVID: 1 Mdi type: normal Port link-type:

access Tagged VLAN ID : none Untagged VLAN ID : 1

Last 300 seconds input: 0 packets/sec 10 bytes/sec Last 300

seconds output: 0 packets/sec 12 bytes/sec Input(total) :

129 packets, 13106 bytes 75 broadcasts, 48

multicasts Input(normal) : 129 packets, - bytes

75 broadcasts, 48 multicasts Input: 0 input errors, 0

5 / 14

runts, 0 giants, - throttles, 0 CRC 0 frame, -

overruns, 0 aborts, 0 ignored, - parity errors

Output(total) : 200 packets, 17342 bytes 148

broadcasts, 47 multicasts, 0 pauses Output(normal) : 200

packets, - bytes 148 broadcasts, 47 multicasts,

- pauses Output: 0 output errors, - underruns, - buffer

failures 0 aborts, 0 deferred, 0 collisions, 0

late collisions - lost carrier, - no carrier

[SwitchB]dis int e0/1 Ethernet0/1 current state : UP IP

Sending Frames’ Format is PKTFMT_ETHNT_2, Hardware address

is 000f-e201-07c7 The Maximum Transmit Unit is 1500 Media

type is twisted pair, loopback not set Port hardware type is

100_BASE_TX 10Mbps-speed mode, full-duplex mode Link

speed type is autonegotiation, link duplex type is

autonegotiation Flow-control is not enabled The Maximum

Frame Length is 1518 Broadcast MAX-ratio: 100% PVID: 1

Mdi type: normal Port link-type: access Tagged VLAN ID :

none Untagged VLAN ID : 1 Last 300 seconds input: 0

packets/sec 7 bytes/sec Last 300 seconds output: 0

packets/sec 5 bytes/sec Input(total) : 213 packets, 19306

bytes 158 broadcasts, 50 multicasts

Input(normal) : - packets, - bytes - broadcasts,

---------------------------------------------------------------最新资料推荐------------------------------------------------------

- multicasts Input: 0 input errors, - runts, 0 giants,

- throttles, 0 CRC 0 frame, - overruns, 0 aborts,

0 ignored, - parity errors Output(total) : 137 packets,

13286 bytes 81 broadcasts, 50 multicasts, 0 pauses

Output(normal) : - packets, - bytes - broadcasts,

- multicasts, - pauses Output: 0 output errors, -

underruns, - buffer failures - aborts, 0 deferred,

0 collisions, 0 late collisions lost carrier, - no carrier

手动更改交换机 A 的 E0/1 速度为 10Mbps, 查看实验结果, 依然能够 ping 通, 同时发现交换机 B 的 E0/1 的端口速度已自动变为

10Mbps. [SwitchB]int e0/1 [SwitchB-Ethernet0/1]speed 100

[SwitchB-Ethernet0/1] %Apr 2 00: 42:42 2019 SwitchB

L2INF/5/PORT LINK STATUS CHANGE: Ethernet0/1: turns into

DOWN state %Apr 2 00: 42:42 2019 SwitchB L2INF/5/VLANIF LINK

STATUS CHANGE: Vlan-interface1: turns into DOWN state %Apr

2 00: 42: 42 2019 SwitchB IFNET/5/UPDOWN: Line protocol on the

interface Vlan -interface1 turns into DOWN state

[SwitchB-Ethernet0/1]quit [SwitchB]ping 192. 168. 10. 1

PING 192. 168. 10. 1: 56 data bytes, press CTRL_C to break

Request time out Request time out Request time out

Request time out Request time out --- 192. 168. 10. 1

7 / 14

ping statistics --- 5 packet(s) transmitted 0

packet(s) received 100. 00% packet loss 此时, 把 SwitchB 的端口速度强行更改为 100Mbps, 那么两者之间将 ping 不通, 因为两个端口都工作在非自动协商的方式下, 接口是 Down 的。

方法二:

(duplex) [SwitchA]dis int e0/1 Ethernet0/1 current

state : UP IP Sending Frames’ Format is PKTFMT_ETHNT_2,

Hardware address is 000f-e206-f643 The Maximum Transmit Unit

is 1500 Media type is twisted pair, loopback not set Port

hardware type is 100_BASE_TX 100Mbps-speed mode,

full-duplex mode Link speed type is autonegotiation, link

duplex type is autonegotiation Flow-control is not enabled

Port-flow-constrain has not been configured completely The

Maximum Frame Length is 1518 Broadcast MAX-ratio: 100%

PVID: 1 Mdi type: normal Port link-type: access Tagged

VLAN ID : none Untagged VLAN ID : 1 Last 300 seconds input:

0 packets/sec 5 bytes/sec Last 300 seconds output: 0

packets/sec 8 bytes/sec Input(total) : 416 packets, 40459

bytes 175 broadcasts, 83 multicasts

Input(normal) : 416 packets, - bytes 175

broadcasts, 83 multicasts Input: 0 input errors, 0 runts,

0 giants, - throttles, 0 CRC 0 frame, -

---------------------------------------------------------------最新资料推荐------------------------------------------------------

overruns, 0 aborts, 0 ignored, - parity errors

Output(total) : 480 packets, 40993 bytes 248

broadcasts, 81 multicasts, 0 pauses Output(normal) : 480

packets, - bytes 248 broadcasts, 81 multicasts,

- pauses Output: 0 output errors, - underruns, - buffer

failures 0 aborts, 0 deferred, 0 collisions, 0

late collisions lost carrier, - no carrier 默认的情况下, 交换机 A 和交换机 B 的 E0/1 接口会自动协商为 FULL 模式。

[SwitchA]int e0/1 [SwitchA-Ethernet0/1]duplex half

[SwitchA-Ethernet0/1]dis int e0/1 Ethernet0/1 current state :

UP IP Sending Frames’ Format is PKTFMT_ETHNT_2, Hardware

address is 000f-e206-f643 The Maximum Transmit Unit is 1500

Media type is twisted pair, loopback not set Port hardware

type is 100_BASE_TX 100Mbps-speed mode, half-duplex mode

Link speed type is autonegotiation, link duplex type is force

link Flow-control is not enabled Port-flow-constrain has

not been configured completely The Maximum Frame Length is

1518 Broadcast MAX-ratio: 100% PVID: 1 Mdi type: normal

Port link-type: access Tagged VLAN ID : none

Untagged VLAN ID : 1 Last 300 seconds input: 0 packets/sec

10 bytes/sec Last 300 seconds output: 0 packets/sec 8

9 / 14

bytes/sec Input(total) : 421 packets, 41047 bytes

177 broadcasts, 86 multicasts Input(normal) : 421 packets,

- bytes 177 broadcasts, 86 multicasts Input: 0

input errors, 0 runts, 0 giants, - throttles, 0 CRC

0 frame, - overruns, 0 aborts, 0 ignored, - parity errors

Output(total) : 484 packets, 41417 bytes 250

broadcasts, 83 multicasts, 0 pauses Output(normal) : 484

packets, - bytes 250 broadcasts, 83 multicasts,

- pauses Output: 0 output errors, - underruns, - buffer

failures 0 aborts, 0 deferred, 0 collisions, 0

late collisions lost carrier, - no carrier 将交换机 A 的

E0/1 接口手动的改为 half 模式, 协商结果交换机 B 的 E0/1 会自动的变为half。

看一下显示结果; [SwitchB]dis int e0/1 Ethernet0/1

current state : UP IP Sending Frames’ Format is

PKTFMT_ETHNT_2, Hardware address is 000f-e201-07c7 The

Maximum Transmit Unit is 1500 Media type is twisted pair,

loopback not set Port hardware type is 100_BASE_TX

100Mbps-speed mode, half-duplex mode Link speed type is

autonegotiation, link duplex type is autonegotiation

Flow-control is not enabled The Maximum Frame Length is 1518

Broadcast MAX-ratio: 100% PVID: 1 Mdi type: normal Port

---------------------------------------------------------------最新资料推荐------------------------------------------------------

link-type: access Tagged VLAN ID : none Untagged

VLAN ID : 1 Last 300 seconds input: 0 packets/sec 14

bytes/sec Last 300 seconds output: 0 packets/sec 13

bytes/sec Input(total) : 309 packets, 25832 bytes

84 broadcasts, 28 multicasts Input(normal) : - packets,

- bytes - broadcasts, - multicasts Input: 0

input errors, - runts, 0 giants, - throttles, 0 CRC

0 frame, - overruns, 0 aborts, 0 ignored, - parity errors

Output(total) : 328 packets, 29936 bytes 89

broadcasts, 31 multicasts, 0 pauses Output(normal) : -

packets, - bytes - broadcasts, - multicasts, -

pauses Output: 0 output errors, - underruns, - buffer

failures - aborts, 0 deferred, 0 collisions, 0

late collisions - lost carrier, - no carrier 此时将交换机 B 的接口强行的改为 full, 虽然还能 ping 通, 但是当在两者之间同时用大包、 连续的多次 ping 对方, 就会发现有丢包的现象。

[SwitchB]int e0/1 [SwitchB-Ethernet0/1]duplex full %Apr

2 01: 11:03 2019 SwitchA L2INF/5/PORT LINK STATUS CHANGE:

Ethernet0/1: turns into DOWN state %Apr 2 01: 11:03 2019

SwitchA L2INF/5/VLANIF LINK STATUS CHANGE: Vlan-interface1:

11 / 14

turns into DOWN state %Apr 2 01: 11: 03 2019 SwitchA

IFNET/5/UPDOWN: Line protocol on the interface Vlan

-interface1 turns into DOWN state %Apr 2 01: 11:04 2019

SwitchA L2INF/5/PORT LINK STATUS CHANGE: Ethernet0/1: turns

into UP state %Apr 2 01: 11:04 2019 SwitchA L2INF/5/VLANIF

LINK STATUS CHANGE: Vlan-interface1: turns into UP

state %Apr 2 01: 11: 04 2019 SwitchA IFNET/5/UPDOWN: Line

protocol on the interface Vlan -interface1 turns into UP state

看一下 PING 的结果:

[SwitchB-Ethernet0/1]ping 192. 168. 10. 1 PING 192. 168.

10. 1: 56 data bytes, press CTRL_C to break Reply from

192. 168. 10. 1: bytes=56 Sequence=1 ttl=255 time = 30 ms

Reply from 192. 168. 10. 1: bytes=56 Sequence=2 ttl=255 time

= 30 ms Reply from 192. 168. 10. 1: bytes=56 Sequence=3

ttl=255 time = 30 ms Reply from 192. 168. 10. 1: bytes=56

Sequence=4 ttl=255 time = 20 ms Reply from 192. 168. 10.

1: bytes=56 Sequence=5 ttl=255 time = 20 ms --- 192. 168.

10. 1 ping statistics --- 5 packet(s) transmitted 5

packet(s) received 0. 00% packet loss round-trip

min/avg/max = 20/26/30 ms SwitchBping -s 8100 -c 1000 192. 168.

10. 1 PING 192. 168. 10. 1: 8100 data bytes, press CTRL_C

to break Reply from 192. 168. 10. 1: bytes=8100

---------------------------------------------------------------最新资料推荐------------------------------------------------------

Sequence=1 ttl=255 time = 130 ms Reply from 192. 168. 10.

1: bytes=8100 Sequence=2 ttl=255 time = 140 ms Reply

from 192. 168. 10. 1: bytes=8100 Sequence=10 ttl=255 time =

130 ms . . . . . . . . . . . . . . . . . . . . Reply from 192.

168. 10. 1: bytes=8100 Sequence=1 ttl=255 time = 130 ms

Reply from 192. 168. 10. 1: bytes=8100 Sequence=200 ttl=255

time = 140 ms Reply from 192. 168. 10. 1: bytes=8100

Sequence=201 ttl=255 time = 190 ms Reply from 192. 168. 10.

1: bytes=8100 Sequence=202ttl=255 time = 130 ms Reply

from 192. 168. 10. 1: bytes=8100 Sequence=203 ttl=255 time =

170 ms Request time out . . . . . . . . . . . . . . . . . .

Request time out Reply from 192. 168. 10. 1: bytes=8100

Sequence=1 ttl=255 time = 130 ms Reply from 192. 168. 10.

1: bytes=8100 Sequence=800 ttl=255 time = 140 ms Reply

from 192. 168. 10. 1: bytes=8100 Sequence=801 ttl=255 time =

190 ms Reply from 192. 168. 10. 1: bytes=8100

Sequence=802 ttl=255 time = 130 ms Reply from 192. 168. 10.

1: bytes=8100 Sequence=803 ttl=255 time = 170 ms --- 192.

168. 10. 1 ping statistics --- 1000 packet(s) transmitted

997 packet(s) received 0. 30% packet loss round-trip

min/avg/max = 130/152/190 ms 三、 实验总结 端口模式的匹配

13 / 14

在现实生活中很重要, 有很多的网络故障都是由于端口模式的不匹配而造成, 所以我们在排错的过程中, 首先就应该检查这些基本的参数配置。