We had been having issues installing in a new ESX farm on a c7000 chassis, due to the lack of a Routing Switch (we will not go into the reasons as to its absence, the pain is still too sharp), so when it finally arrived we had to change the IP addressing scheme on the installed servers and guests to collapse the current flat network that utilised a 16 bit sub-net into a network that utilised a 24 bit sub-net mask. what follows below is a blow by blow account of the command line battle. It was a glorious war
So how exactly do you do this from the command line, well firstly you have to delete your vswif and if configured your vmknic interfaces by using the following commands
esxcfg-vswif -d vswif0
esxcfg-vmknic -d vmkernel Substitute your vmkernel name here.
Also remember that ESX is a case sensitive Operating system: VMKernel is different from vmkernel. Once that is done you need to delete your port groups
esxcfg-vswitch -D “VMKernel”
esxcfg-vswitch -D “Service Console”
The Quotes are not necessary unless you have spaces in your port group names so it is better to get used to using them. Finally delete your vSwitches
esxcfg-vswitch -d vSwitch0
This will now leave you with a ‘blank’ networking config. next run the reset options for each of the following commands:
and finally verify if everything has actually gone use
Now you need to recreate your switches and portgroups
First issue the following command to create the vswitches
esxcfg-vswitch -a vSwitch0
esxcfg-vswitch -a vSwitch1
Next create your port groups
esxcfg-vswitch -A “Service Console” vSwitch0
esxcfg-vswitch -A “VMKernel” vSwitch0
esxcfg-vswitch -A “ProdNet” vSwitch1
If this all works with no issues, if you have issued the commands correctly then you should have no issues. Issue the command esxcfg-vswitch -l to see what it looks like.
Next recreate the vswif interface
esxcfg-vswif -a vswif0 -p “Service Console” -i <your IP Address here> -n <Your Subnet Mask here>
Now recreate the vmkernel interface
esxcfg-vmknic -a “VMKernel” -i <your IP Address here> -n <Your Subnet Mask here>
Run esxcfg-vswitch -l to verify your vswitch config.
Lastly, associate uplinks to your vSwitches
esxcfg-vswitch -L vmnic0 vSwitch0
esxcfg-vswitch -L vmnic1 vSwitch1
If you have more than one nic assigned to each vSwitch then reissue the above command with the required vmnic#
there is one further set of commands to add, if you are using multiple Portgroups per vSwitch you will need to assign a VLAN id to it.
esxcfg-vswitch -v <VLAN ID> <PortGroupName> vSwitch#
This is quite a complicated set of commands to work through, but well worth the time spent, the above commands are the basic building blocks of a nice #Bash script I will be showing you later.