Manage Learn to apply best practices and optimize your operations.

PowersHell: Enabling “Management Traffic” on VMKernel port for ESXi

Describes the steps you must follow in order to enable "Management Traffic" on VMKernel port for ESXi.

Well, this particular configuration has been outstanding for me for more than a month and I’ve finally cracked...

it. Borrowing from Carter Shaklin’s example of enabling FT Logging, I found a method of doing this:

You have to be a little bit careful when you run this script. You don’t need this script with ESX “Classic”, which uses the Service Console. For that, you can use the -consoleNIC parameter to make sure the new VMHostNetworkAdapter is a vswif interface rather than a vmkernel interface.

$vs3 = vSwitch3
$HAheartbeat = New-VirtualPortGroup -VirtualSwitch $vs3 -Name HA-Heartbeat
New-VMHostNetworkAdapter -PortGroup HA-Heartbeat -VirtualSwitch $vs3 -IP $HAheartbeatIP -SubnetMask 255.255.255.0 -ConsoleNic

To do the same for ESXi, you have to dig into the SDK by using the data object virtualNicManager held with configManager to set the “Management Traffic” attribute.

$hView = Get-VMHost esx4.vi4book.com | Get-View -Property configManager
$nicManager = Get-View $hView.configManager.virtualNicManager
$nicManager.SelectVnicForNicType("management", "vmk2")

The only slightly annoying thing about this PowersHell is that I don’t think I would have found these parameters without the help of the PowerCLI product manager. I’m trying to work out how he found these values; it could wind-up being an internal engineering thing, rather than something in the public domain. Well, it is public now :-)

I suspect that the SelectVnicForNicType companion QueryNetConfig was used to find out the variables on an existing configured ESXi host to find out the values for ”faultToleranceLogging” and “management”. I wasn’t so clever, I worked out “management” by guessing! 

Update:

Anyways, after posting this the Product Manager for the PowerCLI ping’d me an email with a URL showing where the values of “management”, “vmotion” and “faultToleranceLogging” were held on.

http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.host.VirtualNicManager.NicType.html

This was last published in September 2009

Dig Deeper on Scripting administrative tasks

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchServerVirtualization

SearchVirtualDesktop

SearchDataCenter

SearchCloudComputing

Close