«

»

Mar 17

Rebuilding your Service Console network.

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 :D

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:

esxcfg-vswitch -r
esxcfg-vmknic -r
esxcfg-vswif0 -r

and finally verify if everything has actually gone use

esxcfg-vswitch -l
esxcfg-vmknic -l
esxcfg-vswif -l

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. :D

4 comments

Skip to comment form

  1. Jason Miles

    Very, very useful Team. Just used this one myself in a Data Center. Many thanks for giving to the community. ~Jason

  2. Virgil

    Why not just change the IP address and subnet of the Service Console and VMK interface ?
    And probably the gateway too.

    I don’t understand why moving from a /16 subnet to multiple /24s requires removing all networking configuration.

    esxcfg-vswif -p “Service Console” -i 192.168.0.1 -b 192.168.0.255 -n 255.255.255.0 vswif0
    #possibly with a route del default gw 172.16.0.254 to remove the old one.
    route add default gw 192.168.0.254 vswif0

    Now recreate the vmkernel interface

    esxcfg-vmknic -i 192.168.1.1 -n 255.255.255.0 “VMKernel”
    esxcfg-route 192.168.1.254

  3. Tom Howarth

    Virgil, for the previous 9 hosts that is exactly what I did but the 10 was being a right royal pain in the backside,

    Normally I would just do a reinstall and not bother, but I was giving a bit of on the job training to another engineer learning the ropes after doing his I & C course, so I showed him how to do it so I thought I would post it here for infomation.

  4. Virgil

    Cheers Tom. All makes sense now.
    Bring on Host Profiles ;)

Comments have been disabled.