May 042015
 

I’ve had some issues with some of my VMWare guests crashing for some odd reason.
The guests were my pfSense routers, so when they crashed, the house lost internet which was causing some issues as you could imagine!

Since I couldn’t work out why the guests kept crashing at first, I configured Zabbix to just reboot the virtual machines each time they went down so that the internet connectivity would be restored automatically. This meant that the emails that told me that my routers had crashed would actually be sent so that I would know that my internet had a hiccup, and for me to check to make sure any downloads I had running either finished properly, or that I had to redownload.

Zabbix has the ability to run remote commands on hosts via SSH, and my VMWare hosts had SSH enabled so I could run commands that I needed to reboot the hosts when the hosts went down.

Finding the VM

First thing I needed to do was to find the ID of the VM that I needed to reboot.
To get those, I needed to SSH onto my VM host and run the command vim-cmd vmsvc/getallvms | grep pfsense-2 which outputs this –
70 pfsense-2 [vmhost-500gb] pfsense-2/pfsense-2.vmx freebsd64Guest vmx-08 pfSense backup node
This command gave me the ID of 70 that I needed to use to reboot the VM from the command line.

Configuring the Zabbix Action

In order to run a command when a host went down, I created a new action to be run when a certain host goes down.
I used the following 3 conditions –
(A) Trigger value = PROBLEM
(B) Trigger = Template ICMP Ping: Template ICMP Ping is unavailable by ICMP
(C) Host = pfsense-2

This would make sure that the actions that run are only for the host that I have the ID for

In the Operations section of the action, I created a new step with the following settings –

Operation Type: Remote Command
Target : vmhost
Type : SSH
Username : root
Password : password
Port : 22
Commands : /bin/vim-cmd vmsvc/power.off 70 && /bin/vim-cmd vmsvc/power.on 70

The commands that I have used instructs VMWare to forcefully power off the VM with an ID of 70 – which in this case is my pfsense-2 guest, and then power it back on.

This was done on an ESX 5.1 host, but should work on anything newer as long as SSH is enabled.

Share
Jul 192013
 

So I’ve recently started dabbling in the fun world of virtalisation, and wanted to use my spare computer as a VMWare ESXi host.
Unfortunately, the NIC in it was unsupported, however the driver that supports the NIC was present in ESXi.
So, with a bit of trickery, I got the installation media recognising my nVidia NIC as a supported device.
This can theoretically be done with any NIC that is supported by the forcedeth driver.
Make sure that your NIC uses the same numbers as mine, otherwise you’ll need to change the numbers that you paste later in this post.
To check, run this command, and you should get something similar back.

# lspci -nn | grep -i ethernet
# 00:07.0 Bridge [0680]: NVIDIA Corporation MCP61 Ethernet [10de:03ef] (rev a2)

Those numbers in the square brackets at the end are the ones we need.

First thing I had to do was grab the VMWare iso, and mount it so I could copy all the files off.

# mkdir installfiles
# mount -o loop VMware-VMvisor-Installer-5.1.0.update01-1065491.x86_64.iso isofile
# cp -r isofile/* installfiles

Once all the files were copied off, we need to use the vmtar utility to modify the files.
The only way that I have found of getting the vmtar utility was to have esxi already installed, and copy vmtar from that.
Once I got the vmtar utility, I could modify the net_forc.v00 archive that contains the forcedeth driver details.

We’ll need to extract the files first

# vmtar -x net_forc.v00 -o net_forc.tar
# tar -xvf net_forc.tar

Once they’re extracted, you’ll see 2 directories, etc and usr.
In /usr/share/hwdata/driver.pciids.d/, there’s a file called forcedeth.ids
Open that up, and add this line, and save the file.

03ef nVidia NForce Network Controller

Next file is in etc/vmware/driver.map.d and called forcedeth.map
Modify that one by adding in this line, and save the file

regtype=linux,bus=pci,id=10de:03ef 0000:0000,driver=forcedeth,class=network

Once those 2 files are modified, package up the files again

# tar -cvf net_forc.tar *
# vmtar -c net_forc.tar -o net_forc.v00

Next step is to package it back up into an iso file.

# mkisofs -relaxed-filenames -J -R -o custom_esxi.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table /installfiles

This command will take all the files in installfiles and re-package them into an ISO.
Once that’s done, you should be able to boot off the ISO and use the MCP61 NIC on vmWare

Share