VMware Cloud Community
qchrisc
Contributor
Contributor

Command to change the number of port of a vswitch

Hi

As we can change the number of ports of a vSwitch from the virtual infrastructure client, how can we do this into a command line.

For the creation, I have found the following command: esxcfg-vswitch -a <vswitchname>:<numberofport>

But I cannot find any command to change this number of port after the vswitch creation.

What I would like to do it to set the default vSwitch0 number of port to 24 instead of 56 in a scripted installation.

I tried in my script to delete the vSwitch0 and recreate it specifying the number of ports with the above command, but it seems to not take into account that number of ports.

Any help will be appreciated.

Thanks

Chris

Reply
0 Kudos
5 Replies
rpartmann
Hot Shot
Hot Shot

Hi,

you could boot you server in troubleshotmode or set it into maint mode, and the edit the /etc/vmware/esx.conf

/net/vswitch/child[0000]/name = "vSwitch0"

/net/vswitch/child[0000]/numPorts = "32" and change this value

and reboot the server.

kind regards,

Reinhard.






ps: Award points if you find answers helpful. Thanks.

ps: Award points if you find answers helpful. Thanks.
Reply
0 Kudos
hitchhiker
Enthusiast
Enthusiast

You can not reconfigure the number of ports at runtime. But just deletiing the vswitch and creating a new one with the right number of ports should work. Does it not? Any error messages?

gary1012
Expert
Expert

I'm almost certain you can change the vSwitch ports while the vSwitch is online. Use the vimsh to make the change.

1. ssh into the host

2. su or sudo into vimsh

3. hostsvc/net/vswitch_setnumports <vSwitch#> <port change>

See the Xtravirt vimsh doc at: .

Community Supported, Community Rewarded - Please consider marking questions answered and awarding points to the correct post. It helps us all.
Reply
0 Kudos
admin
Immortal
Immortal

Vimsh will allow you to change the configured number of ports, but the change does not take effect at runtime. Previous posters are correct, reboot or delete, re-add are required to change the number of ports on a virtual switch.

qchrisc
Contributor
Contributor

Hi all

Thanks to everybody for your answers.

I solved my problem. As mentionned, I tried to delete, recreate the network and reboot without success. Because I was only trying to delete the virtual switch without first deleting the vswif interface where by default the Service Console was installed. So my command to delete the virtual switch was not successfully applied.

Starting with a command to remove the vswif0 then deleting the vswitch0, and recreating a new one is my solution.

Reply
0 Kudos