IBM Support

Determining the NIC MAC address using lshal

Question & Answer


Question

How do I determine my NIC MAC address?

Answer

When modifying your NIC interfaces, that is, when creating bonds, you need to know the MAC address of the interface. Some tools (ifup and ifdown) confirm if the MAC addresses match before performing their respective tasks. If they are mismatched, then the operation will fail.

lshal is a utility that searches through the hardware database.  Use it to get the MAC address of the interface. The syntax differs depending on the version of Red Hat. For this example, we will check the MAC addresses for eth0 and eth1:

RHEL 4:

# lshal --monitor | grep -B 2 -F "net.address"
lshal version 0.4.2
  net.interface = 'eth0'  (string)
  net.linux.driver = 'tg3'  (string)
  net.address = '00:10:18:2d:7e:8f'  (string)
--
  net.interface = 'eth1'  (string)
  net.linux.driver = 'tg3'  (string)
  net.address = '00:1a:a0:1a:3e:55'  (string)



RHEL 5:
# lshal -l | grep -A 1 -F "net.address"
  net.address = '00:10:18:2d:7e:8f'  (string)
  net.interface = 'eth0'  (string)
--
  net.address = '00:1a:a0:1a:3e:55'  (string)
  net.interface = 'eth1'  (string)



The RHEL 5 output for the eth0 interface shows a MAC address of 00:10:18:2d:7e:8f.  Next, run the following command to confirm this MAC address in the ifcfg file:


# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Broadcom Corporation NetXtreme BCM5721 Gigabit Ethernet PCI Express
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
DHCP_HOSTNAME=nps_server
HWADDR= 00:10:18:2d:7e:8f
NETMASK=255.255.0.0
IPADDR=10.0.0.1
USERCTL=no
IPV6INIT=no
PEERDNS=yes
TYPE=Ethernet
ETHTOOL_OPTS="speed 1000 duplex full autoneg on"


In this example, the MAC addresses match. You would then run a similar command to check the MAC address for eth1.

[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":null,"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

NZ167401

Document Information

Modified date:
17 October 2019

UID

swg21571980