1、交换机命令Quidwaydis cur ;显示当前配置Quidwaydisplay current-configuration ;显示当前配置Quidwaydisplay interfaces ;显示接口信息Quidwaydisplay vlan all ;显示路由信息Quidwaydisplay version ;显示版本信息Quidwaysuper password ;修改特权用户密码Quidwaysysname ;交换机命名Quidwayinterface ethernet 0/1 ;进入接口视图Quidwayinterface vlan x ;进入接口视图Quidway-Vlan-in
2、terfacexip address 10.65.1.1 255.255.0.0 ;配置 VLAN 的 IP 地址Quidwayip route-static 0.0.0.0 0.0.0.0 10.65.1.2 ;静态路由网关Quidwayrip ;三层交换支持Quidwaylocal-user ftpQuidwayuser-interface vty 0 4 ;进入虚拟终端S3026-ui-vty0-4authentication-mode password ;设置口令模式S3026-ui-vty0-4set authentication-mode password simple 222 ;
3、设置口令S3026-ui-vty0-4user privilege level 3 ;用户级别Quidwayinterface ethernet 0/1 ;进入端口模式Quidwayint e0/1 ;进入端口模式Quidway-Ethernet0/1duplex half|full|auto ;配置端口工作状态Quidway-Ethernet0/1speed 10|100|auto ;配置端口工作速率Quidway-Ethernet0/1flow-control ;配置端口流控Quidway-Ethernet0/1mdi across|auto|normal ;配置端口平接扭接Quidway
4、-Ethernet0/1port link-type trunk|access|hybrid ;设置端口工作模式Quidway-Ethernet0/1port access vlan 3 ;当前端口加入到VLANQuidway-Ethernet0/2port trunk permit vlan ID|All ;设 trunk 允许的 VLANQuidway-Ethernet0/3port trunk pvid vlan 3 ;设置 trunk 端口的 PVIDQuidway-Ethernet0/1undo shutdown ;激活端口Quidway-Ethernet0/1shutdown ;关
5、闭端口Quidway-Ethernet0/1quit ;返回Quidwayvlan 3 ;创建 VLANQuidway-vlan3port ethernet 0/1 ;在 VLAN 中增加端口Quidway-vlan3port e0/1 ;简写方式Quidway-vlan3port ethernet 0/1 to ethernet 0/4 ;在 VLAN 中增加端口Quidway-vlan3port e0/1 to e0/4 ;简写方式Quidwaymonitor-port ;指定镜像端口Quidwayport mirror ;指定被镜像端口Quidwayport mirror int_lis
6、t observing-port int_type int_num ;指定镜像和被镜像Quidwaydescription string ;指定 VLAN 描述字符Quidwaydescription ;删除 VLAN 描述字符Quidwaydisplay vlan vlan_id ;查看 VLAN 设置Quidwaystp enable|disable ;设置生成树,默认关闭Quidwaystp priority 4096 ;设置交换机的优先级Quidwaystp root primary|secondary ;设置为根或根的备份Quidway-Ethernet0/1stp cost 200
7、 ;设置交换机端口的花费Quidwaylink-aggregation e0/1 to e0/4 ingress|both ; 端口的聚合Quidwayundo link-aggregation e0/1|all ; 始端口为通道号SwitchA-vlanxisolate-user-vlan enable ;设置主 vlanSwitchAisolate-user-vlan secondary ;设置主 vlan 包括的子 vlanQuidway-Ethernet0/2port hybrid pvid vlan ;设置 vlan 的 pvidQuidway-Ethernet0/2port hyb
8、rid pvid ;删除 vlan 的 pvidQuidway-Ethernet0/2port hybrid vlan vlan_id_list untagged ;设置无标识的 vlan如果包的 vlan id 与 PVId 一致,则去掉 vlan 信息. 默认 PVID=1。所以设置 PVID 为所属 vlan id, 设置可以互通的 vlan 为 untagged.路由器命令Quidwaydisplay version ;显示版本信息Quidwaydisplay current-configuration ;显示当前配置Quidwaydisplay interfaces ;显示接口信息Q
9、uidwaydisplay ip route ;显示路由信息Quidwaysysname aabbcc ;更改主机名Quidwaysuper passwrod 123456 ;设置口令Quidwayinterface serial0 ;进入接口Quidway-serial0ip address ;配置端口 IP 地址Quidway-serial0undo shutdown ;激活端口Quidwaylink-protocol hdlc ;绑定 hdlc 协议Quidwayuser-interface vty 0 4Quidway-ui-vty0-4authentication-mode pass
10、wordQuidway-ui-vty0-4set authentication-mode password simple 222Quidway-ui-vty0-4user privilege level 3Quidway-ui-vty0-4quitQuidwaydebugging hdlc all serial0 ;显示所有信息Quidwaydebugging hdlc event serial0 ;调试事件信息Quidwaydebugging hdlc packet serial0 ;显示包的信息静态路由:Quidwayip route-static interface number|nex
11、thopvaluereject|blackhole例如:Quidwayip route-static 129.1.0.0 16 10.0.0.2Quidwayip route-static 129.1.0.0 255.255.0.0 10.0.0.2Quidwayip route-static 129.1.0.0 16 Serial 2Quidwayip route-static 0.0.0.0 0.0.0.0 10.0.0.2动态路由:Quidwayrip ;设置动态路由Quidwayrip work ;设置工作允许Quidwayrip input ;设置入口允许Quidwayrip out
12、put ;设置出口允许Quidway-ripnetwork 1.0.0.0 ;设置交换路由网络Quidway-ripnetwork all ;设置与所有网络交换Quidway-rippeer ip-address ;Quidway-ripsummary ;路由聚合Quidwayrip version 1 ;设置工作在版本 1Quidwayrip version 2 multicast ;设版本 2,多播方式Quidway-Ethernet0rip split-horizon ;水平分隔Quidwayrouter id A.B.C.D ;配置路由器的 IDQuidwayospf enable ;
13、启动 OSPF 协议Quidway-ospfimport-route direct ;引入直联路由Quidway-Serial0ospf enable area ;配置 OSPF 区域标准访问列表命令格式如下:acl match-order config|auto ;默认前者顺序匹配。rule normal|specialpermit|deny source source-addr source-wildcard|any例:Quidwayacl 10Quidway-acl-10rule normal permit source 10.0.0.0 0.0.0.255Quidway-acl-10r
14、ule normal deny source any扩展访问控制列表配置命令配置 TCP/UDP 协议的扩展访问列表:rule normal|specialpermit|denytcp|udpsource |anydestination |anyoperate配置 ICMP 协议的扩展访问列表:rule normal|specialpermit|denyicmp source |anydestination |anyicmp-code logging扩展访问控制列表操作符的含义equal portnumber ;等于greater-than portnumber ;大于less-than po
15、rtnumber ;小于not-equal portnumber ;不等range portnumber1 portnumber2 ;区间扩展访问控制列表举例Quidwayacl 101Quidway-acl-101rule deny souce any destination anyQuidway-acl-101rule permit icmp source any destination any icmp-type echoQuidway-acl-101rule permit icmp source any destination any icmp-type echo-replyQuidw
16、ayacl 102Quidway-acl-102rule permit ip source 10.0.0.1 0.0.0.0 destination 202.0.0.1 0.0.0.0Quidway-acl-102rule deny ip source any destination anyQuidwayacl 103Quidway-acl-103rule permit tcp source any destination 10.0.0.1 0.0.0.0 destination-port equal ftpQuidway-acl-103rule permit tcp source any d
17、estination 10.0.0.2 0.0.0.0 destination-port equal wwwQuidwayfirewall enableQuidwayfirewall default permit|denyQuidwayint e0Quidway-Ethernet0firewall packet-filter 101 inbound|outbound地址转换配置举例Quidwayfirewall enableQuidwayfirewall default permitQuidwayacl 101 ;内部指定主机可以进入 e0Quidway-acl-101rule deny ip
18、 source any destination anyQuidway-acl-101rule permit ip source 129.38.1.1 0 destination anyQuidway-acl-101rule permit ip source 129.38.1.2 0 destination anyQuidway-acl-101rule permit ip source 129.38.1.3 0 destination anyQuidway-acl-101rule permit ip source 129.38.1.4 0 destination anyQuidway-acl-1
19、01quitQuidwayint e0Quidway-Ethernet0firewall packet-filter 101 inboundQuidwayacl 102 ;外部特定主机和大于 1024 端口的数据包允许进入 S0Quidway-acl-102rule deny ip source any destination anyQuidway-acl-102rule permit tcp source 202.39.2.3 0 destination 202.38.160.1 0Quidway-acl-102rule permit tcp source any destination 2
20、02.38.160.1 0 destination-port great-than1024Quidway-acl-102quitQuidwayint s0Quidway-Serial0firewall packet-filter 102 inbound ;设 202.38.160.1 是路由器出口IP。Quidway-Serial0nat outbound 101 interface ;是 Easy ip,将 acl 101 允许的 IP 从本接口出时变换源地址。内部服务器地址转换配置命令(静态 nat):nat server global port inside port protocol
21、;global_port 不写时使用inside_portQuidway-Serial0nat server global 202.38.160.1 inside 129.38.1.1 ftp tcpQuidway-Serial0nat server global 202.38.160.1 inside 129.38.1.2 telnet tcpQuidway-Serial0nat server global 202.38.160.1 inside 129.38.1.3 www tcp设有公网 IP:202.38.160.101202.38.160.103 可以使用。 ;对外访问(原例题)Qu
22、idwaynat address-group 202.38.160.101 202.38.160.103 pool1 ;建立地址池Quidwayacl 1Quidway-acl-1rule permit source 10.110.10.0 0.0.0.255 ;指定允许的内部网络Quidway-acl-1rule deny source anyQuidway-acl-1int serial 0Quidway-Serial0nat outbound 1 address-group pool1 ;在 s0 口从地址池取出IP 对外访问Quidway-Serial0nat server globa
23、l 202.38.160.101 inside 10.110.10.1 ftp tcpQuidway-Serial0nat server global 202.38.160.102 inside 10.110.10.2 www tcpQuidway-Serial0nat server global 202.38.160.102 8080 inside 10.110.10.3 www tcpQuidway-Serial0nat server global 202.38.160.103 inside 10.110.10.4 smtp udpPPP 设置:Quidway-s0link-protoco
24、l ppp ;默认的协议PPP 验证:主验方:pap|chapQuidwaylocal-user q2 password simple|cipher hello ;路由器 1Quidwayinterface serial 0Quidway-serial0ppp authentication-mode pap|chapQuidway-serial0ppp chap user q1 ;pap 时,没有此句pap 被验方:Quidwayinterface serial 0 ;路由器 2Quidway-serial0ppp pap local-user q2 password simple|ciphe
25、r hellochap 被验方:Quidwayinterface serial 0 ;路由器 2Quidway-serial0ppp chap user q2 ;自己路由器名Quidway-serial0local-user q1 password simple|cipher hello ;对方路由器名帧中继 frame-relay (二分册 6-61)q1fr switchingq1int s1q1-Serial1ip address 192.168.34.51 255.255.255.0q1-Serial1link-protocol fr ;封装帧中继协议q1-Serial1fr inte
26、rface-type dceq1-Serial1fr dlci 100q1-Serial1fr inarpq1-Serial1fr map ip 192.168.34.52 dlci 100q2int s1q2-Serial1ip address 192.168.34.52 255.255.255.0q2-Serial1link-protocol frq2-Serial1fr interface-type dteq2-Serial1fr dlci 100q2-Serial1fr inarpq2-Serial1fr map ip 192.168.34.51 dlci 100帧中继监测q1disp
27、lay fr lmi-infointerface type numberq1display fr mapq1display fr pvc-infoserial interface-numberdlci dlci-numberq1display fr dlci-switchq1display fr interfaceq1reset fr inarp-infoq1debugging fr allinterface type numberq1debugging fr arpinterface type numberq1debugging fr eventinterface type numberq1
28、debugging fr lmiinterface type number启动 ftp 服务:Quidwaylocal-user ftp password simple|cipher aaa service-type ftpQuidwayftp server enable十条华为交换机命令最基本的用法,下面例举了十条最基本的命令,比如:华为交换机命令在基于IOS 的交换机上设置登录口令,华为交换机命令在基于 IOS 的交换机上设置主机名/系统名等。华为交换机命令在基于 IOS 的交换机上设置主机名/系统名:switch(config)# hostname hostname在基于 CLI 的交换
29、机上设置主机名/系统名:switch(enable) set system name name-string华为交换机命令在基于 IOS 的交换机上设置登录口令:switch(config)# enable password level 1 password在基于 CLI 的交换机上设置登录口令:switch(enable) set passwordswitch(enable) set enalbepass华为交换机命令在基于 IOS 的交换机上设置远程访问:switch(config)# interface vlan 1switch(config-if)# ip address ip-add
30、ress netmaskswitch(config-if)# ip default-gateway ip-address在基于 CLI 的交换机上设置远程访问:switch(enable) set interface sc0 ip-address netmask broadcast-addressswitch(enable) set interface sc0 vlanswitch(enable) set ip route default gateway华为交换机命令在基于 IOS 的交换机上启用和浏览 CDP 信息:switch(config-if)# cdp enableswitch(co
31、nfig-if)# no cdp enable为了查看 Cisco 邻接设备的 CDP 通告信息:switch# show cdp interface type modle/portswitch# show cdp neighbors type module/port detail在基于 CLI 的交换机上启用和浏览 CDP 信息:switch(enable) set cdp enable|disable module/port为了查看 Cisco 邻接设备的 CDP 通告信息:switch(enable) show cdp neighborsmodule/port vlan|duplex|c
32、apabilities|detail华为交换机命令基于 IOS 的交换机的端口描述:switch(config-if)# description description-string基于 CLI 的交换机的端口描述:switch(enable)set port name module/number description-string在基于 IOS 的交换机上设置端口速度:switch(config-if)# speed10|100|auto在基于 CLI 的交换机上设置端口速度:switch(enable) set port speed moudle/number 10|100|autosw
33、itch(enable) set port speed moudle/number 4|16|auto在基于 IOS 的交换机上设置以太网的链路模式:switch(config-if)# duplex auto|full|half在基于 CLI 的交换机上设置以太网的链路模式:switch(enable) set port duplex module/number full|half华为交换机命令在基于 IOS 的交换机上配置静态 VLAN:switch# vlan databaseswitch(vlan)# vlan vlan-num name vlaswitch(vlan)# exitsw
34、itch# configure teriminalswitch(config)# interface interface module/numberswitch(config-if)# switchport mode accessswitch(config-if)# switchport access vlan vlan-numswitch(config-if)# end在基于 CLI 的交换机上配置静态 VLAN:switch(enable) set vlan vlan-num name nameswitch(enable) set vlan vlan-num mod-num/port-li
35、st在基于 IOS 的交换机上配置 VLAN 中继线:switch(config)# interface interface mod/portswitch(config-if)# switchport mode trunkswitch(config-if)# switchport trunk encapsulation isl|dotlqswitch(config-if)# switchport trunk allowed vlan remove vlan-listswitch(config-if)# switchport trunk allowed vlan add vlan-list在基于 CLI 的交换机上配置 VLAN 中继线:switch(enable) set trunk module/port on|off|desirable|auto|nonegotiateVlan-range isl|dotlq|dotl0|lane|negotiate华为交换机命令在基于 IOS 的交换机上配置 VTP 管理域:switch# vlan databaseswitch(vlan)# vtp domain domain-name在基于 CLI 的交换机上配置 VTP 管理域:switch(enable) set vtp domain domain-name责任编辑: 王巧玲