交换机配置与查看(华三、华为)

大部分命令默认是华三的;华为的命令会特别注明

复制代码
交换机系统文件操作命令
    dir             #相当于ls,不显示隐藏文件
    dir /all        #显示隐藏文件
    save            #其他命令详见华为产品文档---命令参考---文件管理命令
    <H3C>logfile save               #将日志保存为文件(貌似不是简单的logbuffer啊,因为该日志文件记录的信息比logbuffer多,显示日期也更久)
    <H3C>more logfile/logfile.log   #查看日志文件
    <H3C>cd logfile/        #切换目录
    <H3C>delete logfile.log
交换机系统文件操作命令
复制代码

dis device manuinfo

<SW>scp 10.0.0.1 22 put logfile.log /tmp/test source ip 10.0.0.7
<SW>scp 10.0.0.1 22 get /lizp/S6800-CMW710-SYSTEM-R2612P02H3113.bin

复制代码
堆叠状态查看
    dis cu conf irf
    <H3C>dis irf
    <H3C>display irf link
    <H3C>display irf topology
    <H3C>display irf configuration
        irf-port 1/2
    <H3C>dis link-aggregation verbose
    display mad verbose
    <Huawei>dis stack       
    <Huawei>display eth-trunk 
堆叠状态查看
复制代码

 

交换机如何配置为tftp服务器??

复制代码
交换机系统命令(软硬件信息、配置等)
    <H3C>display diagnostic-information     #系统全面自检,可以保存结果到文件or直接显示结果
    display version
    display device
    display power               #查看电源,State为Normal
    display fan                 #查看风扇,State为Normal
    display cpu                 #查看cpu的占用率,是否忽高忽低,震荡较大,或者一直很高;不要超过70%;期望要求低于30%
    display memory              #查看内存占用率,不要超过70%;FreeRatio大于%70
    display boot-loader         #系统启动文件系统

    display logbuffer           #查看系统日志
    display logbuffer summary

    <H3C>display current-configuration
    <H3C>display saved-configuration
    <H3C>display current-configuration diff     #比较当前配置与保存的配置的区别
交换机系统命令(软硬件信息、配置等)
复制代码

 

复制代码
接口相关命令
    display interface brief
    display interface | include crc      一般情况下为0 CRC;出现非零的情况,再观察端口crc有无明显增长。
    display ip interface brief
    display interface g0/0/0    #查看端口协商,双工模式等;观察error是否丢包,、CRC(一般也是链路问题导致的丢包);
        fiber为光口;twisted pair为双绞线
        Flow-control is not enabled
    display transceiver diagnosis interface ten1/0/49       #查看收发光信息
    display transceiver manuinfo interface ten1/0/49        #查看光模块信息
    display transceiver interface ten1/0/49                 #查看光模块信息
    display transceiver alarm interface     #查看光模块的告警信息
    display like-aggregation verbose bridge-aggregation         #查看聚合端口的子接口
    display monitor-link group all
接口相关命令
复制代码

 

复制代码
查看流控相关配置
    [Huawei]display cu conf acl
    [Huawei]display cu conf classifier 
    [Huawei]display cu conf behavior 
    [Huawei]display cu conf trafficpolicy 
    [Huawei]display cu inter g0/0/0
    [Huawei]display cu conf ospf
    [Huawei]display cu conf bgp
查看流控相关配置
复制代码

 

复制代码
动态路由协议查看
    display ip routing-table statistics         #查看路由统计信息,注意added和deleted数据以及系统运行时间
    display ip routing-table                    #查看网络设备路由表
    display ip routing-table vpn-instance xxxx  #查看vpn示例路由表
    <H3C>display ospf peer
    <Huawei>dis ospf peer
    <H3C>display bgp peer ipv4
    <Huawei>dis bgp peer 
    dis cu conf bgp
动态路由协议查看
复制代码

 

复制代码
icmp配置
    华三 
 ip unreachables enable #默认关闭,icmp reply正常,但该功能关闭将导致traceroute最后一跳无响应(traceroute使用udp,目的IP设备需要回复icmp unreachables报文)
 ip ttl-expires enable  #默认关闭,icmp reply正常,但该功能关闭将导致traceroute中间设备无响应(traceroute使用udp,中间设备需回复ip ttl-expires报文)
icmp配置
复制代码

 

复制代码
info-center 信息中心 (在华三文档的分类就是信息中心) 应该就是syslog

    //华为版本
        配置交换机日志推送到日志主机: eg:日志主机IP地址:x.x.x.x
      [HW] system-view
      [HW] info-center channel 6 name loghost1
      [HW] info-center source default channel loghost1 log state on
      [HW] info-center loghost source *******
      [HW] info-center loghost x.x.x.x channel loghost1
      [HW] commit
     
     

    //华三版本
    [H3C] system-view
    [H3C] info-center host 1.1.1.1 6
    # 开启信息中心。
    <Sysname> system-view
    [Sysname] info-center enable
    # 指定向日志主机输出日志信息的通道为 loghost 通道。
    [Sysname] info-center loghost 1.2.0.1 channel loghost
    # 关闭所有模块日志主机的 log、trap、debug 的状态。
    [Sysname] info-center source default channel loghost debug state off log state off trap state off
    注意:
    由于系统对各通道允许输出的系统信息的缺省情况不一样,所以配置前必须将所有模块的需求通道(本例为loghost )上log、trap、debug 状态设为关闭,再根据当前的需求配置输出相应的系统信息。可以用displaychannel 命令查看通道的状态。
    # 将 IP 地址为 1.2.0.1/16 的主机作为日志主机,设置信息级别为informational,输出语言为英文,允许输出信息的模块为所有模块。
    [Sysname] info-center loghost 1.2.0.1 facility local7 language english
    [Sysname] info-center source default channel loghost log level informational
info-center 信息中心 (在华三文档的分类就是信息中心) 应该就是syslog
复制代码

 

复制代码
snmp
=====================================================================================================
网络管理和监控配置指导 http://www.h3c.com/cn/d_202104/1404142_30005_0.htm
SNMP网络架构由三部分组成:NMS、Agent和MIB。
个人理解:snmp基于C/S架构,NMS提供web管理页面,agent是部署在交换机or服务器上的,MIB(Management Information Base,管理信息库)
    NMS会主动发起get/set操作,agent负责响应(猜测无论是谁,只要发起请求,agent就会响应)
    配置trap的相关配置后,当有告警出现,agent会主动发出告警
    MIB虽然是在agent上,但猜测应该是通过NMS进行配置的。
    

==============================================================================================
华三交换机:
    snmp-agent                                                #启动SNMP Agent服务,默认是关闭的
    snmp-agent local-engineid xxxxxxxxx                        #系统自动生成,无需配置
    snmp-agent community read readtest                        #只读团体名为readtest,读写团体名为writetest
    snmp-agent community write writetest                    #只读团体名为readtest,读写团体名为writetest
    snmp-agent sys-info version all                            #{ all | { v1 | v2c | v3 } * },选择启用的snmp版本,默认为v3    #此处应该选择v3
    #snmp-agent sys-info version v2c v3
    snmp-agent group v3 group_name authentication read-view iso-view write-view iso-view notify-view iso-view                #创建SNMPv3组,缺省情况下,设备上没有配置SNMP组,新配置的SNMP组采用不认证、不加密方式
        建立SNMPv3连接时,是否进行认证和加密,受snmp-agent group v3和snmp-agent usm-user v3两条命令的影响:
            创建组时,如果不指定authentication和privacy参数,则表示不认证不加密。此时,使用和该组绑定的用户名建立SNMP连接时,均不认证不加密。即便用户配置了认证密码/加密密码,认证密码/加密密码也不生效。
            创建组时,如果指定authentication参数,则表示认证不加密。此时,使用和该组绑定的用户名建立SNMP连接时,均认证不加密。即便用户配置了加密密码,加密密码也不生效。该组内的用户必须配置认证密码,否则,不能建立SNMP连接。
            创建组时,如果指定privacy参数,则表示认证加密。此时,使用和该组绑定的用户名建立SNMP连接时,均认证加密。该组内的用户必须配置认证密码和加密密码,否则,不能建立SNMP连接。
    snmp-agent target-host trap address udp=domin $ip udp-port $port params securityname monitor_user v2c                    #设置Trap报文的目的主机
    snmp-agent target-host trap address udp=domin $ip udp-port $port params securityname monitor_user v2c                    #可以配置多条
    snmp-agent mib-view included iso-view iso                                                                                #创建MIB视图或更新MIB视图内容
    snmp-agent usm-user v3 monitor_user monitor_group cipher authentication-mode md5 $password                                #创建SNMPv3用户
    snmp-agent usm-user v3 username group_name simple authentication-mode md5 111111 privacy-mode des 222222                   #用户名h3c,用户组group_name,认证协议md5,认证密码:111111,加密协议:DES,加密密码:222222
    snmp-agent trap source LoopBack1

--------------------------------------------------------------------------
华为交换机:
    snmp-agent
    snmp-agent local-engineid xxxxxxxxx
    snmp-agent sys-info version v3
    snmp-agent group v3 snmpv3_alibaba authentication read-view iso-view write-view iso-view notify-view iso-view
    snmp-agent mib-view included iso-view iso
    snmp-agent usm-user v3 alimonitor
    snmp-agent usm-user v3 alimonitor group snmpv3_alibaba
    snmp-agent usm-user v3 alimonitor authentication-mode md5 cipher $password
snmp
复制代码

 

复制代码
镜像端口
    [H3C] mirroring-group 1 local        # 创建本地镜像组。
    [H3C] mirroring-group 1 mirroring-port ten-gigabitethernet 3/0/1 ten-gigabitethernet 3/0/2 inbound  # 将Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2配置为镜像源端口,对这两个端口接收的报文进行镜像。
    [H3C] mirroring-group 1 monitor-port ten-gigabitethernet 3/0/3        # 将Ten-GigabitEthernet3/0/3配置为镜像目的端口。

    [DeviceA] display mirroring-group 1        # 在完成上述配置后,在DeviceA上显示镜像组1的配置信息。
镜像端口
复制代码

 

复制代码
用户配置 + telnet/ssh登录设备配置
===============================================================================================================
    ● network-admin:具有最高权限,可操作系统所有功能和度资源(除安全日志文件管理相关命令外),配置此权限默认会给network-operator权限。
    ● network-operator:可执行系统所有功能和答资源的相关回display命令(除安全日志等查看命令外,具体大家可以自答行查看)

dis cu configuration local-user
---------------------------------------------------------------------------------------------------------------
华三配置telnet登录交换机---登录设备配置举例
#
 telnet server enable
 telnet server acl 2000

#
acl basic 2000
 rule 1 permit source 192.168.0.46 0
 rule 2 permit source 192.168.0.52 0
 rule 3 deny

#
line vty 0 63
 authentication-mode scheme

user-role network-operator
#

local-user userA class manage
 password hash $h$6$I2Sg4Llj1qVUWQZ3$JA6KkU3zfVVRg48MM92X6cVpdiqR2JF887PKi3GQMwnXXXcsWBuz7GIeJZeeNFMmMBaV7DPkKblnb0sGT2axvg==
 service-type telnet
 authorization-attribute user-role network-admin

#
local-user userB class manage
 password hash $h$6$q+c3OcSxrPpDpsDf$BWkgfOyxBLyR5zyYgF/+VvN/1ofy81zoHDlFf80OjDla6/EiSJbSBl33PeazilSkWSYcttkg5v5bGecB7oYwAw==
 service-type telnet
 authorization-attribute user-role roleB
#
role name roleB
 rule 1 permit read feature

---------------------------------------------------------------------------------------------------------------
华三配置ssh登录交换机---SSH典型配置举例

line vty 0 63
 authentication-mode scheme
#
ssh server enable
#
local-user client001 class manage
 password hash $h$6$CqMnWdX6LIW/hz2Z$4+0Pumk+A98VlGVgqN3n/mEi7hJka9fEZpRZIpSNi9bcBEXhpvIqaYTvIVBf7ZUNGnovFsqW7nYxjoToRDvYBg==
 service-type ssh
 authorization-attribute user-role network-admin
 authorization-attribute user-role network-operator


---------------------------------------------------------------------------------------------------------------
华为用户配置
    <HUAWEI> system-view
    [~HUAWEI] aaa
    [~HUAWEI-aaa] local-user admin password irreversible-cipher $password
    [~HUAWEI-aaa] commit
    <H3C> system-view [H3C] local-user admin class manage
    [H3C] password hash $password


    <HUAWEI> system-view 
    [~HUAWEI] sysname SwitchA 
    [*HUAWEI] commit 
    [~SwitchA] observe-port 1 interface 10ge 1/0/2 
    [*SwitchA] commit
    [~SwitchA] interface 10GE 1/0/1 
    [~SwitchA-10GE1/0/1] port-mirroring observe-port 1 inbound 
    [*SwitchA-10GE1/0/1] commit 
    [~SwitchA-10GE1/0/1] return
    <SwitchA> display port-mirroring
用户配置 + telnet/ssh登录设备配置
复制代码

 

复制代码
其他配置查看
    
display current-configuration | in load-sharing
display current-configuration | in arp
display current-configuration | in mac
display current-configuration | inmonitor-link
display current-configuration | in ntp
display license
其他配置查看
复制代码

 

复制代码
其他命令
    <H3C>display mac-address mac-move   #查看mac地址漂移
    <Huawei>display mac-address flapping    #查看mac地址漂移

    display stp
    display stp brief           #查看STP非正常阻塞端口
    display stp abnormal-port   #查看STP非正常阻塞端口

    display snmp-agent trap-list    #查看trap功能设置
    display curr | inc snmp-agent

    display lldp neighbor-information list
    
    display vrrp
其他命令
复制代码

 

复制代码
常用网络测试命令
    ping
    ping -vpn-instance xxxxxxxx 10.0.0.1
    tracert
    traceroute          #traceroute可以显示出ecmp路由
    tracepath           #显示内容与traceroute不同,不能显示ecmp路由
常用网络测试命令
复制代码

 

 reset counters interface E1/0/1

 dis vxlan tunnel

 

复制代码
vxlan二层转发逻辑;vxlan三层转发逻辑
==================================================================
vxlan二层转发逻辑(基于下面的实验配置):
    1.数据包从交换机发出,路由器子接口接收
    2.路由器子接口配置了'xconnect vsi test_vsi',所以报文被转入到vsi交换机
    3.vsi交换机配置了vxlan 1111以及使用tunnel 1,所以报文被封装vxlan vni 1111,同时数据被转发到vxlan隧道Tunnel1
    4.对端vtep接收到报文,拆解vxlan,根据vxlan vni 1111将报文放入到相应的vsi交换机
    5.。。。。。
---------------------------------------------------------------------------
vxlan三层转发逻辑:
    入网场景:
    1.交换机接收报文,报文进入vpn实例路由空间
    2.查看vpn实例路由表,匹配到相应的静态路由:该路由指定了出接口为Vsi-interface,同时指定了下一跳
    3.交换机根据静态路由,走了vxlan隧道(因为Vsi-interface接口就是vsi交换机的3层接口?还是arp static指定了下一跳走vxlan隧道?)
    出网场景:
    1.交换机从vxlan隧道接收到报文
    2.拆分vxlan,发现vxlan vni,把报文放入到相应的vsi交换机,即报文到达了vpn实例(从这一步看,猜测Vsi-interface接口就是vsi交换机的3层接口,将Vsi-interface接口绑定到vpn实例,相当于将vsi交换机放入到vpn实例中)
    3.根据vpn实例路由表进行路由转发
vxlan二层转发逻辑;vxlan三层转发逻辑
复制代码
复制代码
vxlan二层转发实验;vxlan三层转发配置
=================================================================================
https://blog.csdn.net/qq_29910529/article/details/103939980 H3C VXLAN实验
模拟器的交换机不支持配置vxlan,需要使用路由器进行配置
-----------------------------------------------------------------------
vxlan二层转发实验
开启L2VPN功能;缺省情况下,L2VPN功能处于关闭状态
l2vpn enable        

创建VXLAN隧道
interface Tunnel1 mode vxlan
 source 10.0.0.1
 destination 10.0.0.2

创建VXLAN;关联VXLAN和VXLAN隧道
vsi test_vsi        #VSI(Virtual Switch Instance,虚拟交换实例):VTEP上为一个VXLAN提供二层交换服务的虚拟交换实例。
                    #VSI可以看做是VTEP上的一台基于VXLAN进行二层转发的虚拟交换机,它具有传统以太网交换机的所有功能,包括源MAC地址学习、MAC地址老化、泛洪等。VSI与VXLAN一一对应。
 vxlan 1111         #创建VXLAN
  tunnel 1          #关联VXLAN和VXLAN隧道,即配置了vsi test_vsi转发二层报文,转发时携带vni 1111,穿越vxlan隧道 tunnel 1

-----------------------------
配置子接口,将接口连接(捆绑)到vsi交换机
interface GigabitEthernet0/1.200
 vlan-type dot1q vid 200
 xconnect vsi test_vsi

-----------------------------
另起一台交换机,模拟客户端
接口配置trunk,起vlanif接口模拟vm
vm同样使用ip 10.0.0.1;10.0.0.2

=============================================================================
vxlan3层转发:需要在二层转发的配置基础上,在vsi交换机上起一个3层接口,通过这个3层接口实现抓发
> vsi vsi170
>  gateway vsi-interface 170
>  vxlan 15737250
>   tunnel 1

> interface Vsi-interface170
>  ip binding vpn-instance vpn-11111111
>  ip address 100.64.2.169 255.255.255.252
>  mac-address 0000-5e00-0102

>  arp static 100.64.2.170 0001-0203-0400 Vsi-interface170 Tunnel1 vsi vsi170 vpn-instance vpn-11111111

>  ip route-static vpn-instance vpn-11111111 192.168.0.0 17 Vsi-interface170 100.64.2.170
>  ip route-static vpn-instance vpn-11111111 172.16.0.0 17 Route-Aggregation1.2030 10.10.209.149
vxlan二层转发实验;vxlan三层转发配置
复制代码

 

 

scp 10.1.1.1 put startup.cfg /root/startup.cfg source ip 10.x.x.x
scp 10.1.1.1 22 get /lizp/S6800-CMW710-SYSTEM-R2612P02H3113.bin

 

 

S6800系列:技术介绍+配置指导+典型配置举例+命令参考+日志参考
http://www.h3c.com/cn/Service/Document_Software/Document_Center/Switches/Catalog/S6800/S6800/?CHID=171398&v=612

posted @   雲淡風輕333  阅读(2072)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
点击右上角即可分享
微信分享提示