Working with VLANs in Linux

I was recently working with a Dell PowerEdge M610 blade server that had a processor problem. During troubleshooting steps, Dell requested a DSET report from my ESXi host. I knew this wouldn’t be a problem as I could use the live boot CD (described here).

After I booted the live CD I was able to run the requested DSET report. However, once I had the report I needed network connectivity to get it out of the live CD environment. The problem is that my network adapters only have 802.1Q VLAN tagged interfaces. To access the network I needed to specify the VLAN ID. This is a very common configuration for ESX/ESXi hosts, but I wasn’t sure how to make it work in the live CD Linux. This wouldn’t be a very complicated configuration for a Linux guy, but as a Windows admin it took me a few minutes to figure out. After some googling, I came up with the following:

vconfig add eth0 55
ifconfig eth0.55 10.55.0.20 netmask 255.255.255.0 broadcast 10.55.0.255 up
route add default gw 10.55.0.1 eth0.55

(Assuming that my interface is eth0, the VLAN ID is 55, the subnet is 10.55.0.0/24, I wish to assign the address 10.55.0.20 and the default gateway is 10.55.0.1)

Posted in Virtualization | 2 Comments

Enabling the root user on vMA 4.1

While using the vMA 4.1 as vi-admin, I noticed that a couple commands I tried to run (for example yum update) would fail because I was not root. When I tried to issue ‘su’ I could not become root either. I found the following article virtuallyGhetto VMware Scripts & Resources with instructions on how to enable the root account.

sudo vi /etc/passwd

When prompted for a password I entered the vi-admin password. As suggested I changed the entry for

root:x:0:0:root:/root:/sbin/nologin

to look like

root:x:0:0:root:/root:/bin/bash

However, after enabling the account I still could not login — using root and the vi-admin password. I then logged back in as vi-admin and entered

sudo passwd root

And defined a password for the root account. I am now able to login as root with my root password.

Posted in Virtualization | 2 Comments

Update to Enabling vSwitch CDP (vMA 4.1)

In a previous article Enabling vSwitch Cisco Discovery Protocol (CDP) I discussed enabling CDP on a standard vSwitch using vMA. Today I deployed the vMA 4.1 and started configuring an ESXi 4.1 host — only to find out that vifpinit had been deprecated in 4.1. Here is a slightly updated post that will do the same thing using the newer vifptarget command:

sudo vifp addserver esxhostname.domain.name --username "root" --password "MyAdminPassword01"
vifptarget --set esxhostname.domain.name
vicfg-vswitch -B both vSwitch0
vicfg-vswitch -b vSwitch0

I had a handful of hosts to configure and was able to paste the above block of code into vMA (using SSH) and configure all of them rather quickly.

Posted in Virtualization | 1 Comment

ESXiBackup Folder Cleanup

In an earlier post Directory partition has not been backed up [DC=virtualcenter,DC=vmware,DC=int] I suggested a method to backup the VMwareVCMSDS ADAM database. As Joern posted in a comment, this solution could fill up your D: drive. The following code should help cleanup the ESXiBackup folder and only keep one month worth of history. You can append this to the previous script or schedule it as a separate task.

[cc lang=”powershell”]
$vcenter = “vcenter.host.name” #This variable may already be defined if you append the previous script.
#http://technet.microsoft.com/en-us/library/ee176988.aspx
foreach ($i in Get-ChildItem D:\ESXiBackup\$vcenter)
{
if ($i.CreationTime -lt ($(Get-Date).AddMonths(-1)))
{
Remove-Item $i.FullName -recurse -force -confirm:$false -whatif
}
}
[/cc]

You’ll want to remove the “-whatif” once you see that the above script is what you want to do ๐Ÿ™‚

Posted in Scripting, Virtualization | 1 Comment

Directory partition has not been backed up [DC=virtualcenter,DC=vmware,DC=int]

With the help of Alan Renouf’s vCheck (Daily Report) script I recently started noticing an error in my Windows event log on a vCenter server.

This directory partition has not been backed up since at least the following number of days. Directory partition: DC=virtualcenter,DC=vmware,DC=int 'Backup latency interval' (days): 90 It is recommended that you take a backup as often as possible to recover from accidental loss of data. However if you haven't taken a backup since at least the 'backup latency interval' number of days, this message will be logged every day until a backup is taken. You can take a backup of any replica that holds this partition. By default the 'Backup latency interval' is set to half the 'Tombstone Lifetime Interval'. If you want to change the default 'Backup latency interval', you could do so by adding the following registry key. 'Backup latency interval' (days) registry key: System\CurrentControlSet\Services\NTDS\Parameters\Backup Latency Threshold (days)

This error only occurred in one of the three vCenter instances I manage. After checking with my enterprise backup team and confirming this server does get backed up on a regular basis I opened an support request (SR) with VMware Tech Support. Two weeks later VMware technical support finally contacted me about my SR. The response: since the error occurs as part of the ADAM/LDAP instance that comes with the underlying operating system please contact your Operating System vendor for support. After waiting as long as I did for an initial response I had higher hopes for an actual solution.

I started Google-ing for solutions on backing up the ADAM/ADLDS instance on my own. I found an excellent article on how to do this in powershell at http://www.open-a-socket.com/index.php/2009/04/21/schedule-backups-of-your-ad-lds-instance-using-dsdbutil-2/. Here is the actual script that I now run as a scheduled task:

[cc lang=”powershell”]
$vcenter = “vcenter.host.name”
$date = Get-Date -Format yyyy-MM-dd
$backpath = โ€œD:\ESXiBackup\$vcenter\$date\โ€

#Create a backup of the ADAM Instance VMwareVCMSDS
#http://www.open-a-socket.com/index.php/2009/04/21/schedule-backups-of-your-ad-lds-instance-using-dsdbutil-2/
md “$backpath#VMwareVCMSDS”
$cmd = $env:SystemRoot + โ€œ\system32\dsdbutil.exe `โ€ac i VMwareVCMSDS`โ€ ifm `โ€create full $backpath\#VMwareVCMSDS`โ€ q qโ€
Invoke-Expression $cmd
[/cc]

Now that I have my own VCMSDS backup — and no errors in the event log — I can sleep better at night.

Posted in Scripting, Virtualization | 2 Comments