您好,欢迎来到筏尚旅游网。
搜索
您的当前位置:首页华为基础命令总结

华为基础命令总结

来源:筏尚旅游网


华为基础命令总结

目 录

华为基础命令总结.............................................................................................................................................. 1 1.镜像口配置 ...................................................................................................................................................... 1 2.设备改名字 ...................................................................................................................................................... 2 3.配置保存 .......................................................................................................................................................... 2 4查看路由表 ...................................................................................................................................................... 2 5.telnet密码、特权密码 .................................................................................................................................... 2 6.用户远程登录 从用户模式变成特权模式 .................................................................................................... 3 7.交换接口配置(vlan、access、trunk) ......................................................................................................... 4 8.接口物理配置 .................................................................................................................................................. 4 9.DHCP分配 ........................................................................................................................................................ 5 10.VRRP配置 ....................................................................................................................................................... 6 11.静态路由 ........................................................................................................................................................ 6 12.RIP协议 .......................................................................................................................................................... 6 13.OSPF协议 ....................................................................................................................................................... 7

1.单区域 ...................................................................................................................................................... 7 2.多区域 ...................................................................................................................................................... 8 3.STUB .......................................................................................................................................................... 8 4.完全STB .................................................................................................................................................... 8 5.点到点 ...................................................................................................................................................... 9 6.改COST值 ................................................................................................................................................ 9 7.查看配置信息 ........................................................................................................................................ 10 14.端口聚合 ...................................................................................................................................................... 10

1.二层端口聚合 (华为又名 E-trunk) ...................................................................................................... 10 2.三层端口聚合 ........................................................................................................................................ 13 15.MSTP ............................................................................................................................................................. 14

1.配置 ........................................................................................................................................................ 15 2.查看配置信息 ........................................................................................................................................ 20 16.ACL ................................................................................................................................................................ 20

1. 标准列表.............................................................................................................................................. 21 2.扩展列表 ................................................................................................................................................ 22 3.时间的配置 (例子) ................................................................................................................................ 23 4.查看配置信息 ........................................................................................................................................ 23

1.镜像口配置

[Quidway]monitor-port 指定镜像端口

[Quidway]port mirror 指定被镜像端口

[Quidway]port mirror int_list observing-port int_type int_num 指定镜像和被镜像

2.设备改名字

[SW2]sysname SW2

3.配置保存

save

Are you sure to continue?[Y/N]y

4查看路由表

display ip routing-table

5.telnet密码、特权密码

[Quidway]super password 修改特权用户密码

[Huawei]user-interface vty 0 3

[Huawei-ui-vty0-3]authentication-mode password //设置口令模式

[Huawei-ui-vty0-3]set authentication password cipher 123

[Huawei-ui-vty0-3]user privilege level 3 用户级别

6.用户远程登录 从用户模式变成特权模式

此命令在被telnet的路由器上配置,这里和思科的命令不同,要想在 LSW1 配置密码 只能配置 CON 密码!

[Huawei]super password level 7 cipher 123

例子到 LSW1

LSW2 远程登录

telnet 192.168.1.1

super 7

Password:

sys

[Huawei]

7.交换接口配置(vlan、access、trunk)

[SW1vlan 3

[SW1-vlan3]port ethernet 0/1 to ethernet 0/4 //在VLAN中增加端口

[SW1]int g0/0/1

[SW1-GigabitEthernet0/0/1]port link-type access

[SW1-GigabitEthernet0/0/1]port default vlan 10

[SW1]int e0/0/1

[SW1-Ethernet0/0/1]port link-type trunk

[SW1-Ethernet0/0/1]port trunk allow-pass vlan {ID|All}

[SW1-Ethernet0/0/1]port trunk pvid vlan 3 //设置trunk端口的PVID

8.接口物理配置

[Quidway-Ethernet0/1]duplex {half|full|auto} //配置端口工作状态

[Quidway-Ethernet0/1]speed {10|100|auto} //配置端口工作速率

[Quidway-Ethernet0/1]flow-control //配置端口流控

[Quidway-Ethernet0/1]mdi {across|auto|normal} //配置端口平接扭接

[Quidway-Ethernet0/1]port link-type {trunk|access|hybrid} //设置端口工作模式

[Quidway-Ethernet0/1]undo shutdown //激活端口

9.DHCP分配

[SW2]dhcp enable

[SW2]ip pool 1

[SW2-ip-pool-1]network 192.168.1.0 255.255.255.0

[SW2-ip-pool-1]dns-list 192.168.1.1

[SW2-ip-pool-1]gateway-list 192.168.1.1

[SW2-ip-pool-1]excluded-ip-address 192.168.1.1 255.255.255.0

查看配置命令

[Quidway] display ip pool 查看IP地址池配置情况

10.VRRP配置

[SW2]int vl 10

[SW2-Vlanif10]ip add 192.168.1.253 255.255.255.0

[SW2-Vlanif10]vrrp vrid 10 192.168.1.254

[SW2-Vlanif10]vrrp vrid 10 priority 120

[SW2-Vlanif10]vrrp vrid 10 track interface g0/0/3 reduced 30

查看配置命令

display vrrp 命令可以看到SwitchA的状态是Master

11.静态路由

[SW1]ip route-static 20.1.1.0 255.255.255.0 10.1.1.2

12.RIP协议

[SW1]rip

[SW1-rip-1]version 2

[SW1-rip-1]undo summary

[SW1-rip-1]net 10.0.0.0

删掉 rip 协议

[SW1]undo rip 1

Warning: The RIP process will be deleted. Continue?[Y/N]y

注意:1.绿色数字是几 就删掉几 比如[SW1-rip-2] 就 [SW1]undo rip 2

2.比如10.1.1.1/24 要是通告网络的话 cisco可以10.1.1.0 华为必须的 10.0.0.0

查看配置信息

[SwitchA] display rip 1 route 查看SwitchA的RIP路由表。

13.OSPF协议

1.单区域

[SW1]ospf

[SW1-ospf-1]area 0

[SW1-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255

[SW3]router id 1.1.1.1

2.多区域

[SW1-1]ospf

[SW1-1-ospf-1]area 1

[SW1-1-ospf-1-area-0.0.0.1]network 30.1.1.0 0.0.0.255

3.STUB

[SW1-1-ospf-1-area-0.0.0.1]stub

4.完全STB

[SW1-1-ospf-1-area-0.0.0.1]stub no-summary

NSSA区域和STUB区域配置一样

5.点到点

[SW2]int vl 30

[SW2-Vlanif30]ospf network-type p2p

查看接口什么模式 (紫色部分看出已经变成点到点模式)

[SW3]display ospf interface Vlanif 40

OSPF Process 1 with Router ID 20.1.1.1

Interfaces

Interface: 20.1.1.1 (Vlanif40) --> 20.1.1.2

Cost: 1 State: P-2-P Type: P2P MTU: 1500

Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1

6.改COST值

[SW3]int vl 40

[SW3-Vlanif40]ospf cost 10

查看cost值 (紫色部分已经看出cost值改成10了 默认是1)

[SW3]display ospf interface Vlanif 40

OSPF Process 1 with Router ID 20.1.1.1

Interfaces

Interface: 20.1.1.1 (Vlanif40) --> 20.1.1.2

Cost: 10 State: P-2-P Type: P2P MTU: 1500

Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1

7.查看配置信息

[SwitchA] display ospf peer 查看SwitchA的OSPF邻居

[SwitchA] display ospf routing 显示SwitchA的OSPF路由信息。

[SwitchA] display ospf lsdb 查看SwitchA的LSDB。

14.端口聚合

1.二层端口聚合 (华为又名 E-trunk)

[SW1]interface Eth-Trunk 1

[SW1]int g0/0/1

[SW1-GigabitEthernet0/0/1]eth-trunk 1

[SW1-GigabitEthernet0/0/1]int g0/0/2

[SW1-GigabitEthernet0/0/2]eth-trunk 1

[SW1]int Eth-Trunk 1

[SW1-Eth-Trunk1]port link-type trunk

[SW1-Eth-Trunk1]port trunk allow-pass vlan all

检查Eth-Trunk 1是否创建成功,及成员接口是否正确加入

[SW1]display trunkmembership eth-trunk 1

Trunk ID: 1

Used status: VALID

TYPE: ethernet

Working Mode : Normal

Number Of Ports in Trunk = 2

Number Of Up Ports in Trunk = 2

Operate status: up

Interface GigabitEthernet0/0/1, valid, operate up, weight=1

Interface GigabitEthernet0/0/2, valid, operate up, weight=1

显示Eth-Trunk 1的配置信息(查看时 打dis eth-trunk1 不能打 dis e-trunk 1 因为e-trunk 和 eth-trunk不一样 )

display eth-trunk 1

Eth-Trunk1's state information is:

WorkingMode: NORMAL Hash arithmetic: According to SIP-XOR-DIP

Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8

Operate status: up Number Of Up Port In Trunk: 2

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

PortName Status Weight

GigabitEthernet0/0/1 Up 1

GigabitEthernet0/0/2 Up 1

2.三层端口聚合

[Huawei]vlan 100

[Huawei]int vl 100

[Huawei-Vlanif100]ip add 10.1.1.1 255.255.255.0

[Huawei]interface Eth-Trunk 1

[Huawei]int g0/0/1

[Huawei-GigabitEthernet0/0/1]eth-trunk 1

[Huawei]int g0/0/2

[Huawei-GigabitEthernet0/0/2]eth-trunk 1

[Huawei]interface Eth-Trunk 1

[Huawei-Eth-Trunk1]port link-type access

[Huawei-Eth-Trunk1]port default vlan 100

15.MSTP

拓扑图

注:stp enable 最后配置

1.配置

LSW1

sys

[Huawei]sys LSW1

[LSW1]vl 10

[LSW1-vlan10]vl 20

[LSW1-vlan20]int g0/0/1

[LSW1-GigabitEthernet0/0/1]port link-type trunk

[LSW1-GigabitEthernet0/0/1]port trunk allow-pass vlan all

[LSW1-GigabitEthernet0/0/1]bpdu enable

[LSW1-GigabitEthernet0/0/1]int g0/0/2

[LSW1-GigabitEthernet0/0/2]port link-type trunk

[LSW1-GigabitEthernet0/0/2]port trunk allow-pass vlan all

[LSW1-GigabitEthernet0/0/2]bpdu enable

[LSW1]stp region-configuration

[LSW1-mst-region]region-name RG1

[LSW1-mst-region]region-name RG2

[LSW1-mst-region]instance 1 vlan 10

[LSW1-mst-region]instance 2 vlan 20

[LSW1-mst-region]active region-configuration 激活配置域

[LSW1]stp pathcost-standard legacy 端口开销的计算方法华为私有计算方法

[LSW1]stp bpdu-protection 启动BPDU保护

[LSW1-GigabitEthernet0/0/3]stp edged-port enable 边缘端口配置

[LSW1-GigabitEthernet0/0/3]port hybrid pvid vlan 10 边缘端口配置

[LSW1-GigabitEthernet0/0/3]port hybrid untagged vlan 10 边缘端口配置

[LSW1]int g0/0/4

[LSW1-GigabitEthernet0/0/4]stp edged-port enable

[LSW1-GigabitEthernet0/0/4]port hybrid pvid vlan 20

[LSW1-GigabitEthernet0/0/4]port hybrid untagged vlan 20

[LSW1]stp enable

LSW2

sy

[Huawei]sy LSW2

[LSW2]vl 10

[LSW2-vlan10]vl 20

[LSW2]int g0/0/1

[LSW2-GigabitEthernet0/0/1]port link-type trunk

[LSW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all

[LSW2-GigabitEthernet0/0/1]stp root-protection 启动根保护

[LSW2]int g0/0/2

[LSW2-GigabitEthernet0/0/2]port link-type trunk

[LSW2-GigabitEthernet0/0/2]port trunk allow-pass vlan all

[LSW2-GigabitEthernet0/0/2]stp root-protection

[LSW2]stp region-configuration

[LSW2-mst-region]region-name RG1

[LSW2-mst-region]instance 1 vlan 10

[LSW2-mst-region]instance 2 vlan 20

[LSW2-mst-region]active region-configuration

[LSW2]stp instance 0 priority 4096

[LSW2]stp instance 1 priority 4096

[LSW2]stp instance 2 priority 8192

[LSW2]stp enable

LSW3

sys

[Huawei]sys LSW3

[LSW3]vlan 10

[LSW3-vlan10]vl 20

[LSW3]int g0/0/1

[LSW3-GigabitEthernet0/0/1]port link-type trunk

[LSW3-GigabitEthernet0/0/1]port trunk allow-pass vlan all

[LSW3-GigabitEthernet0/0/1]stp root-protection

[LSW3-GigabitEthernet0/0/1]int g0/0/2

[LSW3-GigabitEthernet0/0/2]port link-type trunk

[LSW3-GigabitEthernet0/0/2]port trunk allow-pass vlan all

[LSW3-GigabitEthernet0/0/2]stp root-protection

[LSW3]stp region-configuration

[LSW3-mst-region]region-name RG2

[LSW3-mst-region]instance 1 vl 10

[LSW3-mst-region]active region-configuration

[LSW3]stp instance 0 priority 8192

[LSW3]stp instance 1 priority 8192

[LSW3]stp instance 2 priority 4096

[LSW3]stp pathcost-standard legacy

[LSW3]stp enable

2.查看配置信息

display stp brief 查看端口状态和端口的保护类型

16.ACL

注:标准访问列表是 2000-2999 扩展访问列表是 3000-3999

LSW1 不能访问 LSW2

1. 标准列表

[SW1]acl 2000 定义ACL规则

[SW1-acl-basic-2000]rule deny source 10.1.1.0 0.0.0.255

[SW1]traffic classifier 1 配置流分类,定义基于ACL的匹配规则

[SW1-classifier-1]if-match acl 2000

[SW1]traffic behavior 2 定义流行为

[SW1-behavior-2]deny

[SW1]traffic policy 3 定义流策略,将流分类与流行为关联

[SW1-trafficpolicy-3]classifier 1 behavior 2

[SW1]int g0/0/1

[SW1-GigabitEthernet0/0/1]traffic-policy 3 outbound 应用流策略到GE0/0/1接口

2.扩展列表

[SW1]acl 3000

[SW1-acl-adv-3000]rule deny ip source 10.1.1.0 0.0.0.255 destination 20.1.1.0 0.0.0.255

[SW1]traffic classifier 1

[SW1-classifier-1]if-match acl 3000

[SW1]traffic behavior 2

[SW1-behavior-2]deny

[SW1]traffic policy 3

[SW1-trafficpolicy-3]classifier 1 behavior 2

[SW1]int g0/0/1

[SW1-GigabitEthernet0/0/1]traffic-policy 3 outbound

3.时间的配置 (例子)

system-view

[Quidway] time-range satime 8:00 to 17:30 working-day

配置8:00至17:30的周期时间段

[Quidway] acl 3000

[Quidway-acl-adv-3000] rule deny ip source 10.164.3.0 0.0.0.255 destination 10.164.9.9 0.0.0.0 time-range satime 调用在列表里

[Quidway-acl-adv-3003] quit

4.查看配置信息

display acl all 查看ACL规则的配置信息

display traffic classifier user-defined 查看流分类的配置信息

display traffic policy user-defined 查看流策略的配置信息。

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

Copyright © 2019- efsc.cn 版权所有

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务