2022年2022年华为配置命令 2

上传人:枫** 文档编号:567352281 上传时间:2024-07-20 格式:PDF 页数:13 大小:87.16KB
返回 下载 相关 举报
2022年2022年华为配置命令 2_第1页
第1页 / 共13页
2022年2022年华为配置命令 2_第2页
第2页 / 共13页
2022年2022年华为配置命令 2_第3页
第3页 / 共13页
2022年2022年华为配置命令 2_第4页
第4页 / 共13页
2022年2022年华为配置命令 2_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《2022年2022年华为配置命令 2》由会员分享,可在线阅读,更多相关《2022年2022年华为配置命令 2(13页珍藏版)》请在金锄头文库上搜索。

1、HCNA 入门部分一、命令行基础用户视图;Huawei 系统视图逐级退出: quit ;完全退出: Ctrl+Z ;打断:Ctrl+C 1、修改设备名称:Huaweisysname R1 2、配置系统时钟:设置所在时区: clock timezone beijing add 08:00:00 设置当前时间: clock datetime 16:35:25 2018-03-29 设置采用夏时制 :clock daylight-saving-time 3、配置标题消息:配 置 在 用 户 登 陆 前 显示 的标 题消 息: R1header login information welcome to

2、 R1 配置在用户登陆后显示的标题消息:R1header shell information no reboot R1 4、配置特定等级用户在特定视图具有特定命令:R1command-privilege level 15 view user save 5、为 VRP 系统创建账户(创建账户缺省是level15 ,服务类型包括 terminal ) :R1aaa R1-aaalocal-user admin privilege level 15 password cipher huawei R1-aaalocal-user admin service-type terminal (用于指定账户的

3、服务类型,默认是 ALL)6、在 console 口配置使用超级终端登录时的验证方式(缺省时不验证):R1user-interface console 0 R1-ui-console0authentication-mode aaa 7、用户界面: VTY 虚拟类型终端:R1user-interface vty 0 4 R1-ui-vty0-4authentication-mode password(或者 aaa)8、配置登录的超时时间(缺省是10 分钟) :R1user-interface console 0 R1-ui-console0idle-timeout 5 0 9、指定终端屏幕临时显

4、示的行数(缺省是24 行) :R1user-interface console 0 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 13 页 - - - - - - - - - R1-ui-console0screen-length 10 10、历史命令缓冲区大小(缺省是10 行) :R1user-interface console0 R1-ui-console0history-command max-size 20 11、配置只使用口令登录之后获取的权限:R1user-

5、interface console 0 R1-ui-console0user privilege level 15 12、配置 IP 地址:R1int g0/0/1 R1-GigabitEthernet0/0/1ip add 192.168.1.1 24 二、文件系统基础1、基本查询命令(1)查看当前目录: pwd (2)查看当前目录下的文件列表:dir (3)查看文办文件: more .txt 2、目录操作(1)创建目录: mkdir aaa (2)进入目录: cd aaa (3)删除目录: mkdir aaa 3、文件操作(1)文件拷贝:copy flash:/dhcp/dhcp-duid

6、.txt flash:/bbb/ Copy flash:/dhcp/dhcp-duid.txt to flash:/bbb/dhcp-duid.txt? (y/n)n:y (2)文件重命名:rename flash:/bbb/dhcp-duid.txt flash:/bbb/123.txt Rename flash:/bbb/dhcp-duid.txt to flash:/bbb/123.txt? (y/n)n:y (3)文件移动:move flash:/bbb/123.txt flash:/aaa/ Move flash:/bbb/123.txt to flash:/aaa/123.txt?

7、 (y/n)n:y (4)删除文件:delete flash:/aaa/123.txt 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 13 页 - - - - - - - - - Delete flash:/aaa/123.txt? (y/n)n:y (5)恢复被删除文件:undelete flash:/aaa/123.txt Undelete flash:/aaa/123.txt? (y/n)n:y (6)永久删除文件:delete /unreserved flash

8、:/aaa/123.txt Warning: The contents of file flash:/aaa/123.txt cannot be recycled. Continue? ( y/n)n:y 4、管理配置文件(1)查看当前配置文件( RAM ) :R1display current-configuration (2)查看保存的配置文件(flash/SD 卡) :R1display saved-configuration (3)保存配置: save (4)删除保存的配置文件,恢复出厂设置:delete flash:/vrpcfg.zip或reset saved-configurat

9、ion (5)系统启动文件的查询:display startup ( 6 ) 修 改 系 统 启 动 后 加 载 的 配 置 文 件 : startup saved-configuration flash:/123.zip (7)修改系统启动系统文件:startup system-software 路径 (8)比较配置文件: compare configuration 5、修复存储设备: fixdisk flash: 6、格式化存储设备: format flash: 三、VRP 系统管理1、升级路由器的VRP 系统:(1)在 FTP SERVER下准备更新的 VRP 系统文件(2)实现路由器与

10、FTP SERVER的网络连接性(3)在路由器的用户视图下连接到FTP SERVER:ftp 192.168.1.2 R1-ftpget 文件名 (get 下载, put 上传)startup system-software flash:文件名 2、备份路由器的VRP 系统:(1)在 FTP SERVER下准备更新的 VRP 系统文件名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 13 页 - - - - - - - - - (2)实现交换机与FTP SERVER的网络连

11、接性interface vlanif 1 IP add 192.168.123.200.24 (3)在交换机的用户视图下连接到FTP SERVER:ftp 192.168.1.2 ftpput 文件名四、修改丢失的口令(1)必须使用 console 口连接设备,(2) 打开电源之后使用 Ctrl+B 进入 BOOTROM 菜单中 (默认口令是 huawei) ;(3) 在进入 BOOTROM MENU中, 选择 5 (5. Enter filesystem submenu) ;(4)然后再选择 4 (4.Rename file from Flash);(5)选择 vrecfg.zip文件进行重

12、命名 (vrpcfg1.zip);(6)最后选择 6(6.Return to main menu) 回到 BOOTROM 菜单,再选择 7 (7.Reboot) 重启设备;(7)设备重启之后将不能加载配置文件(即此时不需要验证口令就可登录)此时可以在用户视图下再将之间重命名的配置文件再修改成vrpcfg.zip rename vrpcfg1.zip vrpcfg.zip Rename flash:/vrpcfg1.zip to flash:/vrpcfg.zip ?Y/N:y_ (8)在用户视图下使用display saved-configuration命令查看保存的配置文件, 然后再将保存的

13、配置文件拷贝到系统视图下执行,以加载到当前配置文件中;(9)修改验证的口令,并保存配置SW1aaa sW1-aaalocal-user test password cipher 123456 sw1user-interface console 0 sW1-ui-consoleauthentication-mod ? aaa AAA authentication none Login without checking password Authentication through the password of a user terminal 五、交换网络基础(1)查看交换机 MAC 地址表:

14、S1display mac-address 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 13 页 - - - - - - - - - (2)配置接口的速率和双工(缺省是自动协商:就低不就高):S1interface Ethernet0/0/1 S1-Ethernet0/0/1negotiation auto (3)手工修改速率和双工需要关闭自动协商:S1interface Ethernet0/0/1 S1-Ethernet0/0/1undo negotiation a

15、uto S1-Ethernet0/0/1speed 100 S1-Ethernet0/0/1duplex (4)查看交换机接口状态:S1-Ethernet0/0/1display interface e0/0/1 六、配置 STP 1)配置交换机的STP模式为 STP S1-4stp mode stp 2)通过修改优先级,调整跟交换机的位置(缺省是32768 ,推荐使用汇聚层交换机为跟交换机)S3stp priority ? INTEGER Bridge priority, in steps of 4096 S3stp priority 0 S4stp priority 4096 3)通过配置

16、端口开销选择RP(1Gbps 端口在 STP 中默认的开销是20000 )S4interface g0/0/4 S4-GigabitEthernet0/0/4stp cost 10000 4)修改端口开销计算方式S4stp pathcost-standard ? dot1d-1998 IEEE 802.1D-1998 dot1t IEEE 802.1T legacy Legacy 5)通过配置端口优先级选择RP(缺省是 128 )S3int g0/0/3 S3-GigabitEthernet0/0/3stp port priority 112 S4int g0/0/3 S4-GigabitEt

17、hernet0/0/3stp cost 10000 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 13 页 - - - - - - - - - 6)检查 stp 运行:S1display stp S1display stp brief display stp interface g0/0/4 七、配置 RSTP 1)配置 STP 模式为 RSTP S1stp mode rstp 2)配置边缘端口S1int e0/0/1 S1-Ethernet0/0/1stp edged

18、-port enable 3)配置根桥S3stp priority 0 S4stp priority 4096 4)配置端口开销和优先级S4-GigabitEthernet0/0/4stp cost S3-GigabitEthernet0/0/3stp port priority 5)配置根保护(在根桥连接接入层交换机的DP 上配置)S3int g0/0/1 S3-GigabitEthernet0/0/1stp root-protection (S3:g0/0/1 、g0/0/2 、S4:g0/0/1 、g0/0/2 )被配置为根保护的DP 端口接收到更优BPDU 时,端口要被置为Discar

19、ding(丢弃)状态6)配置 BPDU 保护边缘端口一般用于连接PC, 不能接收到 BPDU , 但如果攻击者恶意伪造BPDU发送到边缘端口,边缘端口会自动变为非边缘端口,并参与网络拓扑计算,引发网络的震荡。配置 BPDU 保护可以让边缘端口在接收到BPDU 时,端口直接被关闭,并通知到网管系统,端口需要背手工开启之后才能正常工作。S1/2stp bpdu-protection 7)配置环路保护当 AP 端口所在链路发生故障, 成为单向链路时可能产生环路, 配置环路保护,可以解决该问题名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - -

20、- 名师精心整理 - - - - - - - 第 6 页,共 13 页 - - - - - - - - - S1int g0/0/2 S1-GigabitEthernet0/0/2stp loop-protection 配置分公司访问到总部的服务器群R3int g0/0/0 R3-GigabitEthernet0/0/0ip add 192.168.3.1 24 R3int g0/0/2 R3-GigabitEthernet0/0/2ip add 192.168.13.3 24 R3int Pos5/0/0 R3-Pos5/0/0ip add 192.168.31.3 24 R1int g0/

21、0/2 R1-GigabitEthernet0/0/2ip add 192.168.13.1 24 R1int Pos5/0/0 R1-Pos5/0/0ip add 192.168.31.1 24 在 R3 上配置到达服务器群的静态路由1)配置静态路由的负载均衡R3ip route-static 192.168.5.0 24 192.168.13.1 R3ip route-static 192.168.5.0 24 192.168.31.1 2)配置静态浮动路由(备份)R1ip route-static 192.168.3.0 24 192.168.13.3 R1ip route-static

22、 192.168.3.0 24 192.168.31.3 preference 100 八、配置 RIPv1 在华为路由器中启用RIP 时,缺省使用的进程ID 是 1,缺省的版本是 RIPv1 Compatible(即发送 RIPv1 更新,可接收 RIPv1 和 RIPv2)1、RIP 的基本配置1)RIPv1 的基本配置R1rip R1-rip-1version 1 R1-rip-1network 192.168.5.0 R1-rip-1network 192.168.1.0 R1-rip-1network 192.168.13.0 R1-rip-1network 192.168.31.0

23、 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 13 页 - - - - - - - - - R3rip R3-rip-1version 1 R3-rip-1network 192.168.3.0 R3-rip-1network 192.168.13.0 R3-rip-1network 192.168.31.0 2)配置 RIPv2 R3rip R3-rip-1version 2 R1rip R1-rip-1version 2 2、RIP 的其他配置1)配置 RIP 的

24、水平分割(缺省已启用)R3int g0/0/2 R3-GigabitEthernet0/0/2rip split-horizon display rip 1 interface g0/0/2 v 2)配置 RIP 的毒性反转(缺省未开启)水平分割和毒性反转同时启用时,毒性反转生效R3-GigabitEthernet0/0/2rip poison-reverse 3)配置接口接收或发送路由时的偏移R3int Pos 5/0/0 R3-Pos5/0/0rip metricout 3 R3-Pos5/0/0rip metricin 3 4)配置 RIP 在接口是否发送或接收RIP 报文R3int g

25、0/0/0 R3-GigabitEthernet0/0/0undo rip output R3-GigabitEthernet0/0/0undo rip input R1int g0/0/1 R1-GigabitEthernet0/0/1undo rip output R1-GigabitEthernet0/0/1undo rip input 5)配置接口的静默R1rip R1-rip-1silent-interface g0/0/0 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第

26、8 页,共 13 页 - - - - - - - - - 检查参与 RIP 进程的接口:R1display rip 1 interface 检查 RIP 学习到的路由:display ip routing-table protocol rip 查看 RIP 的数据库display rip 1 database 查看 RIP 进程dis rip 1 九、OSPF 1、OSPF 的基本配置:R1undo rip 1 R1ospf 1 router-id 1.1.1.1 R1-ospf-1area 0 R1-ospf-1-area-0.0.0.0network 192.168.5.0 0.0.0.2

27、55 R1-ospf-1-area-0.0.0.0network 192.168.0.0 0.0.255.255 R3undo rip 1 R3ospf 1 rou R3ospf 1 router-id 3.3.3.3 R3-ospf-1area 0 R3-ospf-1-area-0.0.0.0network 192.168.3.1 0.0.0.0 R3-ospf-1-area-0.0.0.0network 192.168.13.3 0.0.0.0 R3-ospf-1-area-0.0.0.0network 192.168.31.3 0.0.0.0 2、OSPF 的其他配置:(1)配置接口的成

28、本R3int pos5/0/0 R3-Pos5/0/0ospf cost 10 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 9 页,共 13 页 - - - - - - - - - (2)配置接口的优先级(默认是1) :R3-GigabitEthernet0/0/2ospf dr-priority 10 R1-GigabitEthernet0/0/2ospf dr-priority 0 (3)配置 OSPF 认证:R1int Pos 5/0/0 R1-Pos5/0/0ospf a

29、uthentication-mode md5 1 cipher 123456 R3int Pos 5/0/0 R3-Pos5/0/0ospf authentication-mode md5 1 cipher 123456 3、检查 OSPF:(1)查看参与 OSPF 进程的接口:R3dis ospf interface (2)查看 OSPF 邻居:R3dis ospf peer (3)查看 OSPF 建立的 IP 路由表:R3dis ip routing-table protocol ospf 十、DHCP DHCP 接口地址池配置R3int g0/0/0 R3-GigabitEthernet

30、0/0/0ip add 10.0.3.1 24 R3ospf 1 R3-ospf-1area 0 R3-ospf-1-area-0.0.0.0undo network 192.168.3.1 0.0.0.0 R3-ospf-1-area-0.0.0.0network 10.0.3.0 0.0.0.255或R3-GigabitEthernet0/0/0ospf enable 1 area 0必须先创建区域 0 R3dhcp enable R3int g0/0/0 R3-GigabitEthernet0/0/0dhcp select interface R3-GigabitEthernet0/0/

31、0dhcp server dns-list 192.168.5.1 R3-GigabitEthernet0/0/0dhcp server excluded-ip-address 10.0.3.7 10.0.3.254 R3-GigabitEthernet0/0/0dhcp server lease day 1 查看 DHCP SERVER 数据库:名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 10 页,共 13 页 - - - - - - - - - dis dhcp server

32、 database 查看 IP 地址池 : dis ip pool DHCP 全局地址池配置R3int g0/0/0 R3-GigabitEthernet0/0/0undo dhcp select interface R3-GigabitEthernet0/0/0q R3ip pool R3 R3-ip-pool-R3network 10.0.3.0 mask 255.255.255.0 R3-ip-pool-R3gateway-list 10.0.3.1 R3-ip-pool-R3dns-list 192.168.5.1 R3-ip-pool-R3excluded-ip-address 10

33、.0.3.7 10.0.3.254 R3-ip-pool-R3lease day 2 R3-ip-pool-R3q R3int g0/0/0 R3-GigabitEthernet0/0/0dhcp select global DHCP 中继( Relay)配置DHCP SERVERint g0/0/0 DHCP SERVER-GigabitEthernet0/0/0ip add 192.168.5.4 24 DHCP SERVERdhcp enable DHCP SERVERip route-static 0.0.0.0 0 192.168.5.251 DHCP SERVERip pool L

34、AN1 DHCP SERVER-ip-pool-LAN1network 10.0.1.0 mask 255.255.255.128DHCP SERVER-ip-pool-LAN1gateway-list 10.0.1.101 DHCP SERVER-ip-pool-LAN1dns-list 192.168.5.1 DHCP SERVER-ip-pool-LAN1excluded-ip-address 10.0.1.6 10.0.1.100 DHCP SERVER-ip-pool-LAN1excluded-ip-address 10.0.1.102 10.0.1.106 DHCP SERVER-

35、ip-pool-LAN1lease day 2 DHCP SERVER-GigabitEthernet0/0/0dhcp select global R1dhcp en 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 11 页,共 13 页 - - - - - - - - - R1dhcp enable R1int g0/0/1 R1-GigabitEthernet0/0/1ip add 10.0.1.101 25 R1-GigabitEthernet0/0/1dhcp select

36、 relay R1-GigabitEthernet0/0/1dhcp relay server-ip 192.168.5.4 R1-GigabitEthernet0/0/1ospf enable 1 area 0 十一、 Telnet 1)使用 password验证:R1user-interface vty 0 4 R1-ui-vty0-4authentication-mode password Please configure the login password (maximum length 16):123456 R1-ui-vty0-4set authentication passwo

37、rd cipher 123456 R1-ui-vty0-4user privilege level 缺省是 0 (2)使用 aaa 验证R1user-interface vty 0 4 R1-ui-vty0-4authentication-mode aaa R1aaa R1-aaalocal-user huawei password cipher 123456 R1-aaalocal-user huawei service-type telnet R1-aaalocal-user huawei privilege level 15 (3)配置 Router/Switch作为 SSH SERVE

38、R R1stelnet server enable R1user-interface vty 0 4 R1-ui-vty0-4authentication-mode aaa R1-ui-vty0-4protocol inbound ssh R1aaa R1-aaalocal-user ssh1 password cipher 123456 R1-aaalocal-user ssh1 service-type ssh R1-aaalocal-user ssh1 privilege level 15 (4)SSH SERVER的其他配置配置论证连接的重试次数,超过次数则断开连接(缺省是3)名师资料

39、总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 12 页,共 13 页 - - - - - - - - - R1ssh server authentication-retries 配置 SSH SERVER不兼容 SSH v1.x 版本(默认兼容)R1undo ssh server compatible-ssh1x enable 修改 SSH 端口号(缺省是22)R1ssh server port 配置 SSH 密钥更换时间:R1ssh server rekey-interval 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 13 页,共 13 页 - - - - - - - - -

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号