VMware vSphere - Scripted Installer for ESX Server - The Actual Config

PDF Print E-mail

The actual configuration

All the rest is pretty much standard ESX config stuff, and goes into the "MORE CONFIG..." section in the esx-post-script.sh file.  The main exception is that we now have access to the ESXID variables.

esxcfg
  1. # During auto-install a vSwitch0 is created, but I wanted a different naming
  2. echo "Deleting default vSwitch"
  3. esxcfg-vswif --del vswif0
  4. esxcfg-vswitch --del-pg='Service Console' vSwitch0
  5. esxcfg-vswitch --delete vSwitch0
  6. # Create the Service Console network
  7. echo "Creating new Service Console switch"
  8. esxcfg-vswitch --add VMwareSwitch
  9. esxcfg-vswitch --link=vmnic1 VMwareSwitch
  10. esxcfg-vswitch --link=vmnic3 VMwareSwitch
  11. esxcfg-vswitch --add-pg='Service Console' VMwareSwitch
  12. esxcfg-vswitch --add-pg="Service Console Management" VMwareSwitch
  13. esxcfg-vswif --add vswif0 --portgroup 'Service Console' --ip $ESXSCIP --netmask 255.255.0.0
  14. # Create the Storage network
  15. echo "Creating Storage vSwitch and port-groups"
  16. esxcfg-vswitch --add StorageSwitch
  17. esxcfg-vswitch --link=vmnic0 StorageSwitch
  18. esxcfg-vswitch --link=vmnic2 StorageSwitch
  19. esxcfg-vswitch --add-pg="Storage Management" StorageSwitch
  20. esxcfg-vswitch --add-pg="Storage" StorageSwitch
  21. # Create the Storage VM Kernel Port, and enable Jumbo frames on it
  22. esxcfg-vmknic -a -i $ESXSTORAGEIP -n 255.255.0.0 -m 9000 Storage
  23. esxcfg-vswitch -m 9000 StorageSwitch
  24. # Create the Production network
  25. echo "Creating Production vSwitch and port-groups"
  26. esxcfg-vswitch --add ProductionSwitch
  27. esxcfg-vswitch --link=vmnic4 ProductionSwitch
  28. esxcfg-vswitch --link=vmnic5 ProductionSwitch
  29. esxcfg-vswitch --link=vmnic6 ProductionSwitch
  30. esxcfg-vswitch --link=vmnic7 ProductionSwitch
  31. esxcfg-vswitch --add-pg="Production" ProductionSwitch
  32. esxcfg-vswitch --add-pg="DMZ" ProductionSwitch
  33. esxcfg-vswitch --add-pg="Testing" ProductionSwitch
  34. esxcfg-vswitch --vlan=40 --pg=DMZ ProductionSwitch
  35. esxcfg-vswitch --vlan=50 --pg=Production ProductionSwitch
  36. esxcfg-vswitch --vlan=60 --pg=Testing ProductionSwitch
  37. # Enable the Software iSCSI adapter
  38. # The adapter name given to the iSCSI HBA was changing sometimes, so
  39. I've
  40. # determined it from the esxcfg-swiscsi command's "scan" subcommand now.
  41. # (note that the inlined functions need to be escaped)
  42. echo "Adding iSCSI interfaces"
  43. esxcfg-swiscsi -e >> /tmp/post.log
  44. HBANAME=\`esxcfg-swiscsi -s | awk '{print \$2}' | sed 's/\.\.\.\$//'\`
  45. vmkiscsi-tool -D -a 10.10.10.10 \$HBANAME >> /tmp/post.log
  46. esxcfg-rescan \$HBANAME >> /tmp/post.log
  47. # Activate changes to reflect them into Virtual Center
  48. echo "Restarting the Management interface"
  49. service mgmt-vmware restart
  50. #Configure Firewall and startup services
  51. echo "Configuring firewall"
  52. chkconfig snmpd on
  53. esxcfg-firewall -e ntpClient
  54. esxcfg-firewall -e snmpd
  55. esxcfg-firewall -e sshClient
  56. esxcfg-firewall -e CIMSLP
  57. esxcfg-firewall -e VCB
  58. esxcfg-firewall -e swISCSIClient
  59. esxcfg-firewall -e CIMHttpsServer
  60. esxcfg-firewall -e vpxHeartbeats
  61. esxcfg-firewall -e sshServer
  62. esxcfg-firewall -e updateManager
  63. #Configure hosts files to prevent DNS failure
  64. echo "Configuring hosts file"
  65. echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts
  66. echo "10.20.30.1 esx-01.mydomain.vm.local esx-01" >> /etc/hosts
  67. echo "10.20.30.2 esx-02.mydomain.vm.local esx-02" >> /etc/hosts
  68. echo "10.20.30.3 esx-03.mydomain.vm.local esx-03" >> /etc/hosts
  69. echo "10.20.30.4 esx-04.mydomain.vm.local esx-04" >> /etc/hosts
  70. echo "10.20.10.1 vc-01.mydomain.com vc-01" >> /etc/hosts
 

 

The full scripts can be downloaded here.



Last Updated on Wednesday, 05 August 2009 12:53