zoukankan      html  css  js  c++  java
  • 获取交换机的端口和名称

    for i in `ls /sys/class/net/ | grep enahisic` ;
    do echo "enabling lldp for interface: $i" ;
    lldptool set-lldp -i $i adminStatus=rxtx ;
    lldptool -T -i $i -V sysName enableTx=yes;
    lldptool -T -i $i -V portDesc enableTx=yes ;
    lldptool -T -i $i -V sysDesc enableTx=yes;
    lldptool -T -i $i -V sysCap enableTx=yes;
    lldptool -T -i $i -V mngAddr enableTx=yes;
    done
    [root@bogon ~]# bash ldp.sh
    enabling lldp for interface: enahisic2i0
    adminStatus = rxtx
    enableTx = yes
    enableTx = yes
    enableTx = yes
    enableTx = yes
    enableTx = yes
    enabling lldp for interface: enahisic2i1
    adminStatus = rxtx
    enableTx = yes
    enableTx = yes
    enableTx = yes
    enableTx = yes
    enableTx = yes
    enabling lldp for interface: enahisic2i2
    adminStatus = rxtx
    enableTx = yes
    enableTx = yes
    enableTx = yes
    enableTx = yes
    enableTx = yes
    enabling lldp for interface: enahisic2i3
    adminStatus = rxtx
    enableTx = yes
    enableTx = yes
    enableTx = yes
    enableTx = yes
    enableTx = yes
    enabling lldp for interface: enahisic2i3.310
    Device not found or inactive 310
    Device not found or inactive 310
    Device not found or inactive 310
    Device not found or inactive 310
    Device not found or inactive 310
    Device not found or inactive 310
    enabling lldp for interface: enahisic2i3.900
    Device not found or inactive 900
    Device not found or inactive 900
    Device not found or inactive 900
    Device not found or inactive 900
    Device not found or inactive 900
    Device not found or inactive 900
    [root@bogon ~]# lldptool -T -i enahisic2i0  -V mngAddr ipv4=10.10.16.81
    ipv4 = 10.10.16.81
    [root@bogon ~]# systemctl restart lldpad
    [root@bogon ~]# lldptool -t -n -i enahisic2i0
    Chassis ID TLV
            MAC: 04:bd:70:5c:1e:f0
    Port ID TLV
            Ifname: GigabitEthernet0/0/4
    Time to Live TLV
            120
    Port Description TLV
            GigabitEthernet0/0/4
    System Name TLV
            GuanLiWang_7
    System Description TLV
            S5720-56C-EI-AC
    Huawei Versatile Routing Platform Software
    VRP (R) software, Version 5.170 (S5720 V200R011C10SPC600)
    Copyright (C) 2000-2018 HUAWEI TECH Co., Ltd.
    System Capabilities TLV
            System capabilities:  Bridge, Router
            Enabled capabilities: Bridge, Router
    Management Address TLV
            IPv4: 10.10.17.239
            Ifindex: 59
            OID: 0.6.15.43.6.1.4.1.143.91.5.25.41.1.2.1.1.1
    Port VLAN ID TLV
            PVID: 1016
    Port and Protocol VLAN ID TLV
            PVID: 0, not supported, not enabled
    VLAN Name TLV
            VID 1: Name VLAN 0001
    MAC/PHY Configuration Status TLV
            Auto-negotiation supported and enabled
            PMD auto-negotiation capabilities: 0x7c05
            MAU type: 1000 BaseTFD
    Power via MDI TLV
            Port class PD
            PSE MDI power not supported
            PSE pairs not controllable
            PSE Power pair: unkwown [0]
            Power class 1
    Link Aggregation TLV
            Aggregation capable
            Currently not aggregated
            Aggregated Port ID: 0
    Maximum Frame Size TLV
            9216
    End of LLDPDU TLV
    [root@bogon ~]#
  • 相关阅读:
    Zabbix监控mysql配置及故障告警配置
    Tesseract-OCR 字符识别---样本训练
    Wex5案例使用JSON传输Thinkphp后端对接,以达成数据正常输出
    Linux内核分析:recv、recvfrom、recvmsg函数实现
    libevent源码分析:evmap_io_active_函数
    libevent源码分析:epoll后端实现
    监听套接字不可写?
    Linux内核分析:dup、dup2的实现
    Linux内核分析:打开文件描述符实现
    libevent源码分析:http-server例子
  • 原文地址:https://www.cnblogs.com/dream397/p/13540802.html
Copyright © 2011-2022 走看看