您的当前位置:首页正文

华为命令手册

2022-09-26 来源:个人技术集锦
华为交换机命令手册

PCA login: root ;使用root用户password: linux ;口令是linux # shutdown -h now ;关机# init 0 ;关机# logout # login

# ifconfig ;显示IP地址

# ifconfig eth0 netmask ;设置IP地址# ifconfig eht0 netmask down ; # route add 0.0.0.0 gw # route del 0.0.0.0 gw

# route add default gw ;设置网关# route del default gw ;删除网关# route ;显示网关

# ping

# telnet ;建议telnet之前先ping一下

----------------------------------------交换机命令~~~~~~~~~~

[Quidway]super password 修改特权用户密码[Quidway]sysname 交换机命名

[Quidway]interface ethernet 0/1 进入接口视图[Quidway]interface vlan x

进入接口视图

静态路由=网关

[Quidway-Vlan-interfacex]ip address 10.65.1.1 255.255.0.0 [Quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 [Quidway]user-interface vty 0 4

[S3026-ui-vty0-4]authentication-mode password

[S3026-ui-vty0-4]set authentication-mode password simple 222 [S3026-ui-vty0-4]user privilege level 3 [Quidway-Ethernet0/1]duplex {half|full|auto} [Quidway-Ethernet0/1]speed {10|100|auto} [Quidway-Ethernet0/1]flow-control

配置端口双工工作状态配置端口工作速率

配置端口MDI/MDIX

状态平接或扭接

删除IP地址

配置端口流控

设置接口工作模式

[Quidway-Ethernet0/1]mdi {across|auto|normal} [Quidway-Ethernet0/1]shutdown [Quidway-Ethernet0/2]quit

关闭/重起接口

[Quidway-Ethernet0/1]port link-type {trunk|access|hybrid}

退出系统视图

[Quidway]vlan 3 创建/删除一个VLAN/进入VLAN模式[Quidway-vlan3]port ethernet 0/1 to ethernet 0/4

在当前VLAN增加/删除以太网接口

VLAN

设trunk允许的VLAN

[Quidway-Ethernet0/2]port access vlan 3 将当前接口加入到指定[Quidway-Ethernet0/2]port trunk permit vlan {ID|All} [Quidway-Ethernet0/2]port trunk pvid vlan 3

设置trunk端口的PVID

指定和清除镜像端口指定和清除被镜像端口

指定镜像和被镜像

[Quidway]monitor-port [Quidway]port mirror

[Quidway]port mirror int_list observing-port int_type int_num [Quidway]description string

指定VLAN描述字符

查看VLAN设置开启/关闭生成树,默认关闭

[Quidway]description 删除VLAN描述字符[Quidway]display vlan [vlan_id] [Quidway]stp {enable|disable} [Quidway]stp priority 4096

设置交换机的优先级

设置交换机为根或根的备份

[Quidway]stp root {primary|secondary}

[Quidway-Ethernet0/1]stp cost 200 设置交换机端口的花费[SwitchA-vlanx]isolate-user-vlan enable

设置主vlan

设置主vlan包括的子vlan 设置vlan的pvid

设置无标识的

vlan

[SwitchA]Isolate-user-vlan secondary [Quidway-Ethernet0/2]port hybrid pvid vlan [Quidway-Ethernet0/2]port hybrid pvid 如果包的vlan id与PVId一致,则去掉

删除vlan的pvid

vlan信息. 默认PVID=1。

vlan为untagged.

[Quidway-Ethernet0/2]port hybrid vlan vlan_id_list untagged 所以设置PVID为所属vlan id, 设置可以互通的-路由器命令~~~~~~~~~~

[Quidway]display version 显示版本信息[Quidway]display current-configuration [Quidway]display interfaces [Quidway]display ip route

显示路由信息

显示当前配置

显示接口信息

---------------------------------------

[Quidway]sysname aabbcc 更改主机名[Quidway]super passwrod 123456 设置口令[Quidway]interface serial0 进入接口[Quidway-serial0]ip address [Quidway-serial0]undo shutdown [Quidway]link-protocol hdlc [Quidway]user-interface vty 0 4

[Quidway-ui-vty0-4]authentication-mode password

[Quidway-ui-vty0-4]set authentication-mode password simple 222

激活端口绑定hdlc协议

[Quidway-ui-vty0-4]user privilege level 3 [Quidway-ui-vty0-4]quit

[Quidway]debugging hdlc all serial0

显示所有信息调试事件信息

[Quidway]debugging hdlc event serial0

[Quidway]debugging hdlc packet serial0 显示包的信息静态路由:

[Quidway]ip route-static {interface number|nexthop}[value][reject|blackhole] 例如:

[Quidway]ip route-static 129.1.0.0 16 10.0.0.2

[Quidway]ip route-static 129.1.0.0 255.255.0.0 10.0.0.2 [Quidway]ip route-static 129.1.0.0 16 Serial 2 [Quidway]ip route-static 0.0.0.0 0.0.0.0 10.0.0.2

动态路由:[Quidway]rip [Quidway]rip work [Quidway]rip input [Quidway]rip output

[Quidway-rip]network 1.0.0.0 ;可以all [Quidway-rip]network 2.0.0.0 [Quidway-rip]peer ip-address [Quidway-rip]summary [Quidway]rip version 1

[Quidway]rip version 2 multicast [Quidway-Ethernet0]rip split-horizon ;水平分隔

[Quidway]router id A.B.C.D

配置路由器的

ID

[Quidway]ospf enable 启动OSPF协议[Quidway-ospf]import-route direct

引入直联路由

[Quidway-Serial0]ospf enable area 配置OSPF区域

标准访问列表命令格式如下:

acl [match-order config|auto]

默认前者顺序匹配。

rule [normal|special]{permit|deny} [source source-addr source-wildcard|any] 例:

[Quidway]acl 10

[Quidway-acl-10]rule normal permit source 10.0.0.0 0.0.0.255 [Quidway-acl-10]rule normal deny source any

扩展访问控制列表配置命令

配置TCP/UDP协议的扩展访问列表:

rule {normal|special}{permit|deny}{tcp|udp}source {|any}destination |any} [operate]

配置ICMP协议的扩展访问列表:

rule {normal|special}{permit|deny}icmp source {|any]destination {|any] [icmp-code] [logging]

扩展访问控制列表操作符的含义equal portnumber 等于greater-than portnumber 大于less-than portnumber 小于not-equal portnumber 不等

range portnumber1 portnumber2 区间扩展访问控制列表举例[Quidway]acl 101

[Quidway-acl-101]rule deny souce any destination any

[Quidway-acl-101]rule permit icmp source any destination any icmp-type echo [Quidway-acl-101]rule permit icmp source any destination any icmp-type echo-reply [Quidway]acl 102

[Quidway-acl-102]rule permit ip source 10.0.0.1 0.0.0.0 destination 202.0.0.1 0.0.0.0 [Quidway-acl-102]rule deny ip source any destination any [Quidway]acl 103

[Quidway-acl-103]rule permit tcp source any destination 10.0.0.1 0.0.0.0 destination-port ftp

[Quidway-acl-103]rule permit tcp source any destination 10.0.0.2 0.0.0.0 destination-port www

[Quidway]firewall enable

[Quidway]firewall default permit|deny [Quidway]int e0

[Quidway-Ethernet0]firewall packet-filter 101 inbound|outbound

地址转换配置举例[Quidway]firewall enable [Quidway]firewall default permit [Quidway]acl 101

equal equal [Quidway-acl-101]rule deny ip source any destination any

[Quidway-acl-101]rule permit ip source 129.38.1.4 0 destination any [Quidway-acl-101]rule permit ip source 129.38.1.1 0 destination any [Quidway-acl-101]rule permit ip source 129.38.1.2 0 destination any [Quidway-acl-101]rule permit ip source 129.38.1.3 0 destination any [Quidway]acl 102

[Quidway-acl-102]rule permit tcp source 202.39.2.3 0 destination 202.38.160.1 0 [Quidway-acl-102]rule great-than 1024

[Quidway-Ethernet0]firewall packet-filter 101 inbound [Quidway-Serial0]firewall packet-filter 102 inbound

[Quidway]nat address-group 202.38.160.101 202.38.160.103 pool1 [Quidway]acl 1

[Quidway-acl-1]rule permit source 10.110.10.0 0.0.0.255 [Quidway-acl-1]rule deny source any [Quidway-acl-1]int serial 0

[Quidway-Serial0]nat outbound 1 address-group pool1

[Quidway-Serial0]nat server global 202.38.160.101 inside 10.110.10.1 ftp tcp [Quidway-Serial0]nat server global 202.38.160.102 inside 10.110.10.2 www tcp [Quidway-Serial0]nat server global 202.38.160.102 8080 inside 10.110.10.3 www tcp [Quidway-Serial0]nat server global 202.38.160.103 inside 10.110.10.4 smtp udp

permit tcp source any destination 202.38.160.1 0 destination-port

PPP验证:

主验方:pap|chap

[Quidway]local-user u2 password {simple|cipher} aaa [Quidway]interface serial 0

[Quidway-serial0]ppp authentication-mode {pap|chap} [Quidway-serial0]ppp chap user u1 //pap时,不用此句pap被验方:

[Quidway]interface serial 0

[Quidway-serial0]ppp pap local-user u2 password {simple|cipher} aaa chap被验方:

[Quidway]interface serial 0 [Quidway-serial0]ppp chap user u1

[Quidway-serial0]local-user u2 password {simple|cipher} aaa

因篇幅问题不能全部显示,请点此查看更多更全内容