Next-Gen Stuff: Enabling CDP in ESX/ESXi

Now that the veil appears to have been lifted on discussing features and functionality in the next-generation of ESX/ESXi, I thought I’d start out with a brief how-to on enabling Cisco Discovery Protocol (CDP) on ESX/ESXi, both with vNetwork Standard Switches (vSwitches) and vNetwork Distributed Switches (dvSwitches).

Let’s start out with an easy one: enabling CDP on ESX for a vSwitch. There is no GUI for enabling or disabling CDP for a vSwitch (yet), so it’s off to the CLI. You’ve probably seen this command before:

esxcfg-vswitch --set-cdp both vSwitch0

Replace the italicized parts of that command with the appropriate information for your environment. That sets CDP to both listen (receive CDP transmissions) and announce (send CDP transmissions). I recommend using both, although I have not currently found a way to explore the CDP information that ESX is gathering by listening to announcements. If anyone has any information there, I’d love to hear it.

The next one is a bit harder: enabling CDP on ESXi for a vSwitch. Of course, since we are using ESXi there is no Service Console, so this time we’ll have to rely upon the next-generation equivalent of VIMA.

The command from next-gen VIMA looks like this:

vicfg-vswitch --server vcenter.domain.com -h esxi.domain.com -B both vSwitch0

Unless you’ve set some environment variables, you’ll be prompted for username and password. I substituted the “-h” for “-−vihost” and “-B” for “-−set-cdp”. Again, you’ll need to replace the italicized portions with the appropriate information for your environment. I did find that using IP addresses didn’t seem to work well; I had to use fully-qualified domain names instead. That’s probably just an oddity.

The last scenario is enabling CDP on a dvSwitch. The process for this is the same for both ESX and ESXi. You’ll need to use the next-generation VI Client for this, and then go to the Edit Settings screen for the dvSwitch. Once there select Advanced, and you’ll see the option to set the CDP behavior. Click Both from the drop-down list and you should be good to go.

There’s lots more networking goodness in here; stay tuned for more articles in the near future.

Tags: , , , ,

  1. William’s avatar

    If you’re managing your ESX/ESXi hosts with VIMA, you can take advantage of VMware VIFastpass

    sudo vifp addserver
    vifpinit
    vicfg-vswitch –server vcenter.domain.com –vihost esxi.domain.com –set-cdp both vSwitch0
    (won’t be prompted for credentials)

    Each time you login to VIMA, you only need to do

    vifpinit

    once and vifast pass will work across any of the manage hosts =)

    The creds are actually being stored in environmental variables

    env | grep VI

  2. William’s avatar

    Looks like wordpress did not like “”

    That should have been vifpinit [host]

  3. Russell’s avatar

    Is the NDA lifted yet? I don’t recall getting any notices and I would love to share some info.

  4. Jason’s avatar

    I’m pretty sure NDA has not been lifted as I just got an e-mail yesterday regarding NDA and beta info.

  5. John Troyer’s avatar

    I think it’s ok to post about things that were shown at VMworld Europe: either talked about in a public session or available in the labs. This is a bit of configuration wonkery, doesn’t seem to spill many beans, and I assume this was talked about in the labs at VMworld.

    That’s a fuzzy line, and I don’t know how that helps if you weren’t at VMworld. I do trust folks in the beta to be reasonable, and I’d counsel on being conservative, but ultimately, VMware created this situation by showing the product in public on one hand while asking beta testers to be private on the other. Certainly bugs in the beta, suggestions, or other surprises should stay in the private discussion.

    [disclaimer: I am not on the VI Beta Team, who have the final say.]

  6. william bishop’s avatar

    I would recommend against sharing information, we are still getting traffic that is pretty specific about it being in NDA as yet. They will release it in due time, why risk it?

  7. Shawn MacArthur’s avatar

    Might want to look at your commands I believe that they are wrong. the switch should be -Bboth, you are missing it from one and have a space in the other.

  8. slowe’s avatar

    Shawn,

    No, the commands are correct. It is not required to use “-Bboth”; putting a space in there (as in “-B both”) works just fine. The long form of the “-B” command is “—set-cdp” (WordPress sometimes mangles dashes, so that should be double-dash followed by set-cdp). So, in the first example I’m using the long form, and in the second example I’m using the short form. Use “esxcfg-vswitch -h” to view the parameters for more information.

  9. Mike Chaney’s avatar

    Scott,
    I must be missing something in this CDP command for exsi because I don’t see where the -B switch is available or anything is referenced about –set-cdp. I am running the command using RCLI and I can’t get anything back. If I run the command to just list the config info I have no issue so I’m connecting to the correct ESXi server. Any quick tips on what I’m doing wrong is greatly appreciated.

  10. slowe’s avatar

    Mike, I just logged into an instance of the vSphere Management Assistant (vMA, next-generation VIMA) and ran “vicfg-vswitch —help” (that’s two dashes in front of help) and it clearly shows the option to use either -B or —set-cdp (again, that’s two dashes in front of set-cdp). I’ve used it many times to set the CDP status on a vSwitch on both ESX and ESXi.

    Hope this helps!