Skip to content

Instantly share code, notes, and snippets.

@bot11
Created June 1, 2015 10:12
Show Gist options
  • Star 20 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save bot11/a34ff0008cae75bd662d to your computer and use it in GitHub Desktop.
Save bot11/a34ff0008cae75bd662d to your computer and use it in GitHub Desktop.
IPMI simulator
This document describes about installation and configuration of IPMI simulator.
We need: qemu-kvm, OpenIPMI, OpenIPMI-tools
1) Install the qemu-kvm. We need the qemu, which have the IPMI pacthes.
Use the source https://github.com/cminyard/qemu/tree/stable-2.2-ipmi
./configure, make and make install
2) Download the OpenIPMI libraries, from http://sourceforge.net/projects/openipmi/
Follow the process documented in lanserv/README.vm
./configure --prefix=/opt/openipmi/usr --sysconfdir=/opt/openipmi/etc \
--with-perlinstall=/opt/openipmi/usr/lib/perl \
--with-pythoninstall=/opt/openipmi/usr/lib/python
make and make install.
If you got the following errors while compiling:
1)/usr/bin/ld: cannot find -lOpenIPMIutils
export CC="gcc -lrt" and reconfigure.
3) Configure the IPMI siulator:
Create a qemu disk to use:
qemu-img create -f qcow2 -o size=1G /opt/KVM/disk1.qcow2
We need kernel images, download one from : wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-i386-kernel
edit the /opt/openipmi/etc/ipmi/lan.conf
change the startcmd, use the qemu compiled.
/usr/local/bin/qemu-system-x86_64 --enable-kvm -drive file=/opt/KVM/Test4sda -nographic -net nic,model=e1000,macaddr=52:54:00:12:34:59 -net user,hostfwd=tcp::5556-10.0.2.15:22 -chardev socket,id=ipmi0,host=localhost,port=9011,reconnect=10 -device isa-ipmi,chardev=ipmi0,interface=bt,irq=5 -serial mon:tcp::9012,server,telnet,nowait
/usr/local/bin/qemu-system-x86_64 --enable-kvm -drive file=/opt/KVM/disk1.qcow2,format=qcow2 -nographic -net nic,model=e1000,macaddr=52:54:00:12:34:59 -net user,hostfwd=tcp::5555-10.0.2.15:22 -chardev socket,id=ipmi0,host=localhost,port=9002,reconnect=10 -device isa-ipmi,chardev=ipmi0,interface=bt,irq=5 -serial mon:tcp::9003,server,telnet,nowait -kernel /opt/cirros-0.3.4-i386-kernel --append 'root=/dev/hda console=ttyS0,115200'
Serial console is configured to /dev/ttyUSB0 in the lan.conf file, Find if your serial console is configured as such (or) change.
I changed my serial console as
sol "/dev/ttyS0" 38400 history=4000 historyfru=10
4) Run IPMI_SIM
/opt/openipmi/usr/bin/ipmi_sim
5) Connect to the simulator using ipmitool as below:
ipmitool -I lanplus -H localhost -p 9011 -U cirros power status
@TuranTimur
Copy link

hey I've compiled https://github.com/cminyard/qemu/tree/stable-2.4-ipmi

everything is good but somehow it give me error ''isa-ipmi' is not a valid device model name' . any idea?

/usr/local/bin/qemu-system-x86_64 --enable-kvm -drive file=/home/stack/vm/ipmi-qemu/disks/disk1.qcow2,format=qcow2 -nographic -net nic,model=e1000,macaddr=52:54:00:12:34:59 -net user,hostfwd=tcp::5555-10.0.2.15:22 -chardev socket,id=ipmi0,host=localhost,port=9002,reconnect=10 -device isa-ipmi,chardev=ipmi0,interface=bt,irq=5 -serial mon:tcp::9003,server,telnet,nowait -kernel /home/stack/vm/ipmi-qemu/disks/cirros-0.3.4-i386-kernel --append 'root=/dev/hda console=ttyS0,115200'

qemu-system-x86_64: -device isa-ipmi,chardev=ipmi0,interface=bt,irq=5: 'isa-ipmi' is not a valid device model name

@dreyTee
Copy link

dreyTee commented Jan 10, 2017

donghwicha, I ran into same issue and managed to fix it by changing startcmd row to this:
startcmd "/usr/local/bin/qemu-system-x86_64 --enable-kvm -nographic -net nic,model=e1000,macaddr=52:54:00:12:34:59 -chardev socket,id=ipmi0,host=localhost,port=9002,reconnect=10 -device ipmi-bmc-extern,id=bmc0,chardev=ipmi0 -device isa-ipmi-bt,bmc=bmc0 -serial mon:tcp::9003,server,telnet,nowait -kernel /usr/src/cirros-0.3.4-i386-kernel --append 'root=/dev/sda console=ttyS0,115200'"
Right - no disk needed and no port forwarding even!

Also connect with ipmitool should be made to UDP port 9001 and not TCP 9011:
ipmitool -I lan -H 127.0.0.1 -p 9001 -U admin -P test power status

One more thing: ipmi sim gave me error about file absence every second:
Error getting sensor value (30,0,1): No such file or directory, Unable to open sensor file
So I opened /opt/openipmi/etc/ipmi/ipmisim1.emu file and replaced
sensor_add 0x30 0 1 0x01 0x01 poll 1000 file "/tmp/file1.ipm"
with
sensor_add 0x30 0 1 35 0x6f event-only
and error is gone now.

Spent few hours fixing problems after using this howto. Hope this will help someone.

@fatalfeel
Copy link

@max0604
Copy link

max0604 commented Aug 26, 2020

What password for this VM?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment