Changing the VLAN ID of a ESX Service Console using Command Line

A good amount of ESX admins ask on dialy basis how to change the VMware ESX Service Console Vlan using command line. As I decided to save time by writing the steps for these kind of questions to send it to others when asked. I will document these commands in here:

First of all check which vSwitch the Service Console is on (and the name of the Service Console) with esxcfg-vswitch -l (Note: The default service Console switch is vSwitch0 & default name is “Service Console”.)

To set a vlan id on the service console use:

esxcfg-vswitch vSwitch0 -v X -p “Service Console” (Replace X with the desired VLAN number)

To remove the vlan id completely, you will need to set it to 0 using the following command:

esxcfg-vswitch vSwitch0 -v 0 -p “Service Console”

Please note both commands above had assumed the name of your service console & switch are “Service Console” & vSwitch0 as they more probably are as these are the default values. If you have changed them, please replace these with your values.

I hope this tip will help many of you out there. If I had gave you the link to fix your problem as a friend or a customer, then I hope it save you the cost of an engineer trip to your place :). Please leave your feedback & comments as these are highly appreciated :).

Comments

  1. Hi Eiad,
    Thank you for good explanation,
    I was confused with the command line syntax until I come across your post and removed vlan as you recommended here.
    Thanks again!
    Alex

  2. Thanks for the help.

  3. Perfect explanation!Thanks a LOT!

  4. Dear Eiad,

    thanks for use ful post. I need information if i have already ESX4 2 box with 3 VMs each, but networking is installed as typical, i.e. only NIC is used from both boxes, for Serv console and no VLANs defined.
    If now i want to segregare the CS and VMs NICs traffic to other PHYSICAL NICs of both boxes it is posible?
    Can we join 2 ESX hosts with Cross Cable to interconnect and testing Vmotion as there is no storage inside them?

    BR,
    Aamir

  5. Hi Aamir,

    I am sorry, but I had a bit of hard time trying to understand what you are trying to achieve. Though if what you need is to have the service console has a dedicated NIC & the VMS to have another dedicated NIC then yes its possible to do so.

    One way to achieve the above would be to create two virtual switches & each use a different NIC card. You dedicate one virtual switch for Service Console & use the other one for the VM NICs. Another way to achieve the same would be to create one switch with two port groups, & dedicate a different NIC to each port group.

    If you only have two NIC cards in your server, then you can connect these cards to trunk port on the switch & team them from the ESX side. That will allow you to create multiple port groups on the vSwitch with each having its own segregated vLan although all the traffic is passing on the same two NIC cards.

    For your last point, its totally not clear as you will require a shared storage to achieve vMotion no matter what. Though you can always build your software iSCSI, use NAS, or use third party solution which can get the local disk on ESX server look like a shared disk to be used for VMotion.

    I hope this help,
    Eiad

  6. oezgwer says:

    thanx dude

  7. Thanks, this was really usefull !

  8. Hi Allan/oezgwer,

    I am glad that you both have found it useful.

    Enjoy,
    Eiad

  9. Life saver. I got locked out while configuring the vlan.

  10. Hi Chris,

    Great to know that my VLAN changing article has helped you. I guess the power of command line & service console never seems to fade out :).

    Enjoy,
    Eiad

  11. perfect. Thanks a lot for this documentation!

  12. You welcome Benny

  13. thanks, saved my day :)

Speak Your Mind

*

Sponsors