Ìܼ¡

³µÍ×

ESXi 6.0¤ÎLLDP¥µ¥Ý¡¼¥È¾õ¶·¤Ï°Ê²¼¤È¤Ê¤Ã¤Æ¤¤¤ë¡£

vSwitchCDP¤Î¤ß¥µ¥Ý¡¼¥È
dvSwitchLLDP/CDP¤ò¥µ¥Ý¡¼¥È
vmnicLLDP¤ò¥µ¥Ý¡¼¥È

vmnic¤ÎLLDPÍ­¸ú²½

³µÍ×

GUI²èÌ̤ˤÏLLDP¤Ë´Ø¤¹¤ë¹àÌܤÏ̵¤¯¡¢Í­¸ú²½¤Ë¤ÏSSH¤Ë¤Æ¥ê¥â¡¼¥È¥í¥°¥¤¥ó¤ò¹Ô¤Ã¤¿¾å¤Çvsish¥³¥Þ¥ó¥É¤Ç¼êÆ°ÀßÄê¤ò¹Ô¤¦¡£

ÀßÄê¼ê½ç

ÀßÄê¤ÏvSwitchñ°Ì¤Ç¹Ô¤¤¡¢vmnic¤È¤ÎÀܳÀ­¤¬¤¢¤ë¥Ý¡¼¥È¤ËÂФ·¤Æ¤Î¤ß¹Ô¤¦¡£

¥Ý¡¼¥ÈÈÖ¹æ¤ò³Îǧ

  • ¥µ¥ó¥×¥ë
    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 (2719d)