VMWare VI3 - Sample Script to Configure VM Switches and VMotion
#!/bin/sh
- VI3 Server Customization v1.0
- Jason M. Langone
- Veni, vidi, vici
- read var1 var2
- echo var1 = $var1 and var2 = $var2
- Remove default network configuration
- Ask if internal or DMZ?
- INTERNAL BLADE VERSION =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
echo ———————————- VMotion & vSwitch Configuration —————————-
echo Enter VMotion IP Address:
read vi3vmip
echo Enter VMotion Subnet Mask:
read vi3vmsm
echo Enter VMotion Default Gateway:
read vi3vmdg
echo ———————————————————————————-
echo VMotion IP Address will be $vi3vmip
echo VMotion Subnet Mask will be $vi3vmsm
echo VMotion Default Gateway will be $vi3vmdg
echo ———————————————————————————-
#esxcfg-vswitch vSwitch0 -D “VM Network”
#esxcfg-vswitch -U vmnic0 vSwitch0
#esxcfg-vswitch -U vmnic1 vSwitch0
#esxcfg-vswif -d vswif0
#esxcfg-vswitch -d vSwitch0
#service mgmt-vmware restart
echo ———————————————————————————-
echo Setting up VMotion…
echo “Setting up vMotion…” >> /root/PostInstall/PostInstall.log
echo Create VMotion Port Group…
esxcfg-vswitch vKernel -A VMotion
- If Internal, uncomment and comment the 131
esxcfg-vswitch vKernel -p VMotion -v 130
echo …DONE!
echo Configure VMotion IP Details…
esxcfg-vmknic -a VMotion -i $vi3vmip -n $vi3vmsm
esxcfg-route $vi3vmdg
echo …DONE!
echo ———————————————————————————-
- Setup the xxx Port Groups
echo Create Production Switch…
esxcfg-vswitch -a Production
echo …DONE!
echo Bind NICs to Production Switch…
esxcfg-vswitch Production -L vmnic1
esxcfg-vswitch Production -L vmnic2
echo …DONE!
- For internal blade uncomment
echo Create VLAN151 Port Group…
esxcfg-vswitch Production -A VLAN151
esxcfg-vswitch Production -p VLAN151 -v 100
echo Create VLAN136 Port Group…
esxcfg-vswitch Production -A VLAN136
esxcfg-vswitch Production -p VLAN136 -v 136
echo …DONE!
echo “
echo “
echo “
echo “
echo “
- Craps out
esxcfg-advcfg -s 1 /Migrate/Enable
service mgmt-vmware restart
exit 0
- Jason Langone
Posted on Jul 11, 05:26 PM by Jason Langone
Commenting is closed for this article.

2007 Systems Architech.