华为配置命令(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 发送到边缘端口,边缘端口会自动变为非边缘端口,并参与网络拓扑计算,引发网络的震荡。
零基础华为认证HCNA配置命令
用户视图<Huawei>?显示VRP版本<Huawei>display version系统视图<Huawei>system-view[Huawei]更改路由器名称[Huawei]sysname R1退出系统视图[Huawei]quitctr+Z查看命令后面的参数<R1>clock ?显示时间<R1>display clock设置时区<R1>clock timezone BJ add 08:00设置时间<R1>clock datetime 11:20:10 2017-12-09配置路由器接口[R1]interface Vlanif 1[R1-Vlanif1]ip address 192.168.80.254 255.255.255.0添加多个地址[R1-Vlanif1]ip address 192.168.8.252 24 sub查看接口配置[R1-Vlanif1]display this删除接口所有地址[R1-Vlanif1]undo ip address删除特定地址[R1-Vlanif1]undo ip address 192.168.8.252 24 sub关闭端口[R1-Vlanif1]shutdown启用接口[R1-Vlanif1]undo shutdown登录路由器的提示语[R1]header login information "This is officel Router"进去路由器的提示语[R1]header shell information "Welcome to Huawei router VRP lab" 配置Console口登录认证方式[R1]user-interface console ?[R1]user-interface console 0[R1-ui-console0]authentication-mode passwordPlease configure the login password (maximum length 6):huawei 重设密码[R1-ui-console0]set authentication password cipher 91xueit设置登录超时的时间[R1-ui-console0]idle-timeout 20[R1-ui-console0]display this设置用户级别为3[R1-ui-console0]user privilege level 3配置路由器允许telnet远程管理[R1]user-interface vty 0 ?[R1]user-interface vty 0 4[R1-ui-vty0-4]authentication-mode passwordPlease configure the login password (maximum length 16):51cto [R1-ui-vty0-4]idle-timeout 10设置telnet用户级别为2[R1-ui-vty0-4]user privilege level 2查看连接过来的用户[R1]display users查看全部用户接口[R1]display user-interface命令分级0 级网络诊断命令 ping tracert telnet 等1 级系统维护命令 display current-configuration2 级配置命令 sysname R13 级设计系统基本运行的命令文件系统 FTP 配置文件切换用户管理命令连接到路由器的用户分级0-15级0级别用户执行0级别命令1级别用户执行0、1级别命令2级别用户执行0、1、2级别命令3-15级别用户执行0、1、2、3级别的命令通过console口用户级别是3级通过telnet接口用户级别是0级恢复telnet默认用户级别[R11-ui-vty0-4]undo user privilege level使用用户名和密码验证用户 AAA身份验证AAA是验证、授权和记账(Authentication、Authorization、Accounting)三个英文单词han 用户级别1admin 用户级别3创建用户的命令[R11]aaa[R11-aaa]local-user admin password cipher privilege level 3 [R11-aaa]local-user admin service-type telnet创建一个用户级别是1的用户[R11-aaa]local-user han password cipher [R11-aaa]local-user han privilege level 1[R11-aaa]local-user han service-type telnet创建一个用户允许console连接[R11-aaa]local-user admin1 password cipher 91xueit@com privilege level 3 [R11-aaa]local-user admin service-type terminal显示创建的用户[R11-aaa]display local-user显示aaa的配置[R11-aaa]display this更改telnet接口身份验证模式为aaa[R11]user-interface vty 0 4[R11-ui-vty0-4]authentication-mode aaa查看连接过来的用户设置文件管理列出当前目录中的文件和文件夹<RA>dir创建文件夹<RA>dir flash:/backup/拷贝文件到backup目录<RA>copy vrpcfg.zip flash:/backup/vrpcfgbackup.zip将vrp1.zip移动到backup目录<RA>move vrp1.zip flash:/backup/vrp1.zip切换到backup目录<RA>cd backup/查看所在的目录<RA>pwdflash:/backup使用move在同一个目录下相当于重命名<RA>move vrp1.zip vrp2.zip重命名的命令<RA>rename vrp2.zip vrp3.zip删除文件,实质上放到回收站<RA>delete vrp2.zip还可以加参数看到删除的文件,带中括号的就是删除的文件<RA>dir /allDirectory of flash:/backup/Idx Attr Size(Byte) Date Time(LMT) FileName0 -rw- 787 Jan 09 2018 23:01:21 vrpcfgbackup.zip1 -rw- 783 Jan 09 2018 23:14:32 [vrp2.zip]恢复删除的文件<RA>undelete vrp2.zip彻底删除且不带提示不能恢复了<RA>delete /unreserved /force vrp2.zip清空回收站<RA>reset recycle-bin把flash中的文件备份到计算机TFTP服务UDP 69端口不可靠传输把flash中的文件上传到TFTP<RA>tftp 192.168.80.1 put flash:/vrpcfg.zip vrpcfg.zip把TFTP服务器上的文件下载到flash的backup目录<RA>tftp 192.168.80.1 get vrpcfg2.zip flash:/backup/vrpcfg2.zip把flash中的文件拷贝到FTPTCP的21端口支持身份验证可靠传输 TCP<RA>ftp 192.168.80.1User(192.168.80.1:(none)):hanlg从FTP下载[RA-ftp]get worklog.txt flash:/backup/worklog2.txt上传到FTP[RA-ftp]put vrpcfg.zip vrpcfg.zip设置系统启动文件设置系统启动文件<RA>startup system-software 指定保存配置的文件<RA>startup saved-configuration vrpcfg1.zip查看下次启动使用的系统文件和配置文件以及当前使用的系统文件和配置文件<RA>display startup重启路由器reboot实验1:静态路由<AR1>display ip routing-table[AR2]ip route-static 192.168.1.0 24 172.16.1.2跟踪数据包路径tracert 192.168.1.2显示全部路由[AR2]display ip routing-table只显示静态路由[AR2]display ip routing-table protocol static添加路由下一跳可以写到达目标网络的沿途中的地址删除路由[AR1]undo ip route-static 192.168.1.0 24[AR1]undo ip route-static 192.168.1.0 24 172.16.1.1[AR1]ip route-static 192.168.1.0 24 172.16.1.2点到点链路静态路由下一跳可以写出口AR1]ip route-static 192.168.1.0 24 Serial 2/0/0路由器上两张表路由表和转发表显示转发表[AR1]display fib添加到某个主机的静态路由[AR1]ip route-static 192.168.1.3 32 Serial 2/0/0网络规划和路由汇总CIDR可以汇总2个4个8个连续的子网全球最大的网段0.0.0.0 0.0.0.00.0.0.0/0默认路由[R1]ip route-static 0.0.0.0 0.0.0.0 10.0.0.2[R1]ip route-static 0.0.0.0 0 10.0.0.2添加静态路由[AR1]ip route-static 172.16.1.0 24 172.16.0.2[AR1]ip route-static 172.16.1.0 255.255.255.0 172.16.0.2 显示全部路由[AR1]display ip routing-table只显示静态路由[AR1]display ip routing-table protocol static删除静态路由[AR1]undo ip route-static 172.16.1.0 24静态路由缺点网络中增加网段删除网段修改网段不会自动更新路由配置RIP协议[AR1]rip ?[AR1]rip 1[AR1-rip-1]network 192.168.0.0[AR1-rip-1]network 10.0.0.0显示RIP协议学到的路由<AR1>display ip routing-table protocol rip显示RIP协议学到的路由<AR4>display rip 1 route显示运行RIP协议的接口<AR4>display rip 1 interface查看RIP协议活动<AR4>terminal monitor<AR4>terminal debugging显示所有接口发送和接收的RIP包<AR4>debugging rip 1 packet只显示G0/0/0接口发送和接收的RIP包<AR4>debugging rip 1 packet GigabitEthernet 0/0/0关闭所有诊断输出<AR4>undo debugging all创建不连续子网实验环境删除配置文件<AR1>delete vrpcfg.zip重启路由<AR1>rebootny[Huawei]sysname AR1[AR1]vlan 2[AR1-vlan2]quit[AR1]port-group vlan2ports[AR1-port-group-vlan2ports]group-member Ethernet 0/0/4 to Ethernet 0/0/7 [AR1-port-group-vlan2ports]port link-type access[AR1-port-group-vlan2ports]port default vlan 2[AR1]interface Vlanif 2[AR1-Vlanif2]ip address 192.168.10.65 26[AR1-GigabitEthernet0/0/0]ip address 172.16.0.1 30[AR1]rip[AR1-rip-1]version 2[AR1-rip-1]network 192.168.10.0[AR1-rip-1]network 172.16.0.0默认时在有类网络的边界自动汇总,但可以关闭汇总。
华为交换机配置命令大全
华为交换机配置命令大全华为交换机是一种高性能、高可靠的数据通信设备,广泛应用于各种网络环境中。
为了更好地使用华为交换机,我们需要了解一些基本的配置命令。
本文将为大家详细介绍华为交换机的配置命令大全,帮助大家更好地了解和使用华为交换机。
1. 登录华为交换机。
首先,我们需要登录华为交换机进行配置。
一般来说,我们可以通过串口、Telnet或SSH方式登录交换机。
以SSH方式登录为例,我们可以使用以下命令:```shell。
ssh -l username 192.168.1.1。
```。
其中,username为登录用户名,192.168.1.1为交换机的IP地址。
登录成功后,我们需要输入密码进行验证。
2. 查看交换机当前配置。
在登录成功后,我们可以使用以下命令查看交换机的当前配置信息:```shell。
display current-configuration。
```。
这条命令可以显示出交换机当前的全部配置信息,包括接口配置、VLAN配置、路由配置等。
3. 配置交换机接口。
接下来,我们可以对交换机的接口进行配置。
比如,我们可以通过以下命令配置一个VLAN接口:```shell。
interface Vlanif1。
ip address 192.168.1.1 255.255.255.0。
```。
这条命令将为VLAN接口Vlanif1配置IP地址为192.168.1.1,子网掩码为255.255.255.0。
4. 配置交换机VLAN。
除了配置接口,我们还可以对交换机的VLAN进行配置。
比如,我们可以使用以下命令创建一个VLAN:```shell。
vlan 10。
```。
这条命令将创建一个VLAN ID为10的VLAN。
5. 配置交换机路由。
在需要进行路由配置时,我们可以使用以下命令添加静态路由:```shell。
ip route-static 0.0.0.0 0.0.0.0 192.168.1.254。
```。
HCNA入门实验手册(入门)
实验一。
命令行基础一、实验目标掌握设备系统参数的配置方法,包括设备名称、系统时间及系统时区掌握Console口空闲超时时长的配置方法掌握登录信息的配置方法掌握登录密码的配置方法掌握保存配置文件的方法掌握配置路由器接口IP地址的方法掌握测试两台直连路由器连通性的方法掌握重吭设备的方法掌握查看版本、当前配置、接口信息实验描述及组网二、实验过程步骤一查看系统信息执行display version命令,查看路由器的软件版本不硬件信息。
[Huawei]display versionHuawei Versatile Routing Platform SoftwareVRP (R) software, Version 5。
130 (AR2200 V200R003C00)Copyright (C) 2011-2012 HUAWEI TECH CO., LTDHuawei AR2220 Router uptime is 0 week,0 day, 0 hour,0 minute BKP 0 version information:1。
PCB Version :AR01BAK2A VER.NC2。
If Supporting PoE :No3。
Board Type : AR22204。
MPU Slot Quantity : 15. LPU Slot Quantity : 6MPU 0(Master): uptime is 0 week, 0 day,0 hour,0 minuteMPU version information :1. PCB Version :AR01SRU2A VER。
A2。
MAB Version : 03。
Board Type :AR22204。
BootROM Version : 0命令回显信息中包含了VRP版本,设备型号和启动时间等信息。
步骤二修改系统时间VRP系统会自动保存时间,但如果时间不正确,可以在用户规图下执行clock timezone命令和clock datetime命令修改系统时间.〈Huawei〉clock timezone Local add 08:00:00<Huawei〉clock datetime 12:00:00 2013-09-15可以修改Local字段为当前地区的时区名称。
华为路由器基本配置命令
华为路由器基本配置命令华为路由器基本配置命令I. 登录华为路由器1. 打开浏览器,输入华为路由器的管理地址:,并按下Enter 键。
2. 在登录页面中,输入用户名和密码,登录按钮。
II. 网络设置1. 在菜单栏中选择“网络设置”选项。
2. 在网络设置页面中,配置路由器的IP地址、子网掩码、网关、DHCP等信息。
III. WLAN设置1. 在菜单栏中选择“WLAN设置”选项。
2. 在WLAN设置页面中,配置无线网络的SSID、加密方式、密码等参数。
IV. DHCP设置1. 在菜单栏中选择“DHCP设置”选项。
2. 在DHCP设置页面中,配置DHCP服务器的起始IP地址、终止IP地址、租期等参数。
V. 防火墙设置1. 在菜单栏中选择“防火墙设置”选项。
2. 在防火墙设置页面中,配置入站规则、出站规则、端口转发等防火墙规则。
VI. 路由设置1. 在菜单栏中选择“路由设置”选项。
2. 在路由设置页面中,配置静态路由、动态路由等路由表信息。
VII. 安全设置1. 在菜单栏中选择“安全设置”选项。
2. 在安全设置页面中,配置访问控制、端口映射、VPN等安全策略。
附件:本文档无附件。
法律名词及注释:1. IP地址:Internet Protocol Address,互联网协议地址的简称,是用于识别和定位计算机设备的数字标识。
2. 子网掩码:Subnet Mask,用于划分IP地址中网络地址和主机地址的一个掩码。
3. 网关:Gateway,是一个网络通信设备,用于连接不同网络之间的数据通信。
4. DHCP:Dynamic Host Configuration Protocol,动态主机配置协议,用于自动分配IP地址和其他网络配置参数。
5. WLAN:Wireless Local Area Network,无线局域网,用于在局域网范围内实现无线数据通信。
6. SSID:Service Set Identifier,服务集标识,是无线网络的名称。
华为路由器常用基本配置命令
华为路由器常用基本配置命令华为路由器常用基本配置命令本文档涉及附件:1、附件1:华为路由器配置示例文件本文所涉及的法律名词及注释:1、知识产权:指对于创作的智力劳动成果所享有的权利,包括版权、专利权、商标权等。
2、数据保护法:指保护个人数据在数字环境中的处理与保护的法律法规,旨在保障个人隐私权和数据安全。
==============================================1、登录路由器使用以下命令登录路由器:```telnet <路由器IP地质>```输入用户名和密码进行身份验证。
2、基本配置2.1 设置主机名使用以下命令设置路由器主机名:```sysname <主机名>```2.2 配置域名解析使用以下命令配置域名解析服务器:```dns server <主域名服务器IP地质> ```3、网络接口配置3.1 配置接口IP地质使用以下命令配置接口IP地质:```interface <接口类型><接口编号> ip address <IP地质> <子网掩码> ```3.2 配置接口描述使用以下命令配置接口描述:```interface <接口类型><接口编号>description <描述信息>```4、静态路由配置4.1 添加静态路由使用以下命令添加静态路由:```ip route-static <目的网络地质> <子网掩码> [首选下一跳地质] [当前节点出接口]```4.2 删除静态路由使用以下命令删除静态路由:```undo ip route-static <目的网络地质> <子网掩码> [首选下一跳地质] [当前节点出接口]```5、NAT配置5.1 配置源地质转换使用以下命令配置源地质转换:```nat outbound <接口类型><接口编号> [inside] source <源地质池> <目标地质池> [static] [mapping-id <映射ID>] [no-pat] [overload]```5.2 删除源地质转换使用以下命令删除源地质转换:```undo nat outbound <接口类型><接口编号> [inside] source <源地质池> <目标地质池> [static] [mapping-id <映射ID>] [no-pat] [overload]```6、安全配置6.1 配置ACL使用以下命令配置ACL:```acl number <ACL编号>rule <ACL规则编号> [0 ---- deny] <协议类型> source <源IP地质> <源子网掩码> [operator <操作符>] [destination <目的IP地质> <目的子网掩码>] [fragment] [dscp <DSCP值>] [precf <IP优先级>] [tos <TOS值>] [flow-label <流标签>] ```6.2 应用ACL使用以下命令应用ACL:```interface <接口类型><接口编号>traffic-filter <ACL编号> [in ---- out]```。
华为交换机基本配置命令
华为交换机基本配置命令华为交换机基本配置命令一、单交换机VLAN划分以下是单交换机VLAN划分的基本命令:system:进入系统视图。
system-view:进入系统视图。
quit:退出系统视图。
undovlan20:删除vlan20.XXX:交换机命名。
dispvlan:显示vlan。
vlan20:创建vlan(也可进入vlan20)。
porte1/0/1toe1/0/5:把端口1-5放入VLAN20中。
对于5700系列交换机,单个端口放入VLAN的命令如下:XXX]intg0/0/1XXX]portlink-type access(注:接口类型access,hybrid、trunk)XXX]portdefaultvlan10而批量端口放入VLAN的命令如下:XXX]port-group1XXX-port-group-1]group-XXXXXX-port-group-1]porthybriduntaggedvlan3如果需要删除group(组)vlan200内的15端口,可以使用以下命令:XXX]intg0/0/15XXX-XXX]XXX通过group端口限速设置的命令如下:XXX]Port-group2XXX]group-memberg0/0/2tog0/0/23XXX]qoslroutboundcir2000cbs要显示vlan里的端口20,可以使用以下命令:dispvlan20如果需要进入端口24,可以使用以下命令:inte1/0/24要删除当前VLAN端口10,可以使用以下命令:XXX如果需要显示当前配置,可以使用以下命令:dispcurr如果需要保存配置,可以使用以下命令:save如果需要通过关闭日志信息命令改变DS模块来实现关闭配置后的确认信息显示,可以使用以下命令:info-XXXoff如果需要通过打开日志信息命令改变DS模块来实现打开配置后的确认信息显示,可以使用以下命令:info-XXX二、配置交换机支持XXX以下是配置交换机支持XXX的基本命令:system:进入系统视图。
华为常用命令及用法
华为常用命令及用法一、基础命令1. 查看和配置IP地址•查看接口信息:display interface brief•进入接口配置模式:interface <interface_name>•配置IP地址:ip address <ip_address> <mask>•结束接口配置:quit•保存配置:save2. 查看和配置VLAN•查看VLAN信息:display vlan brief•进入VLAN配置模式:vlan <vlan_id>•配置VLAN名称:name <name>•添加端口到VLAN:port <interface_name> <vlan_mode> <vlan_id>(vlan_mode为access或trunk)•删除端口从VLAN:undo port <interface_name>3. 查看和配置静态路由•查看路由表:display ip routing-table•进入路由配置模式:ip route-static <destination_network> <mask> <next_hop>•撤销静态路由:undo ip route-static <destination_network> <mask> <next_hop>二、高级命令1. 配置OSPF•进入OSPF进程配置模式:ospf <process_id>•配置区域:area <area_id>•配置区域内路由器:network <network> <mask> [advertise]•配置区域间路由器:area-range <start_address> <end_address>•配置重分布:import-route <protocol> <process_id>•退出OSPF进程配置模式:quit2. 配置ACL•进入ACL配置模式:acl number <acl_number>•配置规则:rule <rule_id> [deny|permit] <source> <destination> [service]•应用ACL:traffic-filter <acl_number> [<in|out>]•退出ACL配置模式:quit3. 配置QoS•进入策略模式:traffic classifier <classifier_name>•配置分类规则:if-match <acl_number>•进入行为模式:traffic behavior <behavior_name>•配置动作:remark <remark_value>•配置队列:queue <queue_id>•应用策略:traffic policy <policy_name>•退出策略模式:quit4. 配置NAT•启用NAT:nat enable•进入NAT地址池配置模式:nat address-group <group_id>•配置地址池:address <start_address> <end_address> [mapping <mapping_address>]•进入ACL配置模式:acl number <acl_number>•配置规则:rule <rule_id> [source <source>] [destination <destination>] [service <service>] [action <action>]•应用NAT:nat policy <acl_number>•退出ACL配置模式:quit三、故障排除命令1. 查看日志•查看系统日志:display logbuffer•根据等级过滤日志:display logbuffer filter-error•清除日志缓冲:clear logbuffer2. 查看接口状态•查看接口状态:display interface <interface_name>•查看接口统计信息:display interface <interface_name> statistics3. 查看路由信息•查看路由表:display ip routing-table•查看OSPF邻居信息:display ospf neighbor•查看BGP邻居信息:display bgp peer4. 远程诊断•进入远程诊断模式:ping•Ping测试:ping <destination_address>•Traceroute测试:tracert <destination_address>•退出远程诊断模式:quit四、安全命令1. 查看用户•查看当前用户:display users•查看用户权限:display aaa2. 配置SSH•进入SSH配置模式:ssh server•启用SSH服务:telnet server enable•配置最大用户数:user-max <max_user>•退出SSH配置模式:quit3. 配置防火墙•开启防火墙:firewall enable•进入防火墙规则配置模式:acl number <acl_number>•配置入站规则:rule <rule_id> [source <source>] [destination <destination>] [service <service>] [action <action>]•配置出站规则:rule <rule_id> [destination <destination>] [source <source>] [service <service>] [action <action>]•应用防火墙策略:firewall policy <acl_number>•退出防火墙规则配置模式:quit以上是华为常用命令及用法的简要介绍,通过掌握这些命令,可以有效地进行网络设备的配置和故障排除工作。
华为HCNA-STP基本配置练习
STP的基本配置SW1配置<Huawei><Huawei>sy<Huawei>system-view (进入全局模式)Enter system view, return user view with Ctrl+Z.[Huawei][Huawei]sy[Huawei]sysname SW1(更改设备名称)[SW1][SW1]stp en[SW1]stp enable (打开STP)[SW1][SW1]stp mo[SW1]stp mode stp 进入stp模式Info: This operation may take a few seconds. Please wait for a moment...done. [SW1][SW1]stp pri[SW1]stp priority 0 (在STP模式下更改BID优先级)BID=Bridge ID(桥ID)[SW1][SW1]dis[SW1]display this (查询当前配置)#sysname SW1#stp mode stpstp instance 0 priority 0#cluster enablentdp enablendp enable#drop illegal-mac alarm#return[SW1][SW1]dis[SW1]display s[SW1]display stp (查询STP)-------[CIST Global Info][Mode STP]-------CIST Bridge :0 .4c1f-cc38-7c04 (桥ID优先级和MAC)Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20 Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20 CIST Root/ERPC :0 .4c1f-cc38-7c04 / 0CIST RegRoot/IRPC :0 .4c1f-cc38-7c04 / 0CIST RootPortId :0.0BPDU-Protection :DisabledTC or TCN received :7TC count per hello :0STP Converge Mode :NormalTime since last TC :0 days 0h:1m:1sNumber of TC :7Last TC occurred :GigabitEthernet0/0/2----[Port1(Ethernet0/0/1)][DOWN]----Port Protocol :EnabledPort Role :Disabled PortPort Priority :128Port Cost(Dot1T ) :Config=auto / Active=200000000Designated Bridge/Port :0.4c1f-cc38-7c04 / 128.1Port Edged :Config=default / Active=disabledPoint-to-point :Config=auto / Active=falseTransit Limit :147 packets/hello-timeProtection Type :NonePort STP Mode :MSTPPort Protocol Type :Config=auto / Active=dot1sBPDU Encapsulation :Config=stp / Active=stpPortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20 TC or TCN send :0TC or TCN received :0BPDU Sent :0TCN: 0, Config: 0, RST: 0, MST: 0BPDU Received :0TCN: 0, Config: 0, RST: 0, MST: 0----[Port2(Ethernet0/0/2)][DOWN]----Port Protocol :EnabledPort Role :Disabled PortPort Priority :128Port Cost(Dot1T ) :Config=auto / Active=200000000Designated Bridge/Port :0.4c1f-cc38-7c04 / 128.2Port Edged :Config=default / Active=disabledPoint-to-point :Config=auto / Active=falseTransit Limit :147 packets/hello-timeProtection Type :NonePort STP Mode :MSTPPort Protocol Type :Config=auto / Active=dot1sBPDU Encapsulation :Config=stp / Active=stpPortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20 TC or TCN send :0TC or TCN received :0BPDU Sent :0TCN: 0, Config: 0, RST: 0, MST: 0BPDU Received :0TCN: 0, Config: 0, RST: 0, MST: 0----[Port3(Ethernet0/0/3)][DOWN]----Port Protocol :EnabledPort Role :Disabled PortPort Priority :128Port Cost(Dot1T ) :Config=auto / Active=200000000Designated Bridge/Port :0.4c1f-cc38-7c04 / 128.3Port Edged :Config=default / Active=disabledPoint-to-point :Config=auto / Active=falseTransit Limit :147 packets/hello-timeProtection Type :NonePort STP Mode :MSTPPort Protocol Type :Config=auto / Active=dot1sBPDU Encapsulation :Config=stp / Active=stpPortTimes :Hello 2s MaxAge 20s FwDly 15s RemHop 20TC or TCN send :0TC or TCN received :0BPDU Sent :0TCN: 0, Config: 0, RST: 0, MST: 0[SW1][SW1]q<SW1><SW1>save (保存配置)The current configuration will be written to the device.Are you sure to continue?[Y/N]yInfo: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:Mar 15 2017 19:47:02-08:00 SW1 %%01CFM/4/SAVE(l)[0]:The user chose Y when decidi ng whether to save the configuration to the device.<SW1>-------------------------------------------------------------------------------------------------------SW2配置<Huawei><Huawei>sy<Huawei>system-viewEnter system view, return user view with Ctrl+Z.[Huawei][Huawei]sy[Huawei]sysname SW2[SW2][SW2]stp en[SW2]stp enable[SW2][SW2]stp mode st[SW2]stp mode stpInfo: This operation may take a few seconds. Please wait for a moment...done. [SW2][SW2]stp pri[SW2]stp priority 4096[SW2][SW2]dis[SW2]display this#sysname SW2#stp mode stpstp instance 0 priority 4096#cluster enablentdp enablendp enable#drop illegal-mac alarm#return[SW2][SW2][SW2]dis[SW2]display st[SW2]display stp-------[CIST Global Info][Mode STP]-------CIST Bridge :4096 .4c1f-cc3a-0520Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20CIST Root/ERPC :0 .4c1f-cc38-7c04 / 20000CIST RegRoot/IRPC :4096 .4c1f-cc3a-0520 / 0CIST RootPortId :128.23BPDU-Protection :DisabledTC or TCN received :42TC count per hello :0STP Converge Mode :NormalTime since last TC :0 days 0h:1m:41sNumber of TC :10Last TC occurred :GigabitEthernet0/0/1----[Port1(Ethernet0/0/1)][DOWN]----Port Protocol :EnabledPort Role :Disabled PortPort Priority :128Port Cost(Dot1T ) :Config=auto / Active=200000000Designated Bridge/Port :4096.4c1f-cc3a-0520 / 128.1Port Edged :Config=default / Active=disabledPoint-to-point :Config=auto / Active=falseTransit Limit :147 packets/hello-timeProtection Type :None----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------SW3配置<Huawei>sy<Huawei>system-viewEnter system view, return user view with Ctrl+Z.[Huawei][Huawei]sy[Huawei]sysname SW3[SW3][SW3]stp en[SW3]stp enable[SW3][SW3]stp mo[SW3]stp mode st[SW3]stp mode stpInfo: This operation may take a few seconds. Please wait for a moment...done. [SW3][SW3]stp pri[SW3]stp priority 8192[SW3][SW3]dis[SW3]display this#sysname SW3#stp mode stpstp instance 0 priority 8192#cluster enablentdp enablendp enable#drop illegal-mac alarm#return[SW3][SW3]q<SW3><SW3><SW3><SW3>saThe current configuration will be written to the device.Are you sure to continue?[Y/N]yInfo: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:Mar 15 2017 20:22:45-08:00 SW3 %%01CFM/4/SAVE(l)[0]:The user chose Y when decidi ng whether to save the configuration to the device.Now saving the current configuration to the slot 0.Save the configuration successfully.<SW3><SW3>。
HCNA培训-【理论1-5】华为基础配置-207
视图标示符
关键字
参数
使用CLI的帮助
命令提示 命令补齐 语法检查
使用CLI的帮助
命令提示
[Huawei] ip rou?
route
<Group> route command group
route-static IPv4 static routes
[Huawei] ip route-static ?
^
Error: Unrecognized command found at ‘^’ position. #箭头所指对方命令不能识别。
[Huawei] a ^
Error: Unrecognized command found at ‘^’ position. #箭头所指的命令不准确,有多个开头的关键字。
基本配置命令
配置设备名称:
<Router>system-view [Router] sysname R1
配置设备时钟:
<Huawei> clock datetime 12:00:00 2017-03-04
基础配置命令
配置设备接口:
<Router>system-view [Router] interface GigabitEthernet0/0/0 [Router-GigabitEthernet0/0/0] ip address 10.1.12.1 255.255.255.0
华为HCNA 2.0课程
数据通信与网络基础 华为R&S基础配置
课程目标
完成本次课程,您应该能够:
掌握网络设备管理的常用方法; 了解命令行界面及基础命令; 掌握基本的路由器、交换机配置。
课程目录
(完整版)华为设备基本配置命令
华为设备基本配置命令计算机命令~~~~~~~~~~PCA login: root ;使用root用户password: linux ;口令是linux# shutdown -h now ;关机# init 0 ;关机# logout ;用户注销# login ;用户登录# ifconfig ;显示IP地址# ifconfig eth0 <ip address> netmask <netmask> ;设置IP地址# ifconfig eht0 <ip address> netmask <netmask> down ;禁用IP地址# route add default gw <ip> ;设置网关# route del default gw <ip> ;删除网关# route ;显示网关# ping <ip> ;发ECHO包# telnet <ip> ;远程登录----------------------------------------交换机命令~~~~~~~~~~[Quidway]dis cur ;显示当前配置[Quidway]display current-configuration ;显示当前配置[Quidway]display interfaces ;显示接口信息[Quidway]display vlan all ;显示路由信息[Quidway]display version ;显示版本信息[Quidway]super password ;修改特权用户密码[Quidway]sysname ;交换机命名[Quidway]interface ethernet 0/1 ;进入接口视图[Quidway]interface vlan x ;进入接口视图[Quidway]rip ;三层交换支持[Quidway]local-user ftp[Quidway]user-interface vty 0 4 ;进入虚拟终端[S3026-ui-vty0-4]authentication-mode password ;设置口令模式[S3026-ui-vty0-4]set authentication-mode password simple 222 ;设置口令[S3026-ui-vty0-4]user privilege level 3 ;用户级别[Quidway]interface ethernet 0/1 ;进入端口模式[Quidway]int e0/1 ;进入端口模式[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]port access vlan 3 ;当前端口加入到VLAN [Quidway-Ethernet0/2]port trunk permit vlan {ID|All} ;设trunk允许的VLAN[Quidway-Ethernet0/3]port trunk pvid vlan 3 ;设置trunk端口的PVID [Quidway-Ethernet0/1]undo shutdown ;激活端口[Quidway-Ethernet0/1]shutdown ;关闭端口[Quidway-Ethernet0/1]quit ;返回[Quidway]vlan 3 ;创建VLAN [Quidway-vlan3]port ethernet 0/1 ;在VLAN中增加端口[Quidway-vlan3]port e0/1 ;简写方式[Quidway-vlan3]port ethernet 0/1 to ethernet 0/4 ;在VLAN中增加端口[Quidway-vlan3]port e0/1 to e0/4 ;简写方式[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 ;指定镜像和被镜像[Quidway]description string ;指定VLAN描述字符[Quidway]description ;删除VLAN描述字符[Quidway]display vlan [vlan_id] ;查看VLAN设置[Quidway]stp {enable|disable} ;设置生成树,默认关闭[Quidway]stp priority 4096 ;设置交换机的优先级[Quidway]stp root {primary|secondary} ;设置为根或根的备份[Quidway-Ethernet0/1]stp cost 200 ;设置交换机端口的花费[Quidway]link-aggregation e0/1 to e0/4 ingress|both ;端口的聚合[Quidway]undo link-aggregation e0/1|all ; 始端口为通道号[SwitchA-vlanx]isolate-user-vlan enable ;设置主vlan [SwitchA]isolate-user-vlan <x> secondary <list> ;设置主vlan包括的子vlan [Quidway-Ethernet0/2]port hybrid pvid vlan <id> ;设置vlan的pvid [Quidway-Ethernet0/2]port hybrid pvid ;删除vlan的pvid [Quidway-Ethernet0/2]port hybrid vlan vlan_id_list untagged ;设置无标识的vlan如果包的vlan id与PVId一致,则去掉vlan信息. 默认PVID=1。
