[Home] [Forum]

The purpose of this experiment was to see if ESXi could be managed without the VI client or the vCLI for that matter. Over the next 30 days I'll setup and manage an ESXi host without any client. The exception will be using a VNC client to connect to the remote console of any VMs that I'll create. Otherwise, all setup and management will be done at the console.

Setup and initial config

I'm using an Asus P5M2-SAS whitebox for this experiment with RAID1 array connected to the onboard LSI controller and an additional array on an Adapter 4800SAS. The initial install of ESXi 4.0 was done from a PXE server. SSH was then enabled to allow easy console access.

1) The first task to complete after the install was to change the password of the root login. This was done with the command /bin/passwd as shown below.

/bin # passwd --help
BusyBox v1.9.1-VMware-visor-654 (2008-12-17 10:01:32 PST) multi-call binary

Usage: passwd [OPTION] [name]

Change a user password. If no name is specified, changes the password for the current user.

Options:
-a Define which algorithm shall be used for the password
(choices: des, md5)
-d Delete the password for the specified user account
-l Locks (disables) the specified user account
-u Unlocks (re-enables) the specified user account

/bin # passwd
Changing password for root

You can now choose the new password or passphrase.

A valid password should be a mix of upper and lower case letters, digits, and other characters. You can use a 7 character long
password with characters from at least 3 of these 4 classes, or a 6 character long password containing characters from all the
classes. An upper case letter that begins the password and a digit that ends it do not count towards the number of character
classes used.

A passphrase should be of at least 3 words, 8 to 40 characters long, and contain enough different characters.

Alternatively, if noone else can see your terminal now, you can pick this as your password: "body-pave*town".

Enter new password:
Re-type new password:
passwd: password updated successfully
/bin #

2) The next task I wanted to perform was to change the IP address from a DHCP IP to a static IP. This is done with the command /sbin/esxcfg-vmknic as shown below.

/sbin # esxcfg-vmknic -l
Interface Port Group/DVPort IP Family IP Address Netmask Broadcast MAC Address MTU TSO MSS Enabled Type
vmk0 Management Network IPv4 192.168.1.54 255.255.255.0 192.168.1.255 00:1a:92:53:e6:3a 1500 65535 true DHCP


/sbin # esxcfg-vmknic -i 192.168.1.32 -n 255.255.255.0 "Management Network"
[2009-07-23 07:25:01 'NotifyDCUI' warning] Notifying the DCUI of configuration change
/sbin #

After that the next step was to change the hostname for the ESXi server. This was done by editing the file /etc/vmware/esx.conf. The line

/adv/Misc/HostName = "esx03.mishchenko.net"

was changed from localhost.mishchenko.net (the domain name had been picked up from DHCP). The last line was also added to /etc/hosts.

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
192.168.1.32 esx03.mishchenko.net esx03

Creating a Virtual Machine

The next step was to create a new VM. The following steps were taken.

1) Created the VM folder with mkdir /vmfs/volumes/datastore1/VirtualCenter

2) Created the virtual hard disk for the VM with the command - vmkfstools -c 15G -a lsilogic VirtualCenter.vmdk

3) Created a VMX file with the following text. The site http://sanbarrow.com/vmx.html is a great resource for looking up information on VMX files.

config.version = "8"
virtualHW.version= "7"
guestOS = "winnetenterprise-64"
memsize = "1024"
displayname = "VirtualCenter"
scsi0.present = "TRUE"
scsi0.virtualDev = "lsilogic"
scsi0:0.present = "TRUE"
scsi0:0.fileName = "VirtualCenter.vmdk"
ide1:0.present = "true"
ide1:0.deviceType = "cdrom-image"
ide1:0.filename = "/vmfs/volumes/4a68046d-2159a120-ebac-001a9253e68f/win2k3_x64.iso"
ide1:0.startConnected = "TRUE"
ethernet0.present= "true"
ethernet0.startConnected = "true"
ethernet0.virtualDev = "e1000"

4) Changed the permissions on the VMX file with chmod 744 VirtualCenter.vmx.

5) The VM was added to inventory with vim-cmd - vim-cmd solo/registervm /vmfs/volumes/datastore1/VirtualCe nter/VirtualCenter.vmx VirtualCenter. You can verify that the VM registered with the below command.

~ # vim-cmd vmsvc/getallvms
Vmid Name File Guest OS Version Annotation
16 VirtualCenter [datastore1] VirtualCenter/VirtualCenter.vmx winNetEnterprise64Guest vmx-07

The below lines were added to the VMX file when it was added to inventory.

scsi0:0.deviceType = "scsi-hardDisk"
floppy0.fileName = "/dev/fd0"
extendedConfigFile = "VirtualCenter.vmxf"
virtualHW.productCompatibility = "hosted"
tools.upgrade.policy = "manual"

6) The below lines were then added to the VMX file to enable VNC client access. Note that if you're doing this with ESX, you'll want to edit the firewall to open this port. With ESXi there is no firewall to change so you don't have to worry about that.

RemoteDisplay.vnc.enabled = "True"
RemoteDisplay.vnc.port = "5901"
RemoteDisplay.vnc.password = "secure"

7) The VM was then powered on and I connected with a VNC client (TightVNC). When connecting this way, the IP address of the ESXi host should be used as well as the port specified in the VMX file, so in this case I used esx03:5901. I was then prompted for the password listed in the VMX file. To power on the VM I used the second command below. The command requires the VM ID and this can be found using the first command.

~ # vim-cmd vmsvc/getallvms
Vmid Name File Guest OS Version Annotation
16 VirtualCenter [datastore1] VirtualCenter/VirtualCenter.vmx winNetEnterprise64Guest vmx-07
~ # vim-cmd vmsvc/power.on 16
Powering on VM:

8) Once the OS was setup, I used the below command to get the install of VMware Tools started. The instal of VMware Tools will significantly improve the performance of the mouse in the VNC remote control client.

vim-cmd vmsvc/tools.install 16

9) At this point I went to check IP connectivity and noticed the VM did not have an IP address. I verified this with vim-cmd below and it showed no IP address for the VM either.

~ # vim-cmd vmsvc/get.summary 16

guest = (vim.vm.Summary.GuestSummary) {
dynamicType = <unset>,
guestId = "winNetEnterprise64Guest",
guestFullName = "Microsoft Windows Server 2003, Enterprise Edition (64-bit)",
toolsStatus = "toolsOk",
toolsVersionStatus = "guestToolsCurrent",
toolsRunningStatus = "guestToolsRunning",
hostName = "atis-513a57ad92",
ipAddress = "0.0.0.0",
},

To fix this I took the following steps.
a) Edited the VMX file and added the below line.

ethernet0.networkName = "VM Network"

b) Reloaded the VMX file with vim-cmd

~ # vim-cmd vmsvc/reload 16

c) Verified that ESXi saw the configuration change made.

~ # vim-cmd vmsvc/device.getdevices 16 | less

(vim.vm.device.VirtualE1000) {
dynamicType = <unset>,
key = 4000,
deviceInfo = (vim.Description) {
dynamicType = <unset>,
label = "Network adapter 1",
summary = "VM Network",
},
backing = (vim.vm.device.VirtualEthernetCard.NetworkBackingInfo) {
dynamicType = <unset>,
deviceName = "VM Network",
useAutoDetect = false,
network = 'vim.Network:HaNetwork-VM Network',
inPassthroughMode = <unset>,
},
connectable = (vim.vm.device.VirtualDevice.ConnectInfo) {
dynamicType = <unset>,
startConnected = true,
allowGuestControl = true,
connected = false,
status = "unrecoverableError",
},
controllerKey = 100,
unitNumber = 7,
addressType = "generated",
macAddress = "00:0c:29:3a:03:2c",
wakeOnLanEnabled = true,
},

d) Set the virtual NIC to a status of connected. The device.connection option requires the VMID, the deviceKey and connect setting. Connect can be set to 1 (connected) or 0 (disconnected). The deviceKey can be found from the output device.getdevices. As shown above in bold, the deviceKey for the vnic for this VM is 4000. Once the command was run the vnic in the VM connected and was able to get an IP address from a DHCP server.

~ # vim-cmd vmsvc/device.connection
Insufficient arguments.
Usage: device.connection vmid deviceKey connect

Connect/Disconnect the virtual device specified

~ # vim-cmd vmsvc/device.connection 16 4000 1
~ #
~ # vim-cmd vmsvc/get.summary 16 | grep ipAddress
ipAddress = "192.168.1.56",

10) At this point the VM was up and running and the last thing to do was to disconnect the CD-ROM in the VM. Output from vim-cmd vmsvc/get.devices showed the following for the CD-ROM.

(vim.vm.device.VirtualCdrom) {
dynamicType = <unset>,
key = 3002,
deviceInfo = (vim.Description) {
dynamicType = <unset>,
label = "CD/DVD Drive 1",
summary = "ISO [datastore1] win2k3_x64.iso",
},
backing = (vim.vm.device.VirtualCdrom.IsoBackingInfo) {
dynamicType = <unset>,
fileName = "[datastore1] win2k3_x64.iso",
datastore = 'vim.Datastore:4a68046d-2159a120-ebac-001a9253e68f',
},
connectable = (vim.vm.device.VirtualDevice.ConnectInfo) {
dynamicType = <unset>,
startConnected = true,
allowGuestControl = true,
connected = true,
status = "ok",
},
controllerKey = 201,
unitNumber = 0,
},

To set the CD-ROM back to a type of client device and also to uncheck the "Connect at power on" option, I edited the VMX file and changed this -

ide1:0.present = "true"
ide1:0.deviceType = "cdrom-image"
ide1:0.filename = "/vmfs/volumes/4a68046d-2159a120-ebac-001a9253e68f/win2k3_x64.iso"
ide1:0.startConnected = "TRUE"

to this -

ide1:0.present = "true"
ide1:0.clientDevice = "TRUE"
ide1:0.deviceType = "atapi-cdrom"
ide1:0.startConnected = "FALSE"

The VM was then powered down, the VMX file was then reloaded and the device was disconnected.

~ # vim-cmd vmsvc/reload 16
~ #
~ # vim-cmd vmsvc/device.connection 16 3002 0
~ #

In the coming weeks I'll cover other task like host network and storage setup.

 

INSERT YOUR COMMENT - IF YOU HAVE A QUESTION PLEASE USE THE FORUM


Name (required)

Web Site (optional)

Email address (required - will not be displayed)

Comment (required)

Please enter code

 

Copyright © 2011 - Dave Mishchenko