Configure PortGroup settings across all ESX hosts simultaneously
VI3 Enterprise features VMotion, DRS, and HA require identical virtual networking settings on all of your ESX hosts. Unfortunately, VirtualCenter does not apply a central configuration policy or inheritance of settings from the cluster. Maybe a future version of VirtualCenter will evolve to include global configuration abilities? Until such a version is created, each ESX server’s virtual networking settings will continue to be configured individually by most administrators. However, there are some time saving, global configuration options available today. This post summarizes two methods provided by the virtualization community for creating PortGroups simultaneously across multiple ESX hosts.
Add Port Groups plugin
lostcreations.com has created the Add Port Groups plugin that will allow you to configure virtual networking settings for all of your hosts. Of course, you will still need to create the virtual switches on each host before using the plugin, but once the vswitches are in place the Add Port Groups plugin is a huge time saver.
“Add Port Groups is a VI 2.5 client plugin that enables the ability to create many port groups at once on many ESX hosts and many virtual switches.”
You can download this plugin here.
Other virtualization blogs have already reported about the usefulness of this tool: Bob Plankers at lonesysadmin.net declares lostcreations “Add Port Groups” Plugin Rocks.
“I just used the lostcreations “Add Port Groups” plugin to add 15 VLANs to six new ESX servers. Holy crap, that’s slick. Adding port groups is the thing I dread the most about new ESX hosts since it’s typo-prone and generally annoying.
Using the RCLI to create PortGroups
Hugo over at the VMwire Virtual Goodness blog has a great post about using the VMware Remote Command Line Interface (RCLI) to launch a script that will configure PortGroups on multiple ESX servers.
“By using the VMware RCLI (Remote Client) you can send vicfg- (esxcfg) commands to both ESX 3.5 and ESXi hosts. Originally it was intended for use with ESXi due to it having limited service console but the functionality is also provided for ESX 3.5 hosts.”
The method for using the RCLI to create the same PortGroup across multiple ESX hosts is summarized as follows:
- Use SSH to remotely log on to the RCLI server (or log on locally)
- create a script that repeats the vicfg-vswitch command for all of your ESX hosts
- launch the new script to create the PortGroup(s) on all servers in seconds
The following is a copy of Hugo’s script, but use the link above to read his entire post. This script uses an example of creating a PortGroup named “VLAN123″ that tags VM traffic for VLAN 123. You have to add your own server names, username and password for each ESX server, and change the script for your actual PortGroup name and VLAN used.
#!/bin/sh
#Script to add portgroup with vlad id of 123 to vSwitch1 onto all ESX 3.5 hosts# Assign port groups to vSwitch1
vicfg-vswitch –add-pg=VLAN123 vSwitch1 –server= –username=root –password=vicfg-vswitch –add-pg=VLAN123 vSwitch1 –server= –username=root –password=
vicfg-vswitch –add-pg=VLAN123 vSwitch1 –server= –username=root –password=
#Assign vlan ids to port groups
vicfg-vswitch -v 123 -p VLAN123 vSwitch1 –server= –username=root –password=vicfg-vswitch -v 123 -p VLAN123 vSwitch1 –server= –username=root –password=
vicfg-vswitch -v 123 -p VLAN123 vSwitch1 –server= –username=root –password=
For more about using the RCLI go here.









