how to map MAC address to Logical name
Hi all:
Is there any command to get the logical NIC name according to MAC address?
The 'ifconfig -a' command only list the network information for these plumbed network card.
But how to get the logical name for these unplumbed network cards if I know the MAC address?
Thanks a lots!
# 1
Well, in general you can't.
If theres no driver loaded, the system has no way to ask the card what its mac address is.
Of course, mac addresses are usually handed out in blocks to manufacturers.
I believe theres a table of them available somewhere.
So once you know the manufacturer, you have a pretty good chance of guessing the driver name.
prtdiag can usually show you what cards are installed. That gives you a pretty good chance of guessing the driver.
I presume your talking solaris x86 here, because the sparc driver all come preinstalled with the OS, so any card supported for a sparc should be autoloaded.
For x86, the HCL should list what driver is used for which cards.
# 2
Hello.
With "root" access the other way round (get MAC address of known network card name) is possible (eg. using a C program).
You might check all possible network cards (eg. "ce0", "ce1", ... "hme0", "hme1" ...) if they exist and if yes and they are not plumbed read out the MAC address.
Your problem seems to be that you simply do not know the device name of your network card?
If yes:
In this case the MAC address will not help you very much.
First I would try to do a "prtconf -v > output_file" to get information about all devices on the computer.
In the output_file I would try to find out if the card has been detected by the system and if there is a driver for this network card (if no, you'll have a problem !).
Then I would try to find the network card in the "/devices" directory. Each bus (e.g. PCI, ...) has a subdirectory there.
If I found the card there I would search for a symbolic link in "/dev" to the file that represents the network card in the "/devices" directory.
If the link is "/dev/hme0" the network card is "hme0".
Martin
# 3
Hi both, Thanks!
I have tried to use "prtconf -v > output_file" and search under /dev and /devices method. It couldn't find the unplumbing network name.
Is there any other suggestion?
And also I think I should describle more clear about my question.
I want to configure IPMP group automatically by scripts after OS (spac system)installed. For the script, only the MAC addresses(which network card is not unplumbed) are passed as parameter for IPMP group setting. You know for IPMP setting. it needs to written setting in /etc/hostname.<interfacename>.
So I need to map the MAC address(which is not unplumbed) to logical name(interface name).
how to do this?
I wonder for the "ifconfig -a" command:
When I use "ifconfig -a" command in Beign script, which is called before OS Jumpstart installation. It works to find out all network interface and MAC address.
See below script:
<<<<<<<<<<<<<<<<<<<< ;<<<<<<<<<<<<<<<<<<<
probe_interfaces()
{
SI_INT=`ifconfig -a|awk -F: '/^[^.lo.]/ && /^[a-zA-Z]/{print $1;}'`
SI_NUMINT=`ifconfig -a|awk -F: 'BEGIN{num=0;}/^[^.lo.]/ && /^[a-zA-Z]/{num++;}END{print num;}'`
export SI_INT
export SI_NUMINT
}
probe_ethers()
{
SI_ETHERS=`ifconfig -a|grep ether|awk ' { print $2 } '`
export SI_ETHERS
}
And the result of executing in Begin script , see below:
Ethernet interfaces detected:( I got all these interface name and MAC address)
bge0
bge1
bge2
bge3
ce0
ce1
MAC addresses:
0:3:ba:dd:de:4f
0:3:ba:dd:de:50
0:3:ba:dd:de:51
0:3:ba:dd:de:52
0:3:ba:d9:eb:f7
0:3:ba:d9:eb:f8
>>>>>>>>>>>>>>>>>>>> ;>>>>>>>>>>>>>>>>>>>> ;>
I only configure one network card on this OS. But after the OS installed, the "ifconfig -a" doesn't work to find all these network interface. It is only show the configured network interface.
I don't know why the behaviors of "ifconfig -a" command are different between before OS installed and after OS installed.
Thanks!
# 4
> I only configure one network card on this OS.
> But after the OS installed, the "ifconfig -a"
> doesn't work to find all these network interface. It
> is only show the configured network interface.
> I don't know why the behaviors of "ifconfig -a"
> command are different between before OS installed
> and after OS installed.
'ifconfig -a' doesn't normally plumb network connections. But the installer needs them plumbed to test. 'ifconfig -a plumb' will do that.
--
Darren
# 5
Thanks a lots for your help!The 'ifconfig -a plumb' command really work to plumb all the network card interface and return all the logical name and MAC address!