Find all HP ILO interfaces on a subnet in Linux

By default, HP’s ILO interfaces are set to DHCP.
Yes you could go into your router to see which DHCP lease it got, but here is a much more easy solution that you can use anywhere, even though you don’t have access to the router/DHCP server.

Requirements

You don’t need much. What you need on your Linux computer for this to work is:

  • sudo (You only need this if you are not logged in as root)
  • nmap

Finding ILO interfaces on a subnet

The script that does all the magic

Here is the script that finds all ILO interfaces on a subnet.

function ilo_list() {
	if [ -z $@ ]; then
		echo "ilo_list <subnet>"
		echo "example: ilo_list 192.168.1.0/24"
	else
		sudo nmap -n -P0 -sS -p 17988 -oG - $@ | fgrep /open/ | awk '{print $2}'
	fi
}

How to install the ILO interface listing script

There are multiple ways to use this.

  1. If you use Bash, you can put it your ~/.bash_aliases file to make it accessible in every terminal.
  2. If you don’t use bash, you can put it into a .sh script and execute that directly. If you those this method, remove the first and last line of the script.

Usage

One the script is in you bash_aliases file, you can simply open a new terminal and type the following

ilo_list <your subnet>

example:

ilo_list 192.168.1.0/24

It works the same way if you saved the script in a .sh file, but replace ilo_list with your file name.

It will ask for the password to sudo. Nmap needs this to do the OS fingerprint scan. If you run it as root, you will not get prompted for a password.

This has saved me a lot of time over the last few months, so I though I should share it here to make my fellow sysadmins happy!
Feel free to leave a comment if you have any improvements to the scripts.

Leave a Reply

Your email address will not be published.