目录
- 1、华为交换机命令行的三种视图
- 2、修改交换机名称
- 3、关闭和开启信息中心
- 4、vlan
- 附录:
交换机型号:S5700
1、华为交换机命令行的三种视图
<Huaweu> #用户视图。特征:尖括号、用户名。
[Huawei] #系统视图。特征:方括号、用户名。
[Huawei-xxx] #业务视图。特征:方括号、用户名、短横、业务名。xxx表示具体业务
用户视图,开机默认视图,对软考中没啥用。
系统视图,修改用户名、密码、时间、查看当前配置。
业务视图,其中具体业务视图主要包括接口视图、路由协议视图、vlan视图。
三种视图间切换:
<Huawei>system-view #用户视图切换到系统视图
[Huawei]interface GigabitEthernet 0/0/1 #系统视图切换到具体的业务视图
[Huawei-GigabitEthernet0/0/1]q #具体的业务视图回退到系统视图。补全为quit
[Huawei]q #系统视图回退到用户视图。补全为quit
<Huawei>
执行quit命令,可从当前视图退出至上一层视图。执行return命令可以从任意视图返回到用户视图。
2、修改交换机名称
[Huawei]sysname Switch-01
[Switch-01]
3、关闭和开启信息中心
[HUAWEI]undo info-center enable #关闭信息中心
[HUAWEI]info-center enable #打开信息中心
4、vlan
[Huawei]display vlan #查看本交换机vlan
[Huawei]vlan 5 #创建名为5的单个vlan
[Huawei]vlan batch 21 23 29 to 40 #批量创建名为21、23、29~40的vlan
[Huawei]undo vlan 5 #删除vlan 5
[Huawei]undo vlan batch 21 23 29 to 40 #批量删除vlan 21、23、29~40
[Huawei]interface vlan 5 #将vlan 5当作一个虚拟接口,SVI技术
[Huawei-Vlanif5]ip address 192.168.1.254 24 #给这个虚拟接口配置一个管理IP地址
[Huawei-Vlanif5]interface g0/0/1 #配置g0/0/1端口
[Huawei-GigabitEthernet0/0/1]port link-type access #将g0/0/1端口的链路类型配置成接入模式
[Huawei-GigabitEthernet0/0/1]port default vlan 5 #将g0/0/1端口加入vlan 5
[Huawei-GigabitEthernet0/0/1]q #从业务视图推出至系统视图
[Huawei]telnet server enable #开启交换机的telnet功能(默认是关闭的)
附录:
键入 ? 可以查看当前视图下所有可用命令。
用户视图下可用命令:
<Huawei>?
User view commands:cd Change current directorycheck Check informationclear Clear informationclock Specify the system clockcluster Run cluster commandcluster-ftp FTP command of clustercompare Compare functionconfiguration Configuration interlockcopy Copy from one file to anotherdebugging Enable system debugging functionsdelete Delete a filedir List files on a file systemdisplay Display current system informationfixdisk Recover lost chains in storage deviceformat Format the deviceftp Establish an FTP connectionhwtacacs-user kill Release a user terminal interfacelanguage-mode Specify the language environmentlldp Link Layer Discovery Protocollocal-user Add/Delete/Set user(s)lock Lock the current user terminal interfacemkdir Create a new directorymore Display the contents of a filemove Move the filemtrace Trace route to multicast sourcentdp Run NTDP commandspatch Patch subcommandsping Send echo messagespwd Display current working directoryquit Exit from current command viewreboot Reboot systemrefresh Do soft resetrename Rename a file or directoryreset Reset operationrmdir Remove an existing directorysave Save current configurationschedule Schedule system taskscreen-length Set the number of lines displayed on a screenscreen-width Set screen widthsend Send information to other user terminal interfacesset Setstack Stack start-script Start a script on an user-interfacestartup Configure parameter for system to startupsuper Privilege current user a specified priority levelsystem-view Enter the system viewtelnet Establish a Telnet connectionterminal Set the terminal line characteristicstest-aaa Accounts testtftp Establish a TFTP connectiontrace Trace route (switch) to host on Data Link Layertracert Trace route to hostundelete Recover a deleted fileundo Cancel current configurationunzip Decompress a filezip Compress a file<Huawei>
系统视图下可用命令
[Huawei]?
System view commands:aaa AAAacl Specify ACL configuration informationalarm Enter the alarm viewanti-attack Specify anti-attack configurationsapplication-apperceive Set application-apperceive informationarp ARP modulearp-miss Specify ARP MISS configuration information arp-suppress Specify arp suppress configuration information,default is disabledauthentication Authenticationautoconfig AutoConfig configuration informationbfd Bidirectional Forwarding Detectionbgp Border Gateway Protocol(BGP)bootrom BootRombpdu BPDU messagebtv Btv view bulk-file Specify the file name of bulk statisticsbulk-stat Set bulk statisticscapture-packet Capture-packetccc Circuit cross connectioncfm Connectivity fault managementclear Cancel current configurationcluster Specify the information for cluster configurationcommand-privilege Specify the command levelconfiguration Configuration interlockconfiguration-occupied Configuration exclusive occupiedcp-car Cpu car settingcpu-defend Configure CPU defend policycpu-defend-policy Configure CPU defend policycpu-usage Set cpu usage configurationdhcp Dynamic host configure protocol dhcp-snooping DHCP snooping dhcpv6 Dynamic host configure protocol version 6 diffserv Specify diffserv parameters display Display priority informationdldp Device link detection protocol dns Specify domain name systemdomain Default domaindot1x 802.1x configuration informationdrop Discard attributedrop-profile Drop profile dsa Specify DSA module configurationse-trunk E-Trunkecmp ECMPefm EFM moduleerps Ethernet ring protection switchingerror-down The interface was shut down because of an error eventevent Enter the event viewexecute Batch commandfib FIB status and configuration informationfile Specify file system configuration informationftp Set the FTP server attributesgarp Generic Attribute Registration Protocolgtsm The generalized TTL security mechanismgvrp Generic VLAN Registration Protocolheader Define the login bannerhwtacacs hwtacacs-server icmp Specify ICMP configuration information icmp-reply Enable ICMP reply fastigmp Specify IGMP configuration informationigmp-snooping Specify parameters for IGMP-Snoopinginfo-center Specify message output configuration informationinterface Specify the interface configuration viewip Specify IP configurations for the systemipv4 Configure ip packet ipv6 Enable IPv6 functionalityisis Intermediate System to Intermediate System (ISIS)routeskeychain Keychain authenticationl2-topology Layer 2 topologyl2protocol-tunnel Layer 2 protocol tunnellacp Link aggregation control protocollldp Link Layer Discovery Protocolload-balance Specify load balance modeloopback-detect Loopback detect functionlspv Lsp verificationmac-address Mac addressmac-authen MAC authenticate configure informationmac-forced-forwarding Mac-Forced Forwardingmac-learning MAC learningmac-spoofing-defend MAC spoofing defendmatched Is Command can be matched by upper templatemip Configure a rule used to create MIPmld-snooping Specify parameters for MLD-Snoopingmonitor-link Monitor link configuration informationmpls Specify MPLS(Multiprotocol Label Switching)configuration informationmpls-qos MPLS QoSmsdp Specify MSDP(Multicast Source Discovery Protocol)configuration informationmtrace Trace route to multicast sourcemulticast Multicast informationnap NAP protocolnd Neighbor discoveryndp Neighbor discovery protocolnqa Network Quality Analysis(NQA)nqa-jitter Switch NQA jitter versionnqa-server Specify NQA echo serverntdp Network topology discovery protocolntp-service Specify NTP (Network Time Protocol) configurationinformationoam-mgr Oam-mgr viewobserve-port Configure observe port featureospf Open Shortest Path First (OSPF)ospfv3 OSPF version 3 for IPv6pim Specify PIM(Protocol Independent Multicast)configuration informationping Ping functionpolicy-based-route Specify a policy for policy based routingport-group Port-groupport-isolate Port isolateport-mirroring Mirror portportal Configure Portal local serverportswitch Switch port between router and switch modepppoe PPPOE pw-template Specify PW template configurationqos QoS configurationquit Exit from current command viewradius-server Add or delete RADIUS server templaterefresh Refresh routes to I/O boardreset Reset operationreturn Exit to user viewrip RIP (Routing Information Protocol)ripng RIPng (Routing information next generation protocol)rmon Specify RMON configurationrmon2 Specify RMON2 configurationroute Routing Moduleroute-policy Route-policyroute-policy-change Specify route policy change parameterrouter Configure router informationrrpp Rapid ring protection protocolrsa Specify RSA module configuration informationscp Set SCP serverscreen-width Set screen widthscript-string Define a modem script-stringsep Smart ethernet protectionservice Toggle service mode. By default it is offset Setsftp Set SFTP service attributesmart-link Smart link configuration informationsnmp-agent Specify SNMP (Simple Network Management Protocol)configuration informationssh Set the SSH (secure shell) configuration attributestack Stack static-lsp Static LSP configurationstelnet Set Stelnet service attributestp Specify Spanning Tree Protocol (STP) configurationinformationsuper Modify super password parameterssysname Specify the host nametcp Specify TCP(Transmission Control Protocol)configuration informationtelnet Set the status of the Telnet servicetemperature Device temperaturetest-aaa Accounts testtest-packet Set the test packettftp Establish a TFTP connectiontftp-server TFTP servertime-range Specify time-range configuration informationtrace Trace route (switch) to host on Data Link Layertracert Trace route to hosttraffic Specify traffic configuration informationtraffic-delete Delete sacl traffic-filter Filter packets based on acl traffic-limit Limit the rate of the packets based on acl traffic-mirror Mirror packets based on acl traffic-policy Apply specific traffic policytraffic-redirect Redirect packets based on acl traffic-remark Remark packets based on acl traffic-statistic Count packets based on acl trunk Trunk interfacettl Time to livetunnel-selector Tunnel-policy selectorudp-helper UDP Helper undo Cancel current configurationunknown-unicast Unknown unicastupgrade Upgrade software onlineuser-bind User bind user-group User groupuser-interface Configure the user terminal interfacevlan Virtual LANvoice-vlan Voice VLANvrrp Specify configuration information about VRRPweb-auth-server Portal authentication server
[Huawei]