VMware Cloud Community
Pilu1978
Enthusiast
Enthusiast

ESXi Command line

Hi,

I am trying to add a vmkernel adapter to distributed switch by the below command:

esxcli network ip interface add --interface-name=vmk1 --dvs-name=DVSWITCHNAME --dvport-id=PORT_ID

It is failing every time with error invalid port id. esxcfg-vswitch -l command shows that vmnic1 and vmnic2 of the hosts are connected to 636 and 637 port of this dvswitch.

How to determine what port_ID should be used to execute the command successfully.

Please help.

Reply
0 Kudos
3 Replies
amohammadimir
Hot Shot
Hot Shot

There are only some functions with VDS and ESXi command-line. To the best of my recollection you can remove and recreate but create a new one is not an option.

Please remember to mark the replies as answers if they helped.
Reply
0 Kudos
Nawals
Expert
Expert

Hi,

I understand you are trying to create vmk1 with below command. Have  you check and make sure vmk1 not connected to dvswitch.

check port id with below command.

esxcfg-vswitch -l |grep vmk1 |awk '{print $1}'

NKS Please Mark Helpful/correct if my answer resolve your query.
Reply
0 Kudos
Lalegre
Virtuoso
Virtuoso

Hey Pilu1978​,

Your command is failing because you need to specify the dvportgroup-id and you are specifying the port-id from a PortGroup. However I could not find a way of getting dvportgroup-id without any interface connected to it.

Of course there are a lot of places to get that information such as vCenter MOB, vCenter API, using vRealize Orchestrator, using external tools and I think even using PowerCLI. Try to go over those solutions to see if you can get it or what you can do to easily get it is to create a VMK interface manually from the UI and after you create it, run the command esxcfg-vswitch -l and record the dvportgroup-id

Reply
0 Kudos