Banner
Banner
Banner
Banner
Banner

My Tweets

twitter_icon
ESXi 4.1 Kickstart Install - WIP | Print |  E-mail
Blog - Tech Blog
Tuesday, 03 August 2010 12:04

For the past two weeks I've been trying to get an ESXi 4.1 Kickstart script created. It's currently a work in progress (WIP), but I'm letting it rest for a little while. I've been testing this script out on an ESXi 4.1 VM w/ 10 NICs to try and simulate my current environment. My current environment resembles my vSphere Host NIC Design - 10 NICs post.

 

 

The bulk of the script is working. There are a few parts where it's not working and you are more than welcome to try it out. I started this project so I could atleast get myself familiar with kickstarting an installation and diving a bit deeper into the ESXi commands. I tried a bunch of different options out there from ESX 4.0 kick-scripts and alot of stuff has changed in the syntax. Keep that in mind if you are developing your own script.

 

Thanks to Justin Guidroz (@juicelsu009 , Geaux Virtual) for putting up with all my questions. Justin has hacked the EDA a bit for ESXi 4.1 and has customized some more cool scripts, but I'm sure we can all expect EDA to fully support 4.1 in the near future. That's a big reason why I'm putting all this work to rest. Also check out Setting up vSphere ESXi 4.1 Scripted Installation from @virtualkenneth.

 

 
rootpw changeme
install url http://192.168.187.66/ESXi
autopart --firstdisk --overwritevmfs
reboot
 
#Network install type
network --bootproto=static --addvmportgroup=false --device=vmnic0 --ip=192.168.50.13 --netmask=255.255.255.0 --gateway=192.168.50.1  --nameserver=192.168.3.2 --hostname=ESXi3.FQDN
 
accepteula
 
%firstboot --unsupported --interpreter=busybox
 
#Assign VLAN to Management PortGroup
esxcfg-vswitch -v 50 -p 'Management Network' vSwitch0
 
#Add vMotion Portgroup to vSwitch0
esxcfg-vswitch -A vMotion vSwitch0
 
#Add pNIC vmnic6 to vSwitch0
esxcfg-vswitch -L vmnic6 vSwitch0
 
#Assign ip address to vMotion vmk1
esxcfg-vmknic -a -i 192.168.51.12 -n 255.255.255.0 -p vMotion
 
#Assign VLAN to vMotion PortGroup
esxcfg-vswitch -v 51 -p vMotion vSwitch0
 
sleep 10
 
#set vMotion to vmk
vim-cmd hostsvc/vmotion/vnic_set vmk1
 
#Set NIC order policy for port groups
vim-cmd hostsvc/net/portgroup_set --nicorderpolicy-active=vmnic0 --nicorderpolicy-standby=vmnic6 vSwitch0 'Management Network'
 
vim-cmd hostsvc/net/portgroup_set --nicorderpolicy-active=vmnic6 --nicorderpolicy-standby=vmnic0 vSwitch0 vMotion
 
#Add new vSwitch for IP Storage
esxcfg-vswitch -a vSwitch_IP-SAN
 
#Set MTU to 9000 for jumbo frames on vSwitch
esxcfg-vswitch -m 9000 vSwitch_IP-SAN
 
#Add Portgroup to vSwitch_IP-SAN
esxcfg-vswitch -A NetApp_FAS2020a vSwitch_IP-SAN
 
#Assign IP address to vmknic
esxcfg-vmknic -a -i 192.168.52.12 -n 255.255.255.0 -m 9000 NetApp_FAS2020a
 
#Add NICs to new vSwitch
esxcfg-vswitch -L vmnic2 vSwitch_IP-SAN
 
#Add NICs to new vSwitch 
esxcfg-vswitch -L vmnic7 vSwitch_IP-SAN
 
vim-cmd hostsvc/net/refresh

sleep 10
 
#Change LoadBalance for Etherchannel - WORKS WHEN TYPED IN CLI BUT NOT WORKING IN SCRIPT FOR SOME REASON
vim-cmd hostsvc/net/vswitch_setpolicy -–nicteaming-policy=loadbalance_ip vSwitch_IP-SAN
 
#Add NFS datastores
esxcfg-nas -a -o 192.168.52.101 -s /FAS2020a_Node1_NFS_A FAS2020a_Node1_NFS_A
esxcfg-nas -a -o 192.168.52.101 -s /FAS2020a_Node1_NFS_B FAS2020a_Node1_NFS_B
esxcfg-nas -a -o 192.168.52.102 -s /FAS2020a_Node2_NFS_A FAS2020a_Node2_NFS_A
 
#Adding the FT Network
esxcfg-vswitch -a vSwitch_FT
esxcfg-vswitch -A Fault_Tolerance vSwitch_FT
esxcfg-vswitch -L vmnic4 vSwitch_FT
esxcfg-vswitch -L vmnic9 vSwitch_FT
 
esxcfg-vmknic -a -i 192.168.55.12 -n 255.255.255.0 -p Fault_Tolerance
 
vim-cmd hostsvc/net/portgroup_set --nicorderpolicy-active=vmnic4 --nicorderpolicy-standby=vmnic9 vSwitch_FT Fault_Tolerance
 
vim-cmd hostsvc/advopt/update FT.Vmknic string vmk3
 
vim-cmd hostsvc/net/refresh
 
#Set DNS
vim-cmd hostsvc/net/dns_set --ip-addresses=192.168.3.23,192.168.3.2
 
# Set NFS advanced Configuration Settings
esxcfg-advcfg -s 30 /Net/TcpipHeapSize
esxcfg-advcfg -s 120 /Net/TcpipHeapMax
esxcfg-advcfg -s 10 /NFS/HeartbeatMaxFailures
esxcfg-advcfg -s 12 /NFS/HeartbeatFrequency
esxcfg-advcfg -s 5 /NFS/HeartbeatTimeout
esxcfg-advcfg -s 64 /NFS/MaxVolumes
 
# NTP time config - NOT WORKING!!
echo "Configuring NTP"
echo restrict default kod nomodify notrap noquerynopeer > /etc/ntp.conf
echo restrict 127.0.0.1 >> /etc/ntp.conf
echo server 0.vmware.pool.ntp.org >> /etc/ntp.conf
echo server 2.vmware.pool.net.org >> /etc/ntp.conf
echo driftfile /var/lib/ntp/drift >> /etc/ntp.conf
/sbin/chkconfig –-level 345 ntpd on
/etc/init.d/ntpd start
 
#enable SSH TechSupportMode - shouldn't use this, was just a test
vim-cmd hostsvc/enable_remote_tsm
vim-cmd hostsvc/start_remote_tsm
 
vim-cmd hostsvc/net/refresh
 
#grep ^admins: /etc/group > /dev/null || groupadd admins
#useradd -g admins -c LocalESXAccount LocalESX
#echo mypassword | passwd --stdin LocalESX

Remember these have  to be edited in something like Notepad++

Attachments:
Download this file (ks.cfg)ks.cfg[ESXi 4.1 Kickstart]3 Kb03/08/10 13:04
Last Updated on Friday, 19 October 2012 16:18