How to map a PCIID to a MAC address

I’ve been beating my head against a wall for a few months now on how to do this. First the why.

I’ve been installing Vmware ESX server onto hardware with many Network Interface Cards (NIS’s). The guys that installed the server connected the network to a NIC and told me the MAC address (e.g. 11:22:33:44:55:66) and the IP address to use (e.g. 10.10.10.10). When I go to install the ESX software (3.0.2 and 3.5.0) then I’m presented with a list of network cards in the format x:x:x – yyy – Name of Card. After some searching it turns out that the x:x:x part is the PCIID in the format bus:slot.function, the yyy part is the driver VMWare will be using.

OK so it should be a simple matter to link the PCIID to the MAC address. I tried the ifconfig /a but that doesn’t show PICID. On the other side lspci -tv doesn’t show the MAC address. I didn’t get very far and to speed things up I picked a interface at random and assigned the IP address to it. Of course I picked the wrong one so I was not able to use the web interface to continue the configuration. The workaround is as follows:

  1. Start a ping to the IP address from a computer with an IP that is in the same range.
  2. Press Alt + F1 to get to the servers terminal. Not as easy as it sounds working from a Linux laptop as I kept getting my own PC’s console and not the remote one.
  3. Check you available nics:
    esxcfg-nics -l
  4. Check which is connected to service console switch (look at “Uplinks” of vSwitch0):
    esxcfg-vswitch -l
  5. Unlink actual vmnic from vSwitch0:
    esxcfg-vswitch -U vmnic0 vSwitch0
  6. link another nic to vSwitch0:
    esxcfg-vswitch -L vmnic1 vSwitch0
  7. If your ping from step 1 isn’t returned then repeat step 5 and 6 until the ping returns and you’ve found your NIC.
  8. Connect to the IP address using your browser and administer ESX server

The solution is a bit unscientific for my liking and finally I asked Dann Washko from the Linux Link Tech Show and he immediatly came up with the command lshw

http://ezix.org/project/wiki/HardwareLiSter
lshw (Hardware Lister) is a small tool to provide detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or EFI (IA-64) systems and on some PowerPC machines (PowerMac G4 is known to work).

This is an absolute gold mine of information and while the program isn’t included in ESX it is included on the System Rescue CD. So before setting up a ESX server, boot from the System Rescue CD and run lshw to make a note of the PCIID for the MAC address your admin network is connected into. The install ESX as normal.

PS:The following day I was pleasantly surprised to find that Dann had taken the time to write me a script that would parse the files that lshw uses (identified by the man lshw page) to produce a listing of PCIID to MAC address listing. Thanks Dann – Above and beyond.

This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published.