总结:学习华为交换机以太网接口基础知识:含以太网接口的简介、分类(包括速率分类、工作层级分类、以及电气属性分类)相关基础理论知识;含以太网接口速率(speed、display this interface命令)、接口工作层级(portswitch、undo portswitch、display this interface命令)相关配置命令;以及配置实例(接口非自协商模式下的速率为100Mbit/s配置案例、接口切换为三层模式配置案例、接口切换为二层模式配置案例)
一、基础理论
1、以太网接口的简介
以太网接口:通常指提供给用户操作或配置的真实存在、有器件支持的以太网物理接口,
主要用于接收和发送数据
2、以太网接口的分类
2.1 速率分类
根据以太网接口支持的速率,可以分为:
FE接口 、GE接口、XGE接口(通常是指10GE接口)、25GE接口、40GE接口、100GE接口
接口类型 | 描述 |
---|---|
FE(Fast Ethernet,快速以太网)接口 | 支持的最大速率为100Mbit/s |
GE(Gigabit Ethernet,高速以太网)接口 | 支持的最大速率为1000Mbit/s |
XGE(10GE)接口 | 支持的最大速率为10000Mbit/s |
25GE接口 | 支持的最大速率为25000Mbit/s |
40GE接口 | 支持的最大速率为40000Mbit/s |
100GE接口 | 支持的最大速率为100000Mbit/s |
2.2 工作层级分类
根据工作的层级(处理报文的转发方式),可以分为:
二层以太网接口和三层以太网接口
接口类型 | 描述 |
---|---|
二层以太网接口 | 工作在数据链路层;只能对接收到的报文进行二层交换转发,也可以加入VLAN,通过VLANIF接口对接收到的报文进行三层路由转发 |
三层以太网接口 | 工作在网络层;可以配置IP地址,对接收到的报文进行三层路由转发,即可以收发源IP和目的IP处于不同网段的报文 |
2.3 电气属性分类
根据接口的电气属性,可以分为:
电接口和光接口
接口类型 | 描述 |
---|---|
电接口 | 使用网线传输数据 |
光接口 | 使用光纤传输数据 |
二、配置命令
1、以太网接口速率相关配置命令
1.1 speed
命令:
speed 1000
##指定接口速率为1000Mbit/s
[ZFB-GigabitEthernet0/0/1]speed ?
10 10M port speed mode
100 100M port speed mode
1000 1000M port speed mode
auto-negotiation Auto negotiation
[ZFB-GigabitEthernet0/0/1] speed 1000 ##指定接口速率为1000Mbit/s
1.2 display this interface
命令:display this interface ##显示当前接口视图下的接口信息(说明:其中Speed字段代表速率)
[ZFB-GigabitEthernet0/0/1]display this interface ##显示当前接口视图下的接口信息(说明:其中Speed字段代表速率)
GigabitEthernet0/0/1 current state : UP
Line protocol current state : UP
Description:
Switch Port, PVID : 1, TPID : 8100(Hex), The Maximum Frame Length is 9216
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-ccb6-2cf3
Last physical up time : 2025-01-01 21:49:34 UTC-08:00
Last physical down time : 2025-01-01 21:49:30 UTC-08:00
Current system time: 2025-01-01 21:54:49-08:00
Speed : 1000, Loopback: NONE ##说明:其中Speed字段代表速率
Hardware address is 4c1f-ccb6-2cf3
Last 300 seconds input rate 0 bytes/sec, 0 packets/sec
Last 300 seconds output rate 0 bytes/sec, 0 packets/sec
Input: 17136 bytes, 144 packets
Output: 238 bytes, 2 packets
Input:
Unicast: 0 packets, Multicast: 144 packets
Broadcast: 0 packets
Output:
Unicast: 0 packets, Multicast: 2 packets
Broadcast: 0 packets
Input bandwidth utilization : 0%
Output bandwidth utilization : 0%
2、接口工作层级相关配置命令
2.1 undo portswitch
命令:undo portswitch ##配置接口切换到三层模式
[ZFB-GigabitEthernet0/0/1] undo portswitch ##配置接口切换到三层模式
2.2 portswitch
命令:portswitch ##配置接口切换到二层模式
[ZFB-GigabitEthernet0/0/1] portswitch ##配置接口切换到二层模式
2.3 display this interface
命令:display this interface ##显示当前接口视图下的接口信息(说明:其中Route Port代表三层模式、Switch Port字段表示接口是二层接口)
##三层
[ZFB-GigabitEthernet0/0/1]dis this interface
GigabitEthernet0/0/1 current state : UP
Line protocol current state : DOWN
Description:
Route Port,The Maximum Frame Length is 9216
Internet protocol processing : disabled
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-ccb6-81ff
Last physical up time : 2025-01-01 22:03:11 UTC-08:00
Last physical down time : 2025-01-01 22:03:09 UTC-08:00
Current system time: 2025-01-01 22:03:15-08:00
##二层
[ZFB-GigabitEthernet0/0/1]display this interface
GigabitEthernet0/0/1 current state : UP
Line protocol current state : UP
Description:
Switch Port, PVID : 1, TPID : 8100(Hex), The Maximum Frame Length is 9216
Internet protocol processing : disabled
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-ccb6-2cf3
Last physical up time : 2025-01-01 22:08:17 UTC-08:00
Last physical down time : 2025-01-01 22:08:15 UTC-08:00
Current system time: 2025-01-01 22:08:45-08:00
三、配置实例
1、以太网接口速率配置案例
1.1 配置接口GE1/0/1在非自协商模式下的速率为100Mbit/s
<ZFB>system-view
[ZFB]interface GigabitEthernet 0/0/1
[ZFB-GigabitEthernet0/0/1]undo negotiation auto
[ZFB-GigabitEthernet0/0/1]speed 1000
2、接口工作层级配置案例
2.1 将接口GE1/0/1切换为三层模式
<ZFB> system-view
[ZFB] interface gigabitethernet 1/0/1
[ZFB-GigabitEthernet1/0/1] undo portswitch
Jan 1 2025 22:03:08-08:00 ZFB %%01PHY/1/PHY(l)[1]: GigabitEthernet0/0/1: change status to down
[ZFB-GigabitEthernet0/0/1]dis this interface
GigabitEthernet0/0/1 current state : UP
Line protocol current state : DOWN
Description:
Route Port,The Maximum Frame Length is 9216
Internet protocol processing : disabled
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-ccb6-81ff
Last physical up time : 2025-01-01 22:03:11 UTC-08:00
Last physical down time : 2025-01-01 22:03:09 UTC-08:00
Current system time: 2025-01-01 22:03:15-08:00
2.2 将接口GE1/0/1切换为二层模式
<ZFB> system-view
[ZFB] interface gigabitethernet 1/0/1
[ZFB-GigabitEthernet0/0/1]portswitch
Jan 1 2025 22:08:15-08:00 ZFB %%01IFNET/4/IF_STATE(l)[3]:Interface Vlanif1 has
turned into UP state.
Jan 1 2025 22:08:15-08:00 ZFB %%01PHY/1/PHY(l)[4]: GigabitEthernet0/0/1: cha
nge status to down
Jan 1 2025 22:08:15-08:00 ZFB %%01IFNET/4/IF_STATE(l)[5]:Interface Vlanif1 has
turned into DOWN state.
[ZFB-GigabitEthernet0/0/1]
Jan 1 2025 22:08:17-08:00 ZFB %%01PHY/1/PHY(l)[6]: GigabitEthernet0/0/1: cha
nge status to up
Jan 1 2025 22:08:17-08:00 ZFB %%01IFNET/4/IF_STATE(l)[7]:Interface Vlanif1 has
turned into UP state.
Jan 1 2025 22:08:22-08:00 ZFB DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 9, the c
hange loop count is 0, and the maximum number of records is 4095.
[ZFB-GigabitEthernet0/0/1]display this interface
GigabitEthernet0/0/1 current state : UP
Line protocol current state : UP
Description:
Switch Port, PVID : 1, TPID : 8100(Hex), The Maximum Frame Length is 9216
Internet protocol processing : disabled
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-ccb6-2cf3
Last physical up time : 2025-01-01 22:08:17 UTC-08:00
Last physical down time : 2025-01-01 22:08:15 UTC-08:00
Current system time: 2025-01-01 22:08:45-08:00
四、说明
个人笔记,仅供参考
微信公众号 【通信小菜鸡】 同步更新中…