Get info on network interface

Hello everybody,

How can link network interface to the output of lspci -vv. Basicly i need to know who is the manufacturer of a specific interface, for example eth0 {Is it an Intel, or Broadcome, or something else}. Is there a way to find that out?

Thanx

Get you NIC MAC address using either ifconfig or arp command. Then look it up here:
http://coffer.com/mac_find/

Problem is, i need to create a script which will run against 3000 servers and check to see if any of them has Broadcome card as eth0 or eth4. Broadcome can be eth1,2,3,5,6 but not eth0 or eth4.

How about looking for the PCI id?

0x14E4 Broadcom Corporation www.broadcom.com

This should be available in dmesg, may be other places it's available as well.

Eg

See if you have /proc/net/nicinfo/*.info on your system... will simplify this entire process....

EDIT. Had some more time to work on this. You may find the following useful:

#!/bin/bash

AWK="/usr/bin/awk"
CURL="/usr/bin/curl"
CUT="/usr/bin/cut"
ECHO="/bin/echo"
GREP="/bin/grep"
IFCONFIG="/sbin/ifconfig"
SED="/usr/bin/sed"
TR="/usr/bin/tr"

URL="http://www.coffer.com/mac_find/?string="

function get_interfaces {
  INTERFACES=$( ${IFCONFIG} -a | ${GREP} "^eth" | ${AWK} '{print $1}' )
}

function get_vendors {
  for INTERFACE in ${INTERFACES}; do
     MAC=$( ${IFCONFIG} ${INTERFACE} | ${GREP} "HWaddr" | ${AWK} '{print $NF}' )
     VENDOR=$( ${ECHO} "${MAC}" | ${CUT} -d":" -f1-3 )
     HTTPVENDOR=$( ${ECHO} "${VENDOR}" | ${SED} 's/:/%3A/g' )
     LOOKUP=$( ${CURL} "${URL}${HTTPVENDOR}" 2>/dev/null | ${SED} -n '/strong>[ ]*MAC Address/,/<\/pre>/ p' | ${GREP} -v '>' | ${TR} -s ' ' )
     ${ECHO} "Interface: ${INTERFACE}  Vendor: ${LOOKUP}"
  done
}

get_interfaces
get_vendors

exit 0

Ran this on a few of my Linux systems:

# ./get_nic_vendor.sh 
Interface: eth0  Vendor:  00144F Sun Microsystems, Inc
Interface: eth1  Vendor:  00144F Sun Microsystems, Inc
Interface: eth2  Vendor:  00144F Sun Microsystems, Inc
Interface: eth3  Vendor:  00144F Sun Microsystems, Inc
# ./get_nic_vendor.sh 
Interface: eth0  Vendor:  009027 intel corporation
# ./get_nic_vendor.sh 
Interface: eth0  Vendor:  000D56 Dell PCBA Test
Interface: eth1  Vendor:  000D56 Dell PCBA Test

Cheers,
ZB

WOW, this is great. Exactly what i needed.

Thank you.