Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

How to get NIC Manufactorer on Unix

by boat73 (Scribe)
on May 19, 2005 at 14:08 UTC ( [id://458622]=perlquestion: print w/replies, xml ) Need Help??

boat73 has asked for the wisdom of the Perl Monks concerning the following question:

Does perl supply a mthod for getting the NIC manufacturer on Unix systems? I need to do it on SUN, AIX, HP, and Linux. I searched but as yet havn't found anything.Thanks in advance.

Replies are listed 'Best First'.
Re: How to get NIC Manufactorer on Unix
by gaal (Parson) on May 19, 2005 at 14:38 UTC
    Perl doesn't supply such a method built-in, but it's fairly easy to use the data supplied here to look up vendors by OUIs (the first 24 bits in the Ethernet MAC).

      Good pointer—I think the best option for programmatic use is probably brian_d_foy's Net::MAC::Vendor, which appears to be a platform-independent Perl interface to that data.



      If God had meant us to fly, he would *never* have given us the railroads.
          --Michael Flanders

Re: How to get NIC Manufactorer on Unix
by Zaxo (Archbishop) on May 19, 2005 at 14:35 UTC

    The /sbin/lspci utility is handy on Linux. I'm not sure how portable it is.

    my @nics = do { open my $pci, '-|', '/sbin/lspci' or die $!; grep { /Ethernet controller/ } <$pci>; }; # 00:08.0 Ethernet controller: 3Com Corporation 3c905B 100BaseTX [Cycl +one] (rev 30)

    After Compline,
    Zaxo

Re: How to get NIC Manufactorer on Unix
by hatter (Pilgrim) on May 19, 2005 at 14:55 UTC
    For systems which don't have lspci, or if you need to know which NIC refers to which eth0/le0/bge0/etc, ifconfig on some systems will give you the MAC. You may well have to try and range of places for different OSs though, I don't know any one source.


    the hatter
Re: How to get NIC Manufactorer on Unix
by davis (Vicar) on May 19, 2005 at 15:10 UTC
    On HP-UX systems the nic manufacturer will be HP. They might use a different chipset, but it should always be OEMed by HP. If you really want to go nuts, you could try parsing the output of the lanadmin command. I've really got to ask though, why would you want to do this? It sounds like a Bad Idea.

    davis
    Kids, you tried your hardest, and you failed miserably. The lesson is: Never try.
Re: How to get NIC Manufactorer on Unix
by naChoZ (Curate) on May 19, 2005 at 15:40 UTC

    In Solaris, I believe (don't have immediate access to a Sun box just now) it displays mfg info with prtdiag. /usr/platform/sun4u/sbin/prtdiag -v

    --
    naChoZ

    Where in the nursery rhyme does it say Humpty Dumpty is an egg?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://458622]
Approved by Joost
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-25 15:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found