WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Uncategorized / Another way to enable management traffic on ESXi

Another way to enable management traffic on ESXi

02.09.2011 by William Lam // 3 Comments

Here is another way in you can enable the management traffic type on a VMkernel interface in ESXi without having to resort to using the vSphere API, this especially useful when automating a kickstart installation.

When you enable a specific vmkX interface (esxcfg-vmknic -l) to allow for the management traffic type, there is an entry that is made in the /etc/vmware/hostd/hostsvc.xml file. The specific interface is denoted by a unique nic id which starts off at 0000 and is incremented by one for additional VMkernel interfaces that are added.

If you add a second VMkernel interface called vmk1 and you wanted to also enable it for management traffic, the file would look like the following:

For the changes to take effect, you will need to restart hostd agent by running /etc/init.d/hostd restart. You will also need refresh the network sub-system by using vim-cmd hostsvc/net/refresh which will refresh the vSphere Client view else you will have to do it manually before you can see the update.

This is probably overkill, but I decided to write a simple script in which you can pass the VMkernel interface name and the script will update hostsvc.xml file with the proper nic id/etc. Here is an example for enabling management traffic for vmk1:

Download: enableMgmt.sh

If you would like to integrate this into your ESXi kickstart, you can easily do so based on the number of VMkernel interfaces you will be creating during the installation. You can add the following into your %post section which uses a here document to overwrite the existing hostsvc.xml with the expected VMkernel interfaces that should have the management traffic type enabled.

HOSTSVC_FILE=/etc/vmware/hostd/hostsvc.xml

cat > ${HOSTSVC_FILE} << __CREATE_HOST_SVC__


vmk0
vmk1
vmk2

normal

on
on
on


__CREATE_HOST_SVC__

This is a cleaner alternative than using python and connecting to the vSphere API locally on an ESXi host which is described in my blog article Automating ESXi 4.1 Kickstart Tips & Tricks Tip #7

More from my site

  • How to restart the ESXi management network via command-line?
  • Nested Virtualization Resources
  • Disable LUN During ESXi Installation
  • Extracting SSL Thumbprint from ESXi
  • How to Access USB Storage in ESXi Shell

Categories // Uncategorized Tags // ESXi 4.1, management interface

Comments

  1. *protectedmacfaden says

    05/14/2011 at 1:20 am

    Should be:
    For the changes to take effect

    Either
    you will need to restart hostd agent by running /etc/init.d/hostd restart

    or
    refresh the network sub-system by using vim-cmd hostsvc/net/refresh

    Doing both is overkill.

    Reply
  2. *protectedLaClair says

    10/24/2011 at 2:51 pm

    With ESXi 5 I took a slightly different approach.

    since I'm installing over http I just put a hostsvc.xml file out on the webserver with vmk0 and vmk1 in there (as listed above, thanks for pointing me in the right direction)

    From there all I did was
    wget http://webserver/hostsvc.xml -O /tmp/hostsvc.xml
    cp /tmp/hostsvc.xml /etc/vmware/hostd/hostsvc.xml
    /etc/init.d/hostd restart
    vim-cmd hostsvc/net/refresh

    I do have sleep commands in between each line, I'm sure it's overkill but I was just trying to rule out any variables.

    On the contrary to what MacFaden stated above, in my findings if I did the hostsvc refresh before restarting hostd then the copied file would revert back to normal. Granted my approach was a little different than the one blogged here but I'm sure the behavior has to be similar.

    Now time for the burning question... why isn't a simple task like enabling management traffic a esxcli or vim-cmd command?

    Reply
  3. *protectedAnonymous says

    02/05/2013 at 2:48 pm

    Hi

    i know this post is old, but i just wanted to add that it actually is possible via esxcli.
    like so:

    esxcli network ip interface tag add -i vmk1 -t Management

    Reply

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025