当前位置:文档之家› 华为交换机配置命令

华为交换机配置命令

华为交换机配置命令华为交换机配置指令视图切换指令<Quidway>system-view[Quidway]quit //用<Ctrl+Z>可以从任意视图直接回到用户视图交换机命名[Quidway]sysname devicename配置文件的保存与删除保存配置:<Quidway>save擦除配置:<Quidway>reset saved-configuration<Quidway>reboot交换机端口基本配置进入相应端口的视图:[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-controldisplay查看指令查看版本信息:<Quidway>display version查看当前配置:<Quidway>display current-configuration查看保存配置:<Quidway>display saved-configuration显示接口信息:<Quidway>display interface 显示接口IP状态与配置信息:<Quidway>display ip interface brief显示系统运行统计信息:<Quidway>display diagnostic-informationTelnet远程管理的配置使能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 levellevel本地用户名和口令验证:[Quidway]local-user username[Quidway-luser-xxx]password{ cipher|simple}password[Quidway-luser-xxx] service-typetelnet[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 } passwordVLAN配置创建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 vlanvlan-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_typeinterface_num | interface_name }指定被镜像端口[Quidway] port mirror {interface_typeinterface_ num | interface_name} [ to{ interface_type interface_ num |interface_name } ]配置镜像端口和被镜像端口关联[Quidway] port mirror interface_list1observing-port{interface_type interface_num | interface_name }MAC地址转发表相关配置配置静态MAC转发表:在系统视图下添加MAC 地址表项[Quidway]mac-address {static | dynamic |blackhole} mac-address interfaceinterface-type interface-number vlanvlan-id在以太网端口视图下添加MAC 地址表项[Quidway]interface interface-typeinterface-number[Quidway port-type port-id]mac-address{ static | dynamic | blackhole }mac-addressvlan vlan-id设置端口最多可以学习到的MAC 地址数量:[Quidway]interface interface-typeinterface-number[Quidway port-type port-id]mac-addressmax-mac-count count以太网端口典型配置举例<Sysname> system-view[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 2STP配置在交换机上启动或关闭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。

相关主题