WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Uncategorized / How to restart the ESXi management network via command-line?

How to restart the ESXi management network via command-line?

01.28.2014 by William Lam // 11 Comments

A great question that was brought up on Twitter yesterday by Andreas Peetz who asked the following:

Is there a way to restart the mgmt network in ESXi via a cmd line? You can do this from the DCUI, but I want a script! 

There are a variety of reasons why you would want to restart the Management Network on your ESXi host and usually it is related to troubleshooting or configurations such as renewing the DHCP lease on a particular VMkernel interface. For Andreas, it was renewing the DHCP lease and this is actually a use case I have heard from others before. Currently, the only way to restart the Management Network for your ESXi host is using the DCUI (Direct Console User Interface) either through the console using iLO/iDRAC/etc. or remotely over SSH.

Andreas' question is not a new one and I have heard this ask in the past. I have even inquired about it when I was a customer but was told it was not possible and had to use the DCUI. I was not really satisfied with the answer I provided to Andreas, so I decided to do a bit of digging myself and ping some engineers. Apparently this functionality is actually exposed through a legacy command-line utility called esxcfg-vmknic in the ESXi Shell as well as locally/remotely via the ESXCLI network namespace which is used to manage the VMkernel interface (Thanks to Andres for mentioning ESXCLI method).

There are two flags that this command supports which is to enable and disable a VMkernel interface. This is actually what the DCUI is doing when you ask it to restart the Management Network and is very similar to restarting a service on a UNIX/Linux system, it first shutdowns the service and then starts it back up. Given this information, if you wish to restart the Management Network of your ESXi host you can specify the name of the Management Network portgroup and execute the enable operation immediately after performing the disable operation.

To do this from the command-line, you would add a ; (semi-colon) between the two commands so they are executed one after another to ensure your VMkernel interface is enabled after you have disabled it. Here is an example of the command:

esxcli network ip interface set -e false -i vmk0; esxcli network ip interface set -e true -i vmk0

More from my site

  • Customizing the ESXi DCUI to show number of VMs
  • How to get rid of "Quicks stats on hostX is not up-to-date" message
  • Programmatically accessing the Broadcom Compatibility Guide (BCG)
  • Supported chipsets for the USB Network Native Driver for ESXi Fling
  • Quick Tip - Auditing ESXi boot firmware type

Categories // Uncategorized Tags // dcui, esxcfg-vmknic, ESXi, management interface, management network

Comments

  1. *protectedAndreas Peetz says

    01/29/2014 at 1:03 pm

    Great, William! Exactly what I was looking, thanks for digging this out.

    I only wonder why do you not recommend using the corresponding esxcli commands?:
    esxcli network ip interface set -e false -i vmk0; esxcli network ip interface set -e true -i vmk0

    Andreas

    Reply
    • *protectedWilliam Lam says

      01/29/2014 at 3:31 pm

      Andreas,

      It's actually not performing the same operation. The way you can tell is by watching /var/log/syslog.log between these two operations and comparing it to when you perform it via DCUI

      Reply
    • *protectedAndreas Peetz says

      01/29/2014 at 3:34 pm

      Yes, I noticed the differences in the log file, but maybe it's only a difference in logging. At least it will also restart the DHCP clients (see /var/log/dhclient.log), so it's good for me.

      Reply
    • *protectedWilliam Lam says

      01/30/2014 at 3:55 pm

      I've checked with engineering and looks like both commands produces the same outcome but are different applications, hence they're logged differently as you mentioned. I've updated my article to reference the ESXCLI command which is definitely the recommended way and you can perform this operation locally or remotely

      Reply
  2. *protectedrnelson0 says

    03/01/2014 at 3:59 am

    What about "services.sh restart"? Recommended to restart he management agent in numerous KB articles, but not sure it mentions the networking components.

    Reply
    • lamw says

      03/02/2014 at 1:09 am

      services.sh restarts a bunch of other things as the name implies. I prefer to issue a specific command for a particular operation

      Reply
  3. *protectedKaisar says

    11/30/2015 at 1:56 am

    my DNS DHCP cannot true after this command. And host ip not ping.

    help me please.

    before this operation i created second vmkernel network interface and deleted.

    Reply
  4. *protectedNoor says

    12/31/2016 at 6:41 pm

    Can we restart the management agent of ESXi host using vMA

    Reply
  5. *protectedZuss McLany says

    08/26/2017 at 6:56 am

    Hi, can we restart the management network using PowerCLI?

    Reply
  6. *protectedabhishek says

    01/16/2018 at 10:44 pm

    How to restart dhcp service in esxi because my vm's are not getting the dhcp ip address.
    What I should do ?

    Reply

Trackbacks

  1. Which Direct Console User Interface option should the administrator use to renew the DHCP lease for the hosts? - Exam 2V0-621D at ExamsDB says:
    03/06/2018 at 7:37 am

    […] Reference: http://www.virtuallyghetto.com/2014/01/how-to-restart-esxi-management-network.html […]

    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