Sponsored Content
Operating Systems Linux Get info on network interface Post 302122251 by zazzybob on Tuesday 19th of June 2007 08:46:52 PM
Old 06-19-2007
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:
Code:
#!/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:
Code:
# ./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

Last edited by zazzybob; 06-19-2007 at 10:08 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Network Interface

Hi ! Does anyone know how can i get information about my network interface ... if it works in half or full duplex mode !! Thx in adivance ! Witt (4 Replies)
Discussion started by: witt
4 Replies

2. UNIX for Dummies Questions & Answers

network interface questions

I can't remember or figure out how to do this. What is the command(s) in Solaris 8 sparc to show the values operating a NIC, specifically the negotiated transfer rate (10/100) and mode (full/half duplex)? Also, how can I force 100 Mb full (the network is just a crossover cable, and the other box is... (3 Replies)
Discussion started by: 98_1LE
3 Replies

3. UNIX for Advanced & Expert Users

network interface problem

Hi expert, Need some help on network interface issue.. I have added 2 x NIC card onto the Ultra 2 system recently and configured as hme1 and hme2. I have unconfigured the onboard hme0 network interface and it was running fine till few days later, i keep recieving error messages showing hme0... (6 Replies)
Discussion started by: sc2005
6 Replies

4. IP Networking

How to activate a network interface?

What are the steps between "ifconfig eth0 UP" and "net_device->open"? ifconfig eth0 UP => ioctl(skfd, SIOCSIFFLAGS, &ifr) (ifr.ifr_flags = IFF_UP | IFF_RUNNING) => ????? => what are these steps? net_device->open Thanks! (1 Reply)
Discussion started by: samuncle
1 Replies

5. Solaris

configure zones to have different network interface and network

i need to configure a zone to use different interface (bge2) than global and have connected to completely different network switch & to use its own defaultrouter and hosts file .. is it possible ..if so ..how ? Thanks (9 Replies)
Discussion started by: skamal4u
9 Replies

6. UNIX and Linux Applications

Access to network interface (Mac-network)

Hi, I'm a italian student. For my thesis I develop a gateway with protocol 6lowpan. For that I must access to network interface to develope my personal stack based on standard 802.15.4. Can you help me? I need an explanation for that. (0 Replies)
Discussion started by: berny88
0 Replies

7. IP Networking

Network interface-

Hello, Please what's the difference between: AND Thank you so much (3 Replies)
Discussion started by: chercheur857
3 Replies

8. IP Networking

network interface -

Hello, Please, how can i create a network interface with a routable IP address on linux (ubuntu) ? AND How can i desactivate an interface? Thank you so much for help. (1 Reply)
Discussion started by: chercheur857
1 Replies

9. Solaris

No network cable But Network interface is UP and Running

I've one Netra 240 After changing main board and system configuration card reader, Network is not accessible any more, Network interfaces are always UP and Running even when there is no cable connected to Network interfaces. I tried to restart and plumb/unplumb with no luck. ifconfig -a... (7 Replies)
Discussion started by: samer.odeh
7 Replies

10. UNIX for Dummies Questions & Answers

Adding a network interface to a bonded interface

I have a RHEL 5 system with a bonded interface configure using only one network port (eth0). So I have config file for ifcfg-bond0 and ifcfg-eth. I'd like to configure eth5 to be the second SLAVE in the bond. My question is, after I modify ifcfg-eth5, can I add eth5 to the bond0 interface without... (1 Reply)
Discussion started by: westmoreland
1 Replies
net_phylookup(9F)					   Kernel Functions for Drivers 					 net_phylookup(9F)

NAME
net_phylookup - determine if a network interface name exists for a network protocol SYNOPSIS
#include <sys/neti.h> phy_if_t net_phylookup(const net_data_t net, const char *name); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
net value returned from a successful call to net_protocol_lookup(9F). name name of the network interface to find. DESCRIPTION
The net_phylookup() function attempts to resolve the interface name passed in with the network protocol. When called successfully, the value returned represents a network interface that exists, at the time of the call, within the scope of the network interface. This value is only guaranteed to be unique for a name within the scope of the network protocol. RETURN VALUES
The net_phylookup() function returns -1 if it is not supported by the network protocol, and 0 if the named network interface does not exist (or is otherwise unknown). Otherwise, it returns a value greater than 0 representing a network interface that currently exists within the scope of this network protocol. CONTEXT
The net_phylookup() function may be called from user, kernel, or interrupt context. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ SEE ALSO
net_getifname(9F), net_phygetnext(9F), net_protocol_lookup(9F), attributes(5) SunOS 5.11 1 May 2008 net_phylookup(9F)
All times are GMT -4. The time now is 03:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy