华为VRP系统常用命令的总结

小编:小丢 更新时间:2022-05-03

华为VRP系统常用命令的总结

0、华为路由器、交换机清除配置命令

reset saved-configuration 然后选择 y

reboot

第一次输入 n

第二次输入 y

重启完成后配置就没了

华为VRP系统常用命令的总结华为VRP系统常用命令的总结

1、

用户视图 在这个视图下面所执行的命令特别少 一般执行ping命令或者保存(save)命令等等

其中<>代表的就是用户视图 Huawei表示的就是这个路由器的名称

华为VRP系统常用命令的总结

2、system-view ===>>>[Huawei]

系统视图 在这个视图下面所执行的命令特别多 通过该视图可以控制整个路由器其中[]代表的就是系统视图 Huawei表示的就是这个路由器的名称

3、[Huawei]quit

quit就是相当于撤销的意思,退出到上一视图

5、[AR1]interface GigabitEthernet 0/0/0

从系统视图下进入到接口视图下面 也就是路由器的G0/0/0接口下面了

6、? Tab键或者简写

就是咱们VRP系统帮助命令

7、 [R1-GigabitEthernet0/0/0]ip address 192.168.1.1 255.255.255.0 //255.255.255.0 可以直接写成24 如果想要修改接口的IP地址的话 直接再敲一遍ip address X.X.X.X 即可

如何给路由器的接口配置IP地址

8、[R1-GigabitEthernet0/0/0]undo ip address //删除IP地址

删除命令undo命令 华为这边删除没有一个明确规定 需要管理员一个一个试一下删除的命令

9、怎么查看配置的IP地址状态什么样子的

[R1]display ip interface brief

*down: administratively down

^down: standby

(l): loopback

(s): spoofing

The number of interface that is UP in Physical is 2

The number of interface that is DOWN in Physical is 2

The number of interface that is UP in Protocol is 2

The number of interface that is DOWN in Protocol is 2

Interface IP Address/Mask Physical Protocol

GigabitEthernet0/0/0 192.168.1.1/24 up up

GigabitEthernet0/0/1 unassigned down down

GigabitEthernet0/0/2 unassigned down down

NULL0 unassigned up up(s)

[R1]

physical 物理 //如果状态UP的话 代表我的接口连线正常

如果状态down 代表我的接口连接不正常

protocol 协议 //如果状态UP的话 代表三层的配置是OK的

如果状态down的话 代表三层的配置不OK的

[SW1]display interface brief

PHY: Physical

*down: administratively down

(l): loopback

(s): spoofing

(b): BFD down

(e): ETHOAM down

(dl): DLDP down

(d): Dampening Suppressed

InUti/OutUti: input utility/output utility

Interface PHY Protocol InUti OutUti inErrors outErrors

GigabitEthernet0/0/1 down down 0% 0% 0 0

GigabitEthernet0/0/2 down down 0% 0% 0 0

GigabitEthernet0/0/3 down down 0% 0% 0 0

GigabitEthernet0/0/4 down down 0% 0% 0 0

GigabitEthernet0/0/5 down down 0% 0% 0 0

GigabitEthernet0/0/6 down down 0% 0% 0 0

GigabitEthernet0/0/7 down down 0% 0% 0 0

GigabitEthernet0/0/8 down down 0% 0% 0 0

GigabitEthernet0/0/9 down down 0% 0% 0 0

GigabitEthernet0/0/10 down down 0% 0% 0 0

GigabitEthernet0/0/11 down down 0% 0% 0 0

GigabitEthernet0/0/12 down down 0% 0% 0 0

GigabitEthernet0/0/13 down down 0% 0% 0 0

GigabitEthernet0/0/14 down down 0% 0% 0 0

GigabitEthernet0/0/15 down down 0% 0% 0 0

GigabitEthernet0/0/16 down down 0% 0% 0 0

GigabitEthernet0/0/17 down down 0% 0% 0 0

GigabitEthernet0/0/18 down down 0% 0% 0 0

GigabitEthernet0/0/19 down down 0% 0% 0 0

GigabitEthernet0/0/20 down down 0% 0% 0 0

GigabitEthernet0/0/21 down down 0% 0% 0 0

GigabitEthernet0/0/22 down down 0% 0% 0 0

GigabitEthernet0/0/23 down down 0% 0% 0 0

GigabitEthernet0/0/24 down down 0% 0% 0 0

MEth0/0/1 down down 0% 0% 0 0

NULL0 up up(s) 0% 0% 0 0

Vlanif1 down down -- -- 0 0

[SW1]

[R1]display ip interface brief //查看三层的接口

[SW1]display interface brief //查看网络设备所有接口

接口:

二层接口:不能够直接配置IP地址接口 华为的中低端交换机默认接口为二层接口 配置不了IP地址

三层接口:就是指能够配置IP地址接口

10、shutdown命令

这条命令的作用就是相当于把接口给弄坏了

11、[AR1-GigabitEthernet0/0/0]display this

这条命令的作用就是查询当前配置

12、[AR1-GigabitEthernet0/0/0]undo shutdown

这条命令的作用就是删除配置命令

删除地址[AR1-GigabitEthernet0/0/0]undo ip address

13、save

注意 这个save命令只能在用户视图下敲 并且敲完后 然后点击Y进行确认保存 一般建议在真机中或者模拟器中敲三遍save命令保存下

14、display current-configuration

查看我们当前设备的所有配置文件

15、display version

查看我们路由器的版本信息

16、ctrl+c

这条命令就是终止咱们命令的运行

17、[Huawei]user-interface vty 0 4

就是开启我们路由器的虚拟远程终端接口 就是让咱们不用去机房里面 直接通过远程技术管理

18、[AR1-ui-vty0-4]authentication-mode password

回车后 然后你输入huawei 在回车

19、[AR1-ui-vty0-4]user privilege level 3

给我们相应远程过来的用户给予一定权限

20、[R2-ui-vty0-4]idle-timeout 2 //设置服务器连接的超时时间为2分钟

21、[R2-ui-vty0-4]set authentication password cipher Huawei 修改密码

22、[R2]display ip routing-table

查看路由表的命令

23、[R1]ip route-static 目标网段 目标网段的掩码 出接口 下一跳 推荐方法

静态路由

24、ping命令的参数

-a 参数 指定源ip地址去访问目标

25、[R1]ip route-static 0.0.0.0 0 出接口 下一跳

默认路由

26、tracert 目标地址

路由追踪

27、通过路由表过滤静态的条目出来

[R2]display ip routing-table protocol static

Route Flags: R - relay, D - download to fib

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

Public routing table : Static

Destinations : 1 Routes : 2 Configured Routes : 2

Static routing table status :

Destinations : 1 Routes : 2

Destination/Mask Proto Pre Cost Flags NextHop Interface

1.1.1.1/32 Static 60 0 D 23.1.1.3 GigabitEthernet0/0/1

Static 60 0 D 24.1.1.4 GigabitEthernet0/0/0

Static routing table status :

Destinations : 0 Routes : 0

[R2]

28、RIP命令

#

rip 1 //进程号

version 2 //选择我们V2版本

network 192.168.1.0 //network 主类网段 A B C

network 1.0.0.0

network 100.0.0.0

#

检查是否学习到RIP路由

[R1]display ip routing-table protocol rip

29、OSPF命令

反掩码也叫做通配符

计算方式:反掩码=255.255.255.255-掩码

比如:192.168.1.1/24

反掩码=255.255.255.255-255.255.255.0=0.0.0.255

OSPF 1 router-id 8.8.8.8

[R1-ospf-10]area ? //创建OSPF 的区域

INTEGER<0-4294967295> OSPF area ID (Integer)

IP_ADDR OSPF area ID (IP address)

[R1-ospf-10]area 1

[R1-ospf-10-area-0.0.0.1]network 192.168.12.1 0.0.0.0

//两种方式

第一种

[R1-ospf-10-area-0.0.0.1]network 192.168.12.0 0.0.0.255

一个宣告网段

第二种

[R1-ospf-10-area-0.0.0.1]network 192.168.12.1 0.0.0.0 现网推荐这种方式宣告

一个精确到IP

邻居表

1.邻居表

R1和R2之间的state为FULL状态

[R1]display ospf peer brief

OSPF Process 10 with Router ID 192.168.12.1

Peer Statistic Information

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

Area Id Interface Neighbor id State

0.0.0.1 GigabitEthernet0/0/0 2.2.2.2 Full

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

注意:Neighbor id 指的就是对端的router id

OSPF Process 10 with Router ID 192.168.12.1 表明我自己的router id是192.168.12.1

reset ospf process //一定要用户视图敲这个命令

Warning: The OSPF process will be reset. Continue? [Y/N]:y

display ospf peer brief

OSPF Process 10 with Router ID 1.1.1.1

Peer Statistic Information

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

Area Id Interface Neighbor id State

0.0.0.1 GigabitEthernet0/0/0 2.2.2.2 Full

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

OSPF Process 10 with Router ID 1.1.1.1 //R1的router id就是1.1.1.1

查看路由表

[R1]display ip routing-table protocol ospf

数据库表

[R1]display ospf lsdb

[RTA- GigabitEthernet0/0/1]ospf cost 20

怎么查看DR和BDR是谁呢?

display ospf interface GigabitEthernet 0/0/0

OSPF Process 1 with Router ID 1.1.1.1 //就是R1的router id

Interfaces

Interface: 192.168.12.1 (GigabitEthernet0/0/0)

Cost: 1 State: BDR Type: Broadcast MTU: 1500 //state就是状态BDR

Priority: 1 //就是R1在G0/0/0接口的优先级

Designated Router: 192.168.12.2 //指定路由器

Backup Designated Router: 192.168.12.1 //非指定路由器

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

怎么修改OSPF接口优先级

[R1-GigabitEthernet0/0/0]ospf dr-priority ?

INTEGER<0-255> Router priority value

[R1-GigabitEthernet0/0/0]ospf dr-priority 1

当DR优先级为0的时候 该设备是不参与选举的 甘愿当DROther设备

[R1-GigabitEthernet0/0/0]ospf dr-priority 0

[R1]display ospf interface GigabitEthernet 0/0/0

OSPF Process 1 with Router ID 1.1.1.1

Interfaces

Interface: 192.168.12.1 (GigabitEthernet0/0/0)

Cost: 1 State: DROther Type: Broadcast MTU: 1500

Priority: 0

Designated Router: 192.168.12.2

Backup Designated Router: 0.0.0.0

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

[R1]

强制为R1的DR

可以把R2 R3接口优先级设置为0