华为交换机的基本配置——by蔡成勇华为、思科几种常见的模式(视图)登入到交换机远程登入telnet超级终端console用户视图系统视图VLAN视图用户界面视图接口视图登入到交换机远程登入telnet超级终端console普通用户模式特权用户模式VLAN模式进程配置模式接口配置模式全局配置模式图1、思科几种常见模式图2、华为几种常见视图华为交换机的几种常见视图视图功能提示符进入命令退出命令用户视图查看交换机的简单运行状态和统计信息Quidway与交换机建立连接即进入quit断开与交换机连接系统视图配置系统参数[Quidway]在用户视图下键入system-viewquit或return返回用户视图以太网端口视图配置以太网端口参数[Quidway-Ethernet0/1]在系统视图下键入:interfaceethernet0/1quit返回系统视图VLAN视图配置VLAN参数[Quidway-Vlan1]在系统视图下键入vlan1quit返回系统视图VLAN接口视图配置VLAN和VLAN汇聚对应的IP接口参数[Quidway-Vlanif1]在系统视图下键入:interfaceVlanif1quit返回系统视图用户界面视图配置登录用户参数[Quidway-ui-vty0-4]在系统视图下键入:user-interfacevty04quit返回系统视图进入视图配置命令•1、从普通视图到系统视图:•Quidwaysys•[Quidway]quit•2、系统视图到接口视图:•[Quidway]interfaceGigabitEthernet0/0/1•[Quidway-GigabitEthernet0/0/1]quit•[Quidway]•3、系统视图到VLAN视图:•[Quidway]vlan2•[Quidway-Vlan2]quit4、系统视图到VLAN接口视图:[Quidway]interfaceVlanif2[Quidway-Vlanif2]quit5、系统视图到用户界面视图:[Quidway]user-interfacevty04[Quidway-ui-vty0-4]quit交换机配置的基本步骤用console口登入交换机配置VTY,以便用互联网远程登入管理交换机建立VLAN配置端口模式把端口添加到VLAN配置VLAN的IP地址配置静态路由保存并备份配置TELNET连接认证设置配置过程注释[Quidway]user-interfacevty04[Quidway-ui-vty0]authentication-modepassword/aaa/none[Quidway-ui-vty0]setauthenticationpasswordsimple/cipherhuawei[Quidway]superpasswordlevel3simple/cipherhuawei#设置认证方式#设置认证的密码口令为huawei#设置切换低级别用户到高级别用户的密码配置的保存[Quidway]sysnamehuawei#指定设备名称[Quidway]quit#退出当前模式Quidwaysave#保存配置Thiswillsavetheconfigurationintheflashmemory.Theswitchconfigurationswillbewrittentoflash.Areyousure?[Y/N]yNowsavingcurrentconfigurationtoflashmemory.Pleasewaitforawhile...Currentconfigurationsavedtoflashmemorysuccessfully.Quidway用TFTP服务器配置交换机Quidwaytftp192.168.0.2putvrpcfg.zipvrpcfg.zip#配置下载到TFTP服务器Quidwaytftp192.168.0.2getvrpcfg.zipvrpcfg.zip#配置上传到S5303Quidwaystartupsaved-configurationvrpcfg.zip#下次启动时加载的配置文件登陆界面及等级切换PleasepressENTER.Quidway%Apr205:38:462000QuidwaySHELL/5/LOGIN:ConsoleloginfromAux0/0Quidwaysuper#级别切换Nowuserprivilegeis3level,andjustcommandswhichlevelisequaltoorlessthanthislevelcanbeused.Privilegenote:0-VISIT,1-MONITOR,2-SYSTEM,3-MANAGEQuidwaysystemview#进入系统视图Entersystemview,returntouserviewwithCtrl+Z.[Quidway]displaycurrent-configuration#显示当前配置端口物理属性配置1、设置以太网端口的全双工/半双工属性例:将以太网端口GigabitEtherne0/0/1端口设置为自协商状态/半双工/全双工[Quidway-GigabitEtherne0/0/1]duplexauto/half/full2、设置端口的速率例:将以太网端口GigabitEthernet0/0/1的端口速率设置为100Mbit/s[Quidway-GigabitEthernet0/0/1]speed10/100/10003、设置端口的描述字符串例:设置以太网端口GigabitEthernet0/0/1的描述字符串为lanswitch-interface[Quidway-GigabitEthernet0/0/1]descriptionlanswitch-interfaceVLAN的划分及配置配置过程注释[Quidway]vlan2[Quidway-vlan2]quit[Quidway]interfaceGigabitEthernet0/0/1[Quidway-GigabitEthernet0/0/1]portlink-typeaccess[Quidway-GigabitEthernet0/0/1]undoshutdown⒈[Quidway-GigabitEthernet0/0/1]portdefaultvlan2⒉[Quidway-vlan2]portGigabitEthernet0/0/1[Quidway]interfaceVlanif2[Quidway-Vlanif2]ipaddress192.168.2.254255.255.255.0#创建VLAN2#进入端口1#设置端口类型为access#将端口0/0/1加入到vlan2配置vlan的IP地址注:缺省情况下所有端口都属于VLAN1,并且端口是access端口,一个access端口只能属于一个vlan;•如果端口是access端口,则把端口加入到另外一个vlan的同时,系统自动把该端口从原来的vlan中删除掉。VLAN的划分及配置配置过程注释[Quidway]interfaceGigabitEthernet0/0/48[Quidway-GigabitEthernet0/0/48]descriptionto_zotye[Quidway-GigabitEthernet0/0/48]portlink-typetrunk[Quidway-GigabitEthernet0/0/48]porttrunkallow-passvlan1020to25[Quidway-GigabitEthernet0/0/48]undoporttrunkallow-passvlan1[Quidway-GigabitEthernet0/0/48]speed100[Quidway-GigabitEthernet0/0/48]duplexfull#备注说明#设置接为类型为TRUNK#允许VLAN10,20至25数据通过#将VLAN1过滤#设置接口速度及双工静态路由的配置Network是目的网络或子网Mask是子网掩玛Address是下一跳路由器的ip地址Interface是用来访问目的网络的本地路由器的输出接口Preference是一个可选参数,用来定义优先选择级别Permanent是一个可选参数,用于确保某个路由不会被删除,即使是他的相关接口已经被关闭。[Quidway]iproute-staticnetwork[mask]{address|interface}[preference][permanent][Quidway]iproute-static0.0.0.00.0.0.0192.168.0.254例子:划出4个vlan200210220230分别配上IP:192.168.200.254/24;192.168.210.254/24;192.168.220.254/24;192.168.230.254/24把GigabitEthernet0/0/40,GigabitEthernet0/0/41,GigabitEthernet0/0/42,GigabitEthernet0/0/43分别加入到vlan中配置命令如下[Quidway]vlan200#建vlan[Quidway]vlan210[Quidway]vlan220[Quidway]vlan230[Quidway]interfaceGigabitEthernet0/0/40#进端口[Quidway-GigabitEthernet0/0/40]portlink-typeaccess#设置端口类型[Quidway-GigabitEthernet0/0/40]portdefaultvlan200#把端口加入到vlan[Quidway-GigabitEthernet0/0/40]undoshutdown#开启端口[Quidway]interfacevlanif200#进入vlan接口视图[Quidway-Vlanif200]ipaddress192.168.200.254255.255.255.0#给vlan配置ip地址[Quidway]interfaceGigabitEthernet0/0/41[Quidway-GigabitEthernet0/0/41]portlink-typeaccess[Quidway-GigabitEthernet0/0/41]portdefaultvlan210[Quidway-GigabitEthernet0/0/41]undoshutdown[Quidway]interfacevlanif210[Quidway-Vlanif210]ipaddress192.168.210.254255.255.255.0[Quidway]interfaceGigabitEthernet0/0/42[Quidway-GigabitEthernet0/0/42]portlink-typeaccess[Quidway-GigabitEthernet0/0/42]portdefaultvlan220[Quidway-GigabitEthernet0/0/42]undoshutdown[Quidway]interfacevlanif220[Quidway-Vlanif220]ipaddress192.168.220.254255.255.255.0[Quidway]interfaceGigabitEthernet0/0/43[Quidway-GigabitEthernet0/0/43]portlink-typeaccess[Quidway-GigabitEthernet0/0/43]portdefaultvlan230[Quidway-GigabitEthernet0/0/43]undoshutdown[Quidway]interfacevlanif230[Quidway-Vlanif230