ܼ

ESXi 6.0LLDPݡȾϰʲȤʤäƤ롣

vSwitchCDPΤߥݡ
dvSwitchLLDP/CDP򥵥ݡ
vmnicLLDP򥵥ݡ

vmnicLLDPͭ

GUI̤ˤLLDP˴ؤܤ̵ͭˤSSHˤƥ⡼ȥԤävsishޥǼưԤ

vSwitchñ̤ǹԤvmnicȤ³ݡȤФƤΤ߹Ԥ

ݡֹǧ

  • ޥ
    vsish -e ls /net/portsets/[vSwitch Num]/ports 
  • ץ
    vsish -e ls /net/portsets/vSwitch0/ports 
  • Ϸ
    33554433/
    33554434/
    33554435/
    33554436/
    33554437/
    33554438/

vmnicȤ³ݡȳǧ

  • ޥ
    vsish -e get /net/portsets/[vSwitch Num]/ports/[Port Num]/status
  • ץ
    vsish -e get /net/portsets/vSwitch0/ports/33554434/status 
  • Ϸ
    port {
      port index:2
      portCfg:
      dvPortId:
      clientName:vmnic2
      clientType:port types: 4 -> Physical NIC
      clientSubType:port types: 0 -> NONE
      world leader:0
      flags:port flags: 0x1010c043 -> IN_USE ENABLED UPLINK DISPATCH_STATS_IN DISPATCH_STATS_OUT DISPATCH_STATS CONNECTED LLDP_ENABLED TUNNEL_ENDPOINT
      Impl customized blocked flags:0x00000000
      Passthru status:: 0x1 -> WRONG_VNIC
      fixed Hw Id:00:1f:29:57:70:b0:
      ethFRP:frame routing {
         requested:filter {
            flags:0x00000000
            unicastAddr:00:00:00:00:00:00:
            numMulticastAddresses:0
            multicastAddresses:
            LADRF:[0]: 0x0 
            [1]: 0x0 
         }
         accepted:filter {
            flags:0x00000000
            unicastAddr:00:00:00:00:00:00:
            numMulticastAddresses:0
            multicastAddresses:
            LADRF:[0]: 0x0 
            [1]: 0x0 
         }
      }
      filter supported features:features: 0 -> NONE
      filter properties:properties: 0 -> NONE
      rx mode:properties: 0 -> INLINE
      tune mode:Tuning mode: 0 -> default
    }

clientName:vmnic̾ɽƤݡȤǤΤLLDPͭ뤳ȤǤ롣

LLDPǧ

  • ޥ
    vsish -e get /net/portsets/[vSwitch Num]/ports/[Port Num]/lldp/enable
  • ץ
    vsish -e get /net/portsets/vSwitch0/ports/33554434/lldp/enable
  • Ϸ
    0LLDP̵
    1LLDPͭ

LLDPͭ

  • ޥ
    vsish -e set /net/portsets/[vSwitch Num]/ports/[Port Num]/lldp/enable 1
  • ץ
    vsish -e set /net/portsets/vSwitch0/ports/33554434/lldp/enable 1

ꥹץ

ȤˤƸƤ륹ץȤѤ뤳ȤvSwitchñ̤LLDPͭ/̵Ǥ롣

esxi_lldp_control.sh

ˡ

  • ޥ񼰡ͭ
    esxi_lldp_control.sh [vSwitch Num] 1
  • ޥ񼰡̵
    esxi_lldp_control.sh [vSwitch Num] 0
  • ץͭ
    # esxi_lldp_control.sh vSwitch0 1
    
     Port: 33554433
      port index:1
      clientName:Management
      clientType:port types: 0 -> NONE
      portCfg:
     Trying to change LLDP state to 1..
     ERROR: changing LLDP state failed
    ------------------------------ 
    
    Port: 33554434
      port index:2
      clientName:vmnic2
      clientType:port types: 4 -> Physical NIC
      portCfg:
     Trying to change LLDP state to 1..
     LLDP state successfully changed
    ------------------------------

  • esxi_lldp_control.sh
    #!/bin/sh
    # Enable/Disable LLDP on vSwitch ports on VMWare ESXi
    # Tested with ESXi 6.0.0 3620759
    # Doesn't need vCenter, only SSH access to the ESXi machine
    # (c) Pekka "raspi" Jarvinen 2016 http://raspi.fi/
    
    SWITCH=$1
    OPERATION=$2
    
    if [ "$SWITCH" = "" ] || [ "$OPERATION" = "" ]; then
      echo "Enable/disable LLDP on vSwitch"
      echo ""
      echo "USAGE:"
      echo "$0 <vSwitch> <operation>"
      echo "Examples: "
      echo "Enable LLDP: $0 vSwitch0 1"
      echo "Disable LLDP: $0 vSwitch0 0"
    
      exit 1
    fi
    
    case "$OPERATION" in
        0) ;;
        1) ;;
        *) echo "Invalid operation: $OPERATION"; exit 1 ;;
    esac
    
    
    for PORT in `vsish -e ls /net/portsets/$SWITCH/ports | sed 's/\/$//'`
    do
      echo "Port: $PORT"
      DATA=`vsish -e get /net/portsets/$SWITCH/ports/$PORT/status`
      echo "$DATA" | grep -i "port index:"
      echo "$DATA" | grep -i "clientName:"
      echo "$DATA" | grep -i "clientType:"
      echo "$DATA" | grep -i "portCfg:"
    
      echo "  Trying to change LLDP state to $OPERATION.."
      vsish -e set /net/portsets/$SWITCH/ports/$PORT/lldp/enable $OPERATION &> /dev/null
    
      LLDPSTATE=`vsish -e get /net/portsets/$SWITCH/ports/$PORT/lldp/enable`
      if [ "$LLDPSTATE" = "$OPERATION" ]; then 
        echo "  LLDP state successfully changed"
      else
        echo "  ERROR: changing LLDP state failed"
      fi
    
      echo "------------------------------"
      echo ""
      
    done

ESXiưLLDPưͭ

ESXiκƵưˤLLDPϽ̵ˤƤޤΤᡢLLDPͭˤ뤿ˤESXiεư˼ưŪͭн褬ɬפȤʤ롣

/etc/rc.local.d/local.sh˵뤳ȤǡESXiεưޥ¹Ԥ뤳ȤǤ롣

ư˥ǽʾҤesxi_lldp_control.sh֤ưˤѤLLDPͭԤ

  • /etc/rc.local.d/local.sh
    Ǥդβս˵
    
    ## enable LLDP
    /vmfs/volumes/PATH/esxi_lldp_control.sh vSwitch0 1 > /dev/null 2>&1
    /vmfs/volumes/PATH/esxi_lldp_control.sh vSwitch1 1 > /dev/null 2>&1
    
    ɬ׿򵭽Ҥ

ͻ

LLDP and Standard Virtual Switches
esxi_lldp_control.sh


ȥå   Խ ʬ ʎގ̎ ź ʣ ̾ѹ   ǽ   إ   ǽRSS
Last-modified: 2017-02-15 () 12:15:33 (39d)