Posts Tagged ‘Vmware’

When trying to join a vcenter to domain I was given the following error in the GUI

“The format of the specified computer name is invalid”

Turns out you can join the computer using a CLI , 

Putty into the VCenter and run

shell.set --enabled true

go to

/opt/likewise/bin/domainjoin-cli join domain.com Domain_Administrator Password

I was then showed this : 

the hostname may not be ‘linux’ or ‘localhost’

Turn out the Vcenter DNS had been set to localhost.localdom ( due to it being added using an IP ) which it didn’t like. Changing the host name to the correct one fixed this

 

VN:F [1.9.22_1171]
Rating: 9.9/10 (7 votes cast)
VN:F [1.9.22_1171]
Rating: +3 (from 3 votes)

Recently after rebooting a VMWare server , the VCenter Server service would not start  

The description for Event ID 1000 from source VMware VirtualCenter Server cannot 

C:\ProgramData\VMware\VMware Virtual Center\Logs. Look at the vpxd.log

<YYYY-MM-DD>T<TIME> 02128 error ‘App’] [VpxdReverseProxy] Failed to create http proxy: An attempt was made to access a socket in a way forbidden by its access permissions.

Checked NetStat and something was running on port 80. Looks like IIS had been installed with default settings which puts default site on port 80. Changed this to another port , reboot IIS and this fixed the issue

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

vmware_view_pilot-5132020[1]This will only work once a host has been added to Vcenter.

Use Vmware CLI to run this with the variables in Square Brackets edited out

This will change from Multipath to Round Robin

Connect-VIServer [VCENTER-SERVER-ADDRESS]
 
$hostview = Get-View -Viewtype HostSystem  –filter @{“Name”=[Fully qualified name of server]}
$storageSystem = Get-View $hostview.ConfigManager.StorageSystem 
$policy = new-object VMware.Vim.HostMultipathInfoLogicalUnitPolicy
#$policy.policy = "VMW_PSP_MRU" 
$policy.policy = "VMW_PSP_RR"
$storageSystem.StorageDeviceInfo.MultipathInfo.lun | foreach { $storageSystem.SetMultipathLunPolicy($_.ID, $policy) }
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Create a Bootable VMware install as usual on USB Memory Stick

Dump the below into a file called ks.cfg ( Change the value in the square brakets before and put it on the root of the usb with overwriting the isolinux.cfg with the one below , change the menu options for your enviroment

ks.cfg

# +-----------------------------------+
# | Begin default install    |
# +-----------------------------------+
# VMWare License options accepting EULA
vmaccepteula
# Partitioning
clearpart --firstdisk=hpsa --overwritevmfs
install --firstdisk=hpsa --overwritevmfs
 
# root Password encrypted ( use openssl passwd -1 to generate)
rootpw --iscrypted [ENCRYTPEDPASSWORD\
 
# Network install type
network --device=vmnic0 --bootproto=DHCP
%post --interpreter=busybox
Echo Installing ESXi
#Reboot after copying image to disk
reboot
%firstboot --interpreter=busybox
 
# Set the serial number for ESXi (please change it) 
serialnum --esx=[SERIAL NUMBER ]
 
# +---------------------------------------------------------------------------+
# | Creating Networks                            |
# +---------------------------------------------------------------------------+
 
# Remove vSwitch0
sleep 30
esxcli network ip interface remove -i vmk0
esxcli network vswitch standard portgroup remove -p 'Management Network' -v vSwitch0
esxcli network vswitch standard remove -v vSwitch0
 
# Create management switch
esxcli network vswitch standard add --vswitch-name vSwitch1
# Add nics
esxcli network vswitch standard uplink add --uplink-name vmnic0 --vswitch-name vSwitch1
esxcli network vswitch standard uplink add --uplink-name vmnic1 --vswitch-name vSwitch1
esxcli network vswitch standard uplink add --uplink-name vmnic2 --vswitch-name vSwitch1
 
# Add Port Groups  
 
esxcli network vswitch standard portgroup add --portgroup-name "Management Network" --vswitch-name vSwitch1  
esxcli network vswitch standard portgroup set --portgroup-name "Management Network" --vlan-id 4  
 
esxcli network vswitch standard portgroup add --portgroup-name "Server Network" --vswitch-name vSwitch1  
 
# Configure vmkNIC
esxcli network ip interface add -i vmk0 -p 'vMotion Network'
# Set IP Settings [HOSTIP] is dynamic resolved from the template
esxcli network ip interface ipv4 set --interface-name=vmk0 --ipv4=[HOSTIP] -N 255.255.255.0 -t static
# Set default gateway
esxcfg-route -a default [HOSTGW]
# Put management nics to active
esxcli network vswitch standard policy failover set --active-uplinks vmnic0 --vswitch-name vSwitch1
esxcli network vswitch standard policy failover set --active-uplinks vmnic1 --vswitch-name vSwitch1
esxcli network vswitch standard policy failover set --active-uplinks vmnic2 --vswitch-name vSwitch1
 
echo Create VMotion and Mangement network
# +---------------------------------------------------------------------+
# | Creating vMotion and Mangement Network                                        |
# +---------------------------------------------------------------------+
 
# Create vMotion vSwitch
esxcli network vswitch standard add --vswitch-name vSwitch0
# Add nics
esxcli network vswitch standard uplink add --uplink-name vmnic3 --vswitch-name vSwitch0
# Add portgroups
esxcli network vswitch standard portgroup add --portgroup-name vMotionNetwork --vswitch-name vSwitch0
 
# Configure vmkNIC
esxcli network ip interface add -i vmk1 -p 'vMotionNetwork'
esxcli network ip interface ipv4 set --interface-name=vmk1 --ipv4=[VMOTIONIP] --netmask=255.255.255.0 --type=static
 
# +---------------------------------------------------------------------------+
# | enable VMotion                                          |
# +---------------------------------------------------------------------------+
vim-cmd hostsvc/vmotion/vnic_set vmk3
vim-cmd internalsvc/refresh_network
 
# Set DNS and hostname
esxcli system hostname set --fqdn=[HOSTNAME]
esxcli network ip dns server add --server=[DNS1]
esxcli network ip dns server add --server=[DNS2]
#echo add DNS configuration
echo search cotton-on.local  > /etc/resolv.conf
echo nameserver 10.0.0.8  >> /etc/resolv.conf
echo nameserver 10.0.0.5 >> /etc/resolv.conf
 
echo Configure NTP
# +--------------------------------------------------------------------+
# | Add NTP Settings                                                   |
# +--------------------------------------------------------------------+
# Backup
mv /etc/ntp.conf /etc/ntp.conf.bak
# ntp.conf creation
cat > /etc/ntp.conf << __NTP_CONFIG__
restrict default kod nomodify notrap noquerynopeer
restrict 127.0.0.1
server au.pool.ntp.org
__NTP_CONFIG__
/sbin/chkconfig --level 345 ntpd on
echo "driftfile /etc/ntp.drift" >> /etc/ntp.conf
 
echo Configure Syslog
# +--------------------------------------------------------------------+
# | Add syslog confiuration to ESX host                                   |
# +--------------------------------------------------------------------+
# No Remote Syslog server
# vim-cmd hostsvc/advopt/update Syslog.Remote.Hostname string telesto
#vim-cmd hostsvc/advopt/update Syslog.Local.DatastorePath string "[datastore] /logfiles/$(hostname -s).log"
 
#Disable MOB
vim-cmd proxysvc/remove_service "/mob" "httpsWithRedirect"
# +--------------------------------------------------------------------+
# | SNMP Trap                                                            |
# +--------------------------------------------------------------------+
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><config><snmpSettings><enable>true</enable><syscontact></syscontact><syslocation></syslocation><EnvEventSource>indications</EnvEventSource><communities></communities><port>161</port><targets>[SNMPIP]@161 [SNMPTRAP]</targets><loglevel>info</loglevel><authProtocol></authProtocol><privProtocol></privProtocol></snmpSettings></config>" > /etc/vmware/snmp.xml
 
echo Rename local datastore
# +---------------------------------------------------------------------------+
# | Rename local datastore if --novmfsondisk is not used                      |
# +---------------------------------------------------------------------------+
vim-cmd hostsvc/datastore/rename datastore1 "local-[hostname]"
 
 
# backup ESXi configuration to persist changes
/sbin/auto-backup.sh
 
#enter maintenance mode
esxcli system maintenanceMode set -e true
 
# Needed for configuration changes that could not be performed in esxcli
esxcli system shutdown reboot -d 60 -r "Rebooting after host configurations"

 

isolinux.cfg

DEFAULT menu.c32
MENU TITLE ESXi Boot menu
NOHALT 1
PROMPT 0
TIMEOUT 300
 
LABEL install 
 KERNEL mboot.c32 
 APPEND -c boot.cfg 
 MENU LABEL ^ESXi Setup Interactively install
 
Label ESXi USB install scripted 
 KERNEL mboot.c32 
 APPEND -c boot.cfg ks=usb:/ks.cfg
 MENU LABEL ^USB install Scripted install 
 IPAPPEND 1
 
Label ESXi NFS install scripted 
 KERNEL mboot.c32 
 APPEND -c boot.cfg ks=nfs:uncpath/of/share/ks.cfg
 MENU LABEL ^NFS Scripted install 
 IPAPPEND 1
 
Label ESXi http install scripted 
 KERNEL mboot.c32 
 APPEND -c boot.cfg ks=http://www.website.com/ks.cfg
 MENU LABEL ^HTTP Scripted install 
 IPAPPEND 1
 
LABEL hddboot 
 LOCALBOOT 0x80 
 MENU LABEL ^Boot from local disk

 

 

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Uncorrectable Machine Check Exception (Board 0, Processor 1, APIC ID 0x00000001, Bank 0x00000005, Status 0xB2000000’00800400, Address 0x00000000’00000000, Misc 0x00000000’00000000)

Server reboots randomly and the above is displayed in the iLO.

 

This is an HP Problem , to into the Bios and change HP Power Profile to Maximum Performance

VN:F [1.9.22_1171]
Rating: 2.0/10 (2 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

vmware_view_pilot-5132020[1]Recently spun up a new Windows 7 virtual machine on an ESX cluster. After installing VMware Tools and rebooting the machine , the NIC card would stay unconnected. You would tick the connected box , restart the machine and the Tick would untick.

The default port limit on a vSwitch if you don’t use VLAN’s to segment traffic is 120. So when you hit this limit the above happens. I increased the port limit on each host to double. The VSphere client says you need to reboot the host to apply this , but I just vMotioned the machines from one to another which seemed to fix the problem.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

clip_image0024[1]When provisioning a new VMware host important things to configure

1) NTP Server
2) IP of Management with DNS Name
3) Portgroup Names
4) Syslog Server
5) SNMP Trap for monitoring
6) Renaming Local Datastore to something with the server name other than datastore1
7) Nic Teaming

Another thing that is also important to setup is the pass selection policy. Depending on the SAN Manufacturer they will tell you the recommended policy e.g. https://vstorage.wordpress.com/2013/03/28/optimising-vsphere-path-selection-for-nimble-storage/

1) Fixed
2) Round Robin
3) Recently used

Most of the time it will be Round Robin

This can be changed via Command Line

esxcli storage nmp satp set -s VMW_SATP_ALUA -P VMW_PSP_RR

or through the VMWare Client

Go to Configuration Tab on Host , go to Storage , Go to Properties of Datastore and click Manage Paths

When changed make sure no VM’s are on the host as this could disrupt them

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
New-VIProperty -Name ToolsVersion -ObjectType VirtualMachine -ValueFromExtensionProperty 'Config.tools.ToolsVersion' -Force
 
New-VIProperty -Name ToolsVersionStatus -ObjectType VirtualMachine -ValueFromExtensionProperty 'Guest.ToolsVersionStatus' -Force
 
Get-VM | Select Name, Version, ToolsVersion, ToolsVersionStatus | Export-Csv -NoTypeInformation -UseCulture -Path C:\VMHWandToolsInfo.csv
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

When your LUN useage shows useage that does not match your datastore useage you will need to perform a reclaim on the lun. Remember the LUN will need to be Thin provisioned with Space Reservation Disabled on a NetApp. To check you LUN is supported , login to an ESX Host and run

esxcli storage core device vaai status get

On the volume it need to have :

Delete Status: supported

Recalim can be done manually using the putty commands on a VMWare host attached to the datastore

 

cd /vmfs/volumes/datastorename/
 
vmkfstools -y %percenttoclear%

 

It is recommended that the %percenttoclear% increases from say 10% up to 80% in 10% Blocks

There’s a nice script here : https://kallesplayground.wordpress.com/2014/04/03/storage-reclamation-part1/ to automate the increase

****WARNING**** Do only one reclaim at a time , and it sharpley increases the IOP’s on the San to best to do out of hours

We had to do a few of these out of hours at around 3am , I actually automated this as a scheduled task using putty’s plink.exe which meants it ran in the very early hours of the morning! I couldn’t use the Kallesplaygroup .sh script as this didn’t work sending from plink , the script would have to be on the local esx box which it’s practical to to the multiple hosts our current cluster runs

FYI you will see you have to manually enter the password. A more recommended solution would be to use certificate authentication with putty

https://www.virten.net/2014/02/howto-esxi-ssh-public-key-authentication/

 

plink.exe %esxboxwithsshenabled% -ssh -batch -l root -pw %rootpasswordofesxbox% -m C:\Scripts\filewithabovelinesin.sh > c:\log.txt

 

**** Update in 5.5 this has changed to 

storage vmfs unmap -l Datastore name -n unit

 

 

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)