Managing ESXi Without the VI Client – Part 1

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 no one else can see your terminal now, you can pick this as your password: “body-pave*town”.

Enter a 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 the 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

Leave a Comment

Your email address will not be published. Required fields are marked *