posted

3 Comments

One of the first operational "obstacles" that will need to be concurred for the migration to ESXi is a scripted installation. I wrote an article with an sample script two weeks ago, which is a good start. I asked around on twitter  on what kind of things people would like to see and I also I received some questions via email. I decided to document these as well and am hoping it will make your migration to ESXi easier. Some of these are fairly obvious, others aren't.

I have validated all of these, and during validation I noticed that William Lam had already documented some of them, it is worth checking out William's tips! (Also check out this one on enabling the management interface for vmk0.)

How can I define a second DNS server? (This needs to be part of the first section of the script.)

network –bootproto=static –device=vmnic0 –ip=10.0.0.51 –netmask=255.255.255.0 –gateway=10.0.0.250 –hostname=esxi001.localdomain –vlanid=0 –nameserver="10.0.0.1,10.0.0.2" –addvmportgroup=0

Can I enable TSM by default?

vim-cmd hostsvc/enable_local_tsm
vim-cmd hostsvc/start_local_tsm

And what about SSH (Remote TSM)?

vim-cmd hostsvc/enable_remote_tsm
vim-cmd hostsvc/start_remote_tsm

Please note that we don't recommend setting these to enabled by default, but as it was a question I received twice this week I wanted to make sure it what covered.

What about NTP? It is very simple and similar to how it was done with ESX classic:

echo restrict default kod nomodify notrap noquerynopeer > /etc/ntp.conf
echo restrict 127.0.0.1 >> /etc/ntp.conf
echo server 10.0.0.11 >> /etc/ntp.conf
echo server 10.0.0.12 >> /etc/ntp.conf
echo driftfile /var/lib/ntp/drift >> /etc/ntp.conf
/sbin/chkconfig –level 345 ntpd on
/etc/init.d/ntpd stop
/etc/init.d/ntpd start

Can I change the vSwitch load balancing mechanism?

vim-cmd /hostsvc/net/vswitch_setpolicy –nicteaming-policy='loadbalance_ip' vSwitch0

The default nic teaming policy is "loadbalance_srcid" (originating Virtual Port ID) the other two options are "loadbalance_ip" (IP-Hash) and "loadbalance_srcmac" (source MAC hash).

Can I rename my local datastore so that it includes my host name? Definitely something I would recommend:

vim-cmd hostsvc/datastore/rename datastore1 $(hostname -s)-datastore01

I have an iSCSI storage array, can configure the server for it? (We will create two vmkernels and set only 1 vmnic as active and remove the other on the portgroup.)

esxcfg-vswitch -a vSwitch1
esxcfg-vswitch -L vmnic1 vSwitch1
esxcfg-vswitch -L vmnic2 vSwitch1
esxcfg-vswitch -A iSCSI-01 vSwitch1

esxcfg-vswitch -A iSCSI-02 vSwitch1
esxcfg-vswitch -v 20 -p iSCSI-01 vSwitch1
esxcfg-vswitch -v 20 -p iSCSI-02 vSwitch1
esxcfg-vmknic -a -i 192.168.20.11 -n 255.255.255.0 iSCSI-01
esxcfg-vmknic -a -i 192.168.20.21 -n 255.255.255.0 iSCSI-02

esxcfg-swiscsi –e
vim-cmd hostsvc/net/portgroup_set –nicorderpolicy-active=vmnic1 vSwitch1 iSCSI-01
vim-cmd hostsvc/net/portgroup_set –nicorderpolicy-active=vmnic2 vSwitch1 iSCSI-02
esxcli swiscsi nic add -n vmk1 -d vmhba33
esxcli swiscsi nic add -n vmk2 -d vmhba33
vim-cmd hostsvc/storage/iscsi_add_send_target vmhba33 192.168.1.51

esxcfg-rescan vmhba33

[Update] Gert pointed out that the "vmhba" can be random and he is right. To be absolutely certain you could use a variable for vmhba by using the following line and replacing vmhba33 by $varvmhba:

varvmhba="$(esxcfg-scsidevs -a | grep iscsi | awk '{print $1}')"

Can I place the log-files on a different datastore? (In this example the datastore is called "vmfs01" and it uses the "hostname" as part of the directory structure.)

vim-cmd hostsvc/advopt/update Syslog.Local.DatastorePath string "[vmfs01] /$(hostname -s)/logfiles/messages"

These are just a couple of examples of how you can beef up your installation script and configure ESXi in such a way that it is ready to be added to vCenter and can be used straight away!

About the Author

Duncan Epping

Duncan is a Chief Technologist working in the Storage and Availability Business Unit at VMware, serving as a partner and truster adviser to EMEA customers. He is the co-author of several books, including the vSphere Clustering Deepdive series and Essential Virtual SAN. He is the owner and main author of virtualization blog yellow-bricks.com.