华为交换机配置指令
视图切换指令
[Quidway]quit //用 [Quidway]sysname devicename 配置文件的保存与删除 保存配置: 擦除配置: 交换机端口基本配置 进入相应端口的视图:[Quidway]interface interface-type interface-number 打开以太网端口:[Switch-ethernet port-id]undo shutdown 设置以太网端口描述字符串:[Switch-ethernet port-id]description text 设置以太网端口的双工模式:[Switch-ethernet port-id]duplex { auto | full | half } 设置以太网端口的速率:[Switch-ethernet port-id]speed { 10 | 100 | 1000 | auto } 设置以太网端口的MDI模式:[Switch-ethernet port-id]mdi { across | auto | normal } 开启以太网端口的流量控制功能:[Switch-ethernet port-id]flow-control display查看指令 查看版本信息: 查看当前配置: 查看保存配置: 显示接口信息: 显示接口IP状态与配置信息: 显示系统运行统计信息: Telnet远程管理的配置 使能Telnet服务器端:[Quidway]telnet server enable //实验室设备默认启动,支持不命令 进入vty用户界面视图:[Quidway]user-interface vty first-num2 [ last-num2 ] 设置验证方式:[Quidway-ui-vty0]authentication-mode { none | password | scheme } 设置本地口令验证:[Quidway-ui-vty0]set authentication password { cipher | simple } password [Quidway-ui-vty0]user privilege level level 本地用户名和口令验证:[Quidway]local-user username [Quidway-luser-xxx] password { cipher | simple } password [Quidway-luser-xxx] service-type telnet [Quidway-luser-xxx] level level //实验室设备默认level3,不支持命令 交换机管理IP地址配置 指定交换机上的管理VLAN [Switch] management-vlan vlan-id //缺省情况下,管理VLAN为VLAN 1 创建并进入管理VLAN 接口视图 [Switch] interface vlan-interface vlan-id 配置管理VLAN 接口IP 地址 [Switch- port-type port-id]ip address ip-address mask //缺省管理VLAN接口没有IP地址 配置静态路由(交换机上实际是在配置默认网络) [Switch]ip route-static ip-address {mask | mask-length} {interface-type interface-number | next-hop} 交换机端口安全配置 开启全局的802.1X特性 [Switch] dot1x 开启端口的802.1X特性 [Switch] dot1x interface interface-list 添加本地接入用户并设置相关参数 [Switch] local-user user-name [Switch-luser-localuser] service-type lan-access [Switch-luser-localuser] password { cipher | simple } password VLAN配置 创建VLAN: [Switch] vlan vlan-id 在VLAN视图中将接口接入该VLAN: [Switch-vlan-id] port interface-list 删除VLAN: [Switch] undo vlan vlan-id //删除VLAN前请将属于该所有接口从该VLAN中移除。 添加VLAN功能描述: [Switch-vlan-id] description text 进入接口视图: [Switch] interface port-type slot/subslot/port 配置端口的链路类型: [Switch-port-type port-id]port link-type {Access | trunk | hybrid} 将Access端口加入到指定的VLAN中 [Switch- port-type port-id] port access vlan vlan-id //所指派的VLAN-id必须存在 允许指定的VLAN通过当前Trunk端口 [Switch- port-type port-id] port trunk permit vlan { vlan-id-list | all } 设置Trunk端口的缺省VLAN [Switch- port-type port-id] port trunk pvid vlan vlan-id 允许指定的VLAN通过当前Hybrid端口 [Switch- port-type port-id] port hybrid vlan vlan-id-list { tagged | untagged } 设置Hybrid端口的缺省VLAN [Switch- port-type port-id] port hybrid pvid vlan vlan-id 交换机链路聚合基本配置 启动链路聚合: [Switch]Link-aggregation interface_name1 to interface_name2 {both | ingress} 关闭链路聚合: [Switch]Undo Link-aggregation {master_interface_name | all} 交换机端口镜像指令 指定镜像端口 [Quidway] monitor-port { interface_type interface_num | interface_name } 指定被镜像端口 [Quidway] port mirror { interface_type interface_ num | interface_name } [ to { interface_type interface_ num | interface_name } ] 配置镜像端口和被镜像端口关联 [Quidway] port mirror interface_list1 observing-port { interface_type interface_ num | interface_name } MAC地址转发表相关配置 配置静态MAC转发表: 在系统视图下添加MAC 地址表项 [Quidway]mac-address {static | dynamic | blackhole} mac-address interface interface-type interface-number vlan vlan-id 在以太网端口视图下添加MAC 地址表项 [Quidway]interface interface-type interface-number [Quidway port-type port-id]mac-address { static | dynamic | blackhole } mac-address vlan vlan-id 设置端口最多可以学习到的MAC 地址数量: [Quidway]interface interface-type interface-number [Quidway port-type port-id]mac-address max-mac-count count 以太网端口典型配置举例 [Sysname] vlan 2 [Sysname-vlan2] vlan 6 [Sysname-vlan6] vlan 50 [Sysname-vlan100] vlan 100 [Sysname] interface ethernet1/0/1 [Sysname-Ethernet1/0/1] port link-type trunk [Sysname-Ethernet1/0/1] port trunk permit vlan 2 6 to 50 100 [Sysname-Ethernet1/0/1] port trunk pvid vlan 100 [Sysname-Ethernet1/0/1] interface ethernet1/0/2 [Sysname-Ethernet1/0/1] port link-type access [Sysname-Ethernet1/0/1] port access vlan 2 STP配置 在交换机上启动或关闭STP服务: [Quidway] stp {enable | disable} 在接口下启动或关闭STP服务: [Quidway]interface interface-type interface-number [Quidway -pot-type port-id] stp {enable | disable} 配置STP的工作模式: [Quidway] stp mode { stp | rstp | mstp } 配置当前设备的优先级: [Quidway] stp [ instance instance-id ] priority priority 配置端口为边缘端口: [Quidway -pot-type port-id] stp edged-port enable 查看STP相关信息: [Quidway] display stp 因篇幅问题不能全部显示,请点此查看更多更全内容