当前位置:文档之家› 华为基础命令总结

华为基础命令总结

华为基础命令总结目录1.镜像口配置 (2)2.设备改名字 (2)3.配置保存 (2)4查看路由表 (2)5.telnet密码、特权密码 (2)6.用户远程登录从用户模式变成特权模式 (2)7.交换接口配置(vlan、access、trunk) (3)8.接口物理配置 (3)9.DHCP分配 (3)10.VRRP配置 (4)11.静态路由 (4)12.RIP协议 (4)13.OSPF协议 (5)1.单区域 (5)2.多区域 (5)3.STUB (5)4.完全STB (5)5.点到点 (5)6.改COST值 (6)7.查看配置信息 (6)14.端口聚合 (6)1.二层端口聚合(华为又名E-trunk) (6)2.三层端口聚合 (7)15.MSTP (8)1.配置 (8)2.查看配置信息 (10)16.ACL (10)1. 标准列表 (11)2.扩展列表 (11)3.时间的配置(例子) (11)4.查看配置信息 (12)1.镜像口配置[Quidway]monitor-port <interface_type interface_num> 指定镜像端口[Quidway]port mirror <interface_type interface_num> 指定被镜像端口[Quidway]port mirror int_list observing-port int_type int_num 指定镜像和被镜像2.设备改名字[SW2]sysname SW23.配置保存<SW2>saveAre you sure to continue?[Y/N]y4查看路由表<SW1>display ip routing-table5.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例子LSW2 远程登录到 LSW1<SW2>telnet 192.168.1.1<Huawei>super 7Password:<Huawei>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查看配置命令<SwitchA> display vrrp 命令可以看到SwitchA的状态是Master11.静态路由[SW1]ip route-static 20.1.1.0 255.255.255.0 10.1.1.212.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 1Warning: The RIP process will be deleted. Continue?[Y/N]y注意:1.绿色数字是几就删掉几比如[SW1-rip-2] 就[SW1]undo rip22.比如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.12.多区域[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.2553.STUB[SW1-1-ospf-1-area-0.0.0.1]stub4.完全STB[SW1-1-ospf-1-area-0.0.0.1]stub no-summaryNSSA区域和STUB区域配置一样5.点到点[SW2]int vl 30[SW2-Vlanif30]ospf network-type p2p查看接口什么模式(紫色部分看出已经变成点到点模式)[SW3]display ospf interface Vlanif 40OSPF Process 1 with Router ID 20.1.1.1InterfacesInterface: 20.1.1.1 (Vlanif40) --> 20.1.1.2Cost: 1 State: P-2-P Type: P2P MTU: 1500Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 16.改COST值[SW3]int vl 40[SW3-Vlanif40]ospf cost 10查看cost值(紫色部分已经看出cost值改成10了默认是1)[SW3]display ospf interface Vlanif 40OSPF Process 1 with Router ID 20.1.1.1InterfacesInterface: 20.1.1.1 (Vlanif40) --> 20.1.1.2Cost: 10State: P-2-P Type: P2P MTU: 1500Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 17.查看配置信息[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 1Trunk ID: 1Used status: VALIDTYPE: ethernetWorking Mode : NormalNumber Of Ports in Trunk = 2Number Of Up Ports in Trunk = 2Operate status: upInterface GigabitEthernet0/0/1, valid, operate up, weight=1Interface GigabitEthernet0/0/2, valid, operate up, weight=1显示Eth-Trunk 1的配置信息(查看时打dis eth-trunk1 不能打dis e-trunk 1 因为e-trunk 和 eth-trunk不一样)<Huawei>display eth-trunk 1Eth-Trunk1's state information is:WorkingMode: NORMAL Hash arithmetic: According to SIP-XOR-DIP Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8Operate status: up Number Of Up Port In Trunk: 2--------------------------------------------------------------------------------PortName Status WeightGigabitEthernet0/0/1 Up 1GigabitEthernet0/0/2 Up 12.三层端口聚合[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 10015.MSTP拓扑图注:stp enable 最后配置1.配置LSW1<Huawei>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 enableLSW2<Huawei>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 enableLSW3<Huawei>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 enable2.查看配置信息<SwitchA> display stp brief 查看端口状态和端口的保护类型16.ACL注:标准访问列表是2000-2999 扩展访问列表是3000-3999 LSW1 不能访问LSW21.标准列表[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.00.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 outbound3.时间的配置(例子)<Quidway> 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 destination10.164.9.9 0.0.0.0 time-range satime 调用在列表里[Quidway-acl-adv-3003] quit4.查看配置信息<Quidway> display acl all 查看ACL规则的配置信息<Quidway> display traffic classifier user-defined 查看流分类的配置信息<Quidway> display traffic policy user-defined 查看流策略的配置信息。

相关主题