Link to home
Start Free TrialLog in
Avatar of skullnobrains
skullnobrains

asked on

remap an ESXi portgroup to a different vswitch without deleting+recreating

how can i remap an ESXi portgroup to a different vswitch without deleting+recreating the portgroup

from my experience, recreating a portgroup with the same name works but only after i delete and recreate or remap manually all of the corresponding guest's interfaces which is error prone, a pita, and will produce some downtime

this platform has no vcenter. i have easy access to the UI and ssh command line on the ESX, and i can use vcli if needed. my preferred way would be ssh.
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

vCenter Server not required.

What portgroup, virtual machine portgroup, or VMKernel Portgroup ?

Are you referring to a virtual machine portgroup ?

any change to a VM networking, will cause a "small" amount of downtime, e.g. 1-2 pings. and network fabric to converge on another vSwitch, and physical switch.
Avatar of skullnobrains
skullnobrains

ASKER

i'm referring to multiple VLAN portgroups that each have multiple virtual machines attached. no vmkernel involved afaik.

they are created through the UI or using a command like the following

esxcli network vswitch standard portgroup add --portgroup-name=$2 --vswitch-name=$3

__

i do not care about loosing a few pings.

i do care about stopping, reconfiguring, and restarting each of the machines.

there is no way i know of to instruct vmware to remap such a portgroup to a different vswitch other than deleting and recreating the portgroup. if i do that, all the machines will end up associated with the first portgroup in the list when i reboot them. i do not want that.


thanks for your help
hmm
there is no scripting command i know of that will allow me to do remap my portgroup to another vswitch. is there one i'm not aware of ?

are you suggesting i script a piece of code to del and recreate the portgroup and then remap each interface of each machine ? this is quite easy but from my experience very error prone : i've noticed multiple times that each interface need to be remapped over and over and they can revert several minutes after the change was made as long as i do not reboot the guests.
So let me get this correct, you have virtual machines connected to

Virtual Machine Portgroup Group A

on

vSwitchA

and you actually want to MOVE - Virtual Machine Portgroup Group A to vSwitch B ?
precisely, yes

and i'm trying to figure out how to do that without deleting the portgroup

i have multiple portgroups on vSwitch1 which i want to move to vSwitch0. without changing the vlans numbers or portgroups names and while keeping the attached guests. i'm reducing the number of virtual switches both for consistency and availability of network ports : i'm moving from 2 different virtual switches each mapped to a single physical port to a single virtual switch with failover between 2 physical ports. i'm aware this may not be best practice, but consistency with other hosts setup is important, and i'm short on physical ports so this is a necessary trade-off.
ASKER CERTIFIED SOLUTION
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sorry for the mess in my prev text. corrected : i've been using "portgroup" rather than "vswitch".
anyway, seems that you guessed what i meant.

__

i'd assume if i edit esx.conf or whichever file holds the portgroup info, i may be able to change the vswitch while keeping the same portgroup ids... but afaik, the id is built using a bunch of information including the portgroup so it probably will break something.

i noticed that the .vmx of each machine holds a line
ethernet0.networkName = "PORTGROUP_NAME"

i assume vmware reads this file when it registers the host and then links the virtual NIC to the portgroup's ID.  actually i'm creating my machines by generating a partial .vmx file and registering them.

do you happen to know where the information is stored ? i guess in a cache file in the machine dir ? might that be editable ?

i guess unregistering and reregistering each machine using the .vmx file would work as a scriptable alternative but i'd rather not


any extra ideas ? i'm looking for a honest opinion : i'm obviously taking responsibility if i end up making a mess... and i'll try whatever i deem dangerous in a lab first