当前位置:文档之家› 华为配置命令(HCNA入门部分)

华为配置命令(HCNA入门部分)

HCNA入门部分一、命令行基础<Huawei>用户视图;[Huawei]系统视图逐级退出:quit;完全退出:Ctrl+Z;打断:Ctrl+C1、修改设备名称:[Huawei]sysname R12、配置系统时钟:设置所在时区:<R1>clock timezone beijing add 08:00:00设置当前时间:<R1>clock datetime 16:35:25 2018-03-29设置采用夏时制:clock daylight-saving-time3、配置标题消息:配置在用户登陆前显示的标题消息:[R1]header login information "welcome to R1"配置在用户登陆后显示的标题消息:[R1]header shell information "no reboot R1"4、配置特定等级用户在特定视图具有特定命令:[R1]command-privilege level 15 view user save5、为VRP系统创建账户(创建账户缺省是level15,服务类型包括terminal):[R1]aaa[R1-aaa]local-user admin privilege level 15 password cipher huawei [R1-aaa]local-user admin service-type terminal(用于指定账户的服务类型,默认是ALL)6、在console口配置使用超级终端登录时的验证方式(缺省时不验证):[R1]user-interface console 0[R1-ui-console0]authentication-mode aaa7、用户界面:VTY虚拟类型终端:[R1]user-interface vty 0 4[R1-ui-vty0-4]authentication-mode password(或者aaa)8、配置登录的超时时间(缺省是10分钟):[R1]user-interface console 0[R1]-ui-console0]idle-timeout 5 09、指定终端屏幕临时显示的行数(缺省是24行):[R1]user-interface console 0[R1]-ui-console0]screen-length 1010、历史命令缓冲区大小(缺省是10行):[R1]user-interface console0[R1]-ui-console0]history-command max-size 2011、配置只使用口令登录之后获取的权限:[R1]user-interface console 0[R1]-ui-console0]user privilege level 1512、配置IP地址:[R1]int g0/0/1[R1]-GigabitEthernet0/0/1]ip add 192.168.1.1 24二、文件系统基础1、基本查询命令(1)查看当前目录:<R1>pwd(2)查看当前目录下的文件列表:<R1>dir(3)查看文办文件:more .txt2、目录操作(1)创建目录:<R1>mkdir aaa(2)进入目录:<R1>cd aaa(3)删除目录:<R1>mkdir aaa3、文件操作(1)文件拷贝:<R1>copy flash:/dhcp/dhcp-duid.txt flash:/bbb/Copy flash:/dhcp/dhcp-duid.txt to flash:/bbb/dhcp-duid.txt? (y/n)[n]:y(2)文件重命名:<R1>rename flash:/bbb/dhcp-duid.txt flash:/bbb/123.txtRename flash:/bbb/dhcp-duid.txt to flash:/bbb/123.txt? (y/n)[n]:y (3)文件移动:<R1>move flash:/bbb/123.txt flash:/aaa/Move flash:/bbb/123.txt to flash:/aaa/123.txt? (y/n)[n]:y(4)删除文件:<R1>delete flash:/aaa/123.txtDelete flash:/aaa/123.txt? (y/n)[n]:y(5)恢复被删除文件:<R1>undelete flash:/aaa/123.txtUndelete flash:/aaa/123.txt? (y/n)[n]:y(6)永久删除文件:<R1>delete /unreserved flash:/aaa/123.txtWarning: The contents of file flash:/aaa/123.txt cannot be recycled. Continue? (y/n)[n]:y4、管理配置文件(1)查看当前配置文件(RAM):[R1]display current-configuration (2)查看保存的配置文件(flash/SD卡):[R1]display saved-configuration (3)保存配置:<R1>save(4)删除保存的配置文件,恢复出厂设置:<R1>delete flash:/vrpcfg.zip或<R1>reset saved-configuration (5)系统启动文件的查询:<R1>display startup(6)修改系统启动后加载的配置文件:<Huawei>startup saved-configuration flash:/123.zip(7)修改系统启动系统文件:<R1>startup system-software [路径](8)比较配置文件:<R2>compare configuration5、修复存储设备:<R1>fixdisk flash:6、格式化存储设备:<R1>format flash:三、VRP系统管理1、升级路由器的VRP系统:(1)在FTP SERVER下准备更新的VRP系统文件(2)实现路由器与FTP SERVER的网络连接性(3)在路由器的用户视图下连接到FTP SERVER:<R1>ftp 192.168.1.2[R1-ftp]get [文件名] (get下载,put上传)<R1>startup system-software flash:[文件名]2、备份路由器的VRP系统:(1)在FTP SERVER下准备更新的VRP系统文件(2)实现交换机与FTP SERVER的网络连接性<Quidway>interface vlanif 1<Quidway-vlanif1>IP add 192.168.123.200.24(3)在交换机的用户视图下连接到FTP SERVER:<Quidway>ftp 192.168.1.2[ftp]put 文件名四、修改丢失的口令(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文件进行重命名(vrpcfg1.zip);(6)最后选择6(6.Return to main menu) 回到BOOTROM菜单,再选择7 (7.Reboot) 重启设备;(7)设备重启之后将不能加载配置文件(即此时不需要验证口令就可登录)此时可以在用户视图下再将之间重命名的配置文件再修改成vrpcfg.zip <Quidway>rename vrpcfg1.zip vrpcfg.zipRename flash:/vrpcfg1.zip to flash:/vrpcfg.zip ?[Y/N]:y_(8)在用户视图下使用display saved-configuration命令查看保存的配置文件,然后再将保存的配置文件拷贝到系统视图下执行,以加载到当前配置文件中;(9)修改验证的口令,并保存配置[SW1]aaa[sW1-aaa]local-user test password cipher 123456[sw1]user-interface console 0[sW1-ui-console]authentication-mod ?aaa AAA authenticationnone Login without checkingpassword Authentication through the password of a user terminal五、交换网络基础(1)查看交换机MAC地址表:[S1]display mac-address(2)配置接口的速率和双工(缺省是自动协商:就低不就高):[S1]interface Ethernet0/0/1[S1-Ethernet0/0/1]negotiation auto(3)手工修改速率和双工需要关闭自动协商:[S1]interface Ethernet0/0/1[S1-Ethernet0/0/1]undo negotiation auto[S1-Ethernet0/0/1]speed 100[S1-Ethernet0/0/1]duplex(4)查看交换机接口状态:[S1-Ethernet0/0/1]display interface e0/0/1六、配置STP1)配置交换机的STP模式为STP[S1-4]stp mode stp2)通过修改优先级,调整跟交换机的位置(缺省是32768,推荐使用汇聚层交换机为跟交换机)[S3]stp priority ?INTEGER<0-61440> Bridge priority, in steps of 4096[S3]stp priority 0[S4]stp priority 40963)通过配置端口开销选择RP(1Gbps端口在STP中默认的开销是20000)[S4]interface g0/0/4[S4-GigabitEthernet0/0/4]stp cost 100004)修改端口开销计算方式[S4]stp pathcost-standard ?dot1d-1998 IEEE 802.1D-1998dot1t IEEE 802.1Tlegacy Legacy5)通过配置端口优先级选择RP(缺省是128)[S3]int g0/0/3[S3-GigabitEthernet0/0/3]stp port priority 112[S4]int g0/0/3[S4-GigabitEthernet0/0/3]stp cost 100006)检查stp运行:[S1]display stp[S1]display stp brief<S4>display stp interface g0/0/4七、配置RSTP1)配置STP模式为RSTP[S1]stp mode rstp2)配置边缘端口[S1]int e0/0/1[S1-Ethernet0/0/1]stp edged-port enable3)配置根桥[S3]stp priority 0[S4]stp priority 40964)配置端口开销和优先级[S4-GigabitEthernet0/0/4]stp cost <1-200000000>[S3-GigabitEthernet0/0/3]stp port priority <0-240>5)配置根保护(在根桥连接接入层交换机的DP上配置)[S3]int g0/0/1[S3-GigabitEthernet0/0/1]stp root-protection(S3:g0/0/1、g0/0/2、S4:g0/0/1、g0/0/2)被配置为根保护的DP端口接收到更优BPDU时,端口要被置为Discarding (丢弃)状态6)配置BPDU保护边缘端口一般用于连接PC,不能接收到BPDU,但如果攻击者恶意伪造BPDU 发送到边缘端口,边缘端口会自动变为非边缘端口,并参与网络拓扑计算,引发网络的震荡。

相关主题