vmNICManagement.pl

Version 2

    This scripts allows administrators to perform some simple operations on  existing Virtual Machine vNICs such as updating the MAC Address and/or  vNIC type (pcnet,vmxnet2,vmxnet3,e1000 and e1000e)

     

    Update: e1000e support recently added to support VM Hardware 8 for vSphere5

     

    Download the script here

     

    Requirements:

    • vCLI 4.x/5.0 or vMA 4.x/5.0

    • ESX(i) 4.x/5.0 or vCenter 4.x/5.0

     

    Operations:*

    • query - Queries for particular vNIC on a VM

    • updatenictype - Modifies the type of vNIC on a VM (e1000,e1000e,pcnet32,vmxnet2,vmxnet3)

    • updatemac - Manually assigns a valid MAC address on a VM

     

    Sample Execution:*

     

    query

    [vi-admin@scofield ]$ ./vmNICManagement.pl --server reflex.primp-industries.com --username primp --vmname TEST --operation query --vnic 1
    
    VM: TEST
    Current info for "Network adapter 1" which is using VirtualE1000:
    MAC Address: 00:50:56:93:56:7c
    Network: Development
    

     

    updatemac

    [vi-admin@scofield  ]$ ./vmNICManagement.pl --server reflex.primp-industries.com --username primp --vmname TEST --operation updatemac --vnic 1 --mac 00:50:56:93:56:c7
    Current info for "Network adapter 1" which is using VirtualE1000:
    MAC Address: 00:50:56:93:56:7c
    Network: Development
    
    Updating MAC Address on vNic from "00:50:56:93:56:7c" to "00:50:56:93:56:c7"
            Successfully reconfigured "TEST"
    

     

    updatenictype

    [vi-admin@scofield  ]$ ./vmNICManagement.pl --server vcenter50-1 --username root --vmname DummyVM1 --operation updatenictype --vnic 2 --nictype e1000e
    Enter password:
    Current info for "Network adapter 2" which is using VirtualE1000:
    MAC Address: 00:50:56:a0:5e:8b
    Network: VM Network

    Removing old VirtualE1000 "DummyVM1".
            Successfully reconfigured "DummyVM1"

    Adding new e1000e vNic to "DummyVM1"
            Successfully reconfigured "DummyVM1"