esxcfg-portgroup-mgmt.pl

Version 1

    Table of Contents

    • Author

    • Description

    • Category

    • Features

    • Requirements

    • Version Support

    • Sample Execution

     

     

    Author

    William Lam

     

    Description

    This script was motivated by VMTN community member and blogger Jason Boche who posed a question on the VMware forums regarding a Scripted solution for enabling Management Network on a portgroup.

     

    The script supports not only enabling and disabling the management network on a supported portgroup type but also Fault Tolerance Logging and vMotion.

     

    Category

    • Initial Server Set Up

     

    Features

    • Enable and Disable Fault Tolerance Logging, vMotion and Management Traffic

     

    Requirements

     

    Version Support

    • Supports ESX(i) (licensed version only)

     

    Usage

    [vi-admin@scofield scripts]$ ./esxcfg-portgroup-mgmt.pl
    Required command option 'operation' not specified.
    Required command option 'portgroup' not specified.
    Required command option 'portgroup_type' not specified.
    
    Synopsis: ./esxcfg-portgroup-mgmt.pl OPTIONS
    
    
    Command-specific options:
       --operation (required)
          Operation to perform [enable|disasble]
       --portgroup (required)
          Name of portgroup
       --portgroup_type (required)
          Type of portgroup [vmotion|ft|mgmt]
    
    Common VI options:
       --config (variable VI_CONFIG)
          Location of the VI Perl configuration file
       --credstore (variable VI_CREDSTORE)
          Name of the credential store file defaults to <HOME>/.vmware/credstore/vicredentials.xml on Linux and <APPDATA>/VMware/credstore/vicredentials.xml on Windows
       --encoding (variable VI_ENCODING, default 'utf8')
          Encoding: utf8, cp936 (Simplified Chinese), iso-8859-1 (German), shiftjis (Japanese)
       --help
          Display usage information for the script
       --passthroughauth (variable VI_PASSTHROUGHAUTH)
          Attempt to use pass-through authentication
       --passthroughauthpackage (variable VI_PASSTHROUGHAUTHPACKAGE, default 'Negotiate')
          Pass-through authentication negotiation package
       --password (variable VI_PASSWORD)
          Password
       --portnumber (variable VI_PORTNUMBER)
          Port used to connect to server
       --protocol (variable VI_PROTOCOL, default 'https')
          Protocol used to connect to server
       --savesessionfile (variable VI_SAVESESSIONFILE)
          File to save session ID/cookie to utilize
       --server (variable VI_SERVER, default 'localhost')
          VI server to connect to. Required if url is not present
       --servicepath (variable VI_SERVICEPATH, default '/sdk/webService')
          Service path used to connect to server
       --sessionfile (variable VI_SESSIONFILE)
          File containing session ID/cookie to utilize
       --url (variable VI_URL)
          VI SDK URL to connect to. Required if server is not present
       --username (variable VI_USERNAME)
          Username
       --verbose (variable VI_VERBOSE)
          Display additional debugging information
       --version
          Display version information for the script
    

     

    Sample Execution

     

    Enable Management Traffic

     

    [vi-admin@scofield scripts][http://esxi4-2.primp-industries.com|http://esxi4-2.primp-industries.com]$ ./esxcfg-portgroup-mgmt.pl --server esxi4-2.primp-industries.com --operation enable --portgroup "Management Network" --portgroup_type ft
    
    Enabling "faultToleranceLogging" on portgroup: "Management Network" ...
    

     

    Enable FT

     

    [vi-admin@scofield scripts]$ ./esxcfg-portgroup-mgmt.pl --server esxi4-2.primp-industries.com --operation enable --portgroup "Management Network" --portgroup_type ft
    
    Enabling "faultToleranceLogging" on portgroup: "Management Network" ...
    

     

    Enable vMotion

     

    [vi-admin@scofield scripts]$ ./esxcfg-portgroup-mgmt.pl --server esxi4-2.primp-industries.com --username root --operation enable --portgroup "Management Network" --portgroup_type vmotion
    
    Enabling "vmotion" on portgroup: "Management Network" ...
    

     

    -


     

    Disable Management Traffic

     

    [vi-admin@scofield scripts][http://esxi4-2.primp-industries.com|http://esxi4-2.primp-industries.com]$ ./esxcfg-portgroup-mgmt.pl --server esxi4-2.primp-industries.com --operation disable --portgroup "Management Network" --portgroup_type mgmt
    
    Disabling "management" on portgroup: "Management Network" ...
    

     

    Disable FT

     

    [vi-admin@scofield scripts][http://esxi4-2.primp-industries.com|http://esxi4-2.primp-industries.com]$ ./esxcfg-portgroup-mgmt.pl --server esxi4-2.primp-industries.com --operation disable --portgroup "Management Network" --portgroup_type ft
    
    Disabling "faultToleranceLogging" on portgroup: "Management Network" ...
    

     

    Disable vMotion

     

    [vi-admin@scofield scripts][http://esxi4-2.primp-industries.com|http://esxi4-2.primp-industries.com]$ ./esxcfg-portgroup-mgmt.pl --server esxi4-2.primp-industries.com --operation disable --portgroup "Management Network" --portgroup_type vmotion
    
    Disabling "vmotion" on portgroup: "Management Network" ...