1.交换机五大基本工作模式及命令
 第一次配置 网络设备,需要使用console线在PC需要使用“超级终端”或其他软件。
      1).用户模式
        switch>
            可以查看交换机的基本简单信息,且不能做任何修改配置!
      2).特权模式
        switch>enable
        switch#
            可以查看所有的配置,且不能修改配置,但可以做测试、保存、初始化等操作。
      3).全局配置模式
        switch#configure terminal
        switch(config)#
            默认不能查看配置! 
            可以修改配置,且全局凑效!
     4).接口配置模式
          switch(config)#interface
          switch(config-if)#
            默认不能查看配置! 
            可以修改配置,且对改端口凑效!
     5).console口配置模式(线模式/控制台模式)
             默认不能查看配置!
             可以修改配置,且对console口凑效!

2.命令
    1).exit
        返回上级模式
    2).end
        直接退到特权模式
    3).支持命令缩写
    4).?的用法

    5).历史命令(上下控制)

    6).tab补全键的使用

    7).配置主机名:
        conf t
            hostname 设备名
    
    8).设置用户密码
        line console 0
            password 密码
        
    9).ctrl + u:删除命令

    10). ctrl + a :光标进到行首。 ctrl+ e :光标进到行尾   

    11).reload :重启

    12).在内存中存在一个文件:
            running-config 第一次开机,系统会在内存中自动创建一个新的干净的running-config文件

    13).保存配置:
     en
     copy running-config     startup-config、
        或
    write 

    14).交换机开机动作
        先去硬盘中查找startup-config是否存在,如果不存在,在内存中创建新的running-config文件,若存在,则复制内容到running-config
    
    15).查看running-config文件
            en/show/display
                show running-config

    16).配置特权密码
        conf t
        enable password 密码
        enable secret 密码

    19). 清空配置文件的内容
            en
                erase startup-config
    
     20). mac-address-table查看mac地址表

    21).show ip interface brief 查看接口列表信息

    22).手工关闭接口
        int f0/x
          no  shutdown
          exit

    23).do的用法
        do +“空格”可以强制使用特权模式的命令
            如:
            do sh run
            do sh ip int b

    24).删除配置
      1)在哪配置的,就在哪删!
      2)命令前加空格
      3)原命令中有参数并且参数具有唯一性,则删除时不需要加参数
        如:
        conf t
        hostname sw1

        conf t
        no hostname

      25).开启远程控制:
            conf t
                line vty 0 4
                transport input telnet
                password 密码
                login
                exit

             conf t
                (hostname ww
                ip domain-name ww.ww.com
                crypto key generate rsa 生成密钥对)配ssh时需要用到

                line vty 0 4
                transport input telnet/ssh/none/all
                login local
                exit
              username xx password 123.com
      
        26).为三层接口配置IP并开启命令
                int fo/1
                ip add 10.1.1.254 255.255.255.0
                no shutdown

        27).为交换机配置管理IP
            conf t
            int vlan 1
                ip add 10.1.1.2 255.255.255.0 
            
        28).为交换机配置默认网关:
                conf t
                    ip default-dateway 10.1.1.254

        29).关闭自动解析功能
                conf t
                no ip domain-lookup
                        
Logo

社区规范:仅讨论OpenHarmony相关问题。

更多推荐