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
Dpkg::Vendor(3) 						   libdpkg-perl 						   Dpkg::Vendor(3)

NAME
Dpkg::Vendor - get access to some vendor specific information DESCRIPTION
The files in /etc/dpkg/origins/ can provide information about various vendors who are providing Debian packages. Currently those files look like this: Vendor: Debian Vendor-URL: http://www.debian.org/ Bugs: debbugs://bugs.debian.org If the vendor derives from another vendor, the file should document the relationship by listing the base distribution in the Parent field: Parent: Debian The file should be named according to the vendor name. FUNCTIONS
$fields = Dpkg::Vendor::get_vendor_info($name) Returns a Dpkg::Control object with the information parsed from the corresponding vendor file in /etc/dpkg/origins/. If $name is omitted, it will use /etc/dpkg/origins/default which is supposed to be a symlink to the vendor of the currently installed operating system. Returns undef if there's no file for the given vendor. $name = Dpkg::Vendor::get_vendor_file($name) Check if there's a file for the given vendor and returns its name. $name = Dpkg::Vendor::get_current_vendor() Returns the name of the current vendor. If DEB_VENDOR is set, it uses that first, otherwise it falls back to parsing /etc/dpkg/origins/default. If that file doesn't exist, it returns undef. $object = Dpkg::Vendor::get_vendor_object($name) Return the Dpkg::Vendor::* object of the corresponding vendor. If $name is omitted, return the object of the current vendor. If no vendor can be identified, then return the Dpkg::Vendor::Default object. Dpkg::Vendor::run_vendor_hook($hookid, @params) Run a hook implemented by the current vendor object. 1.16.15 2014-06-05 Dpkg::Vendor(3)
All times are GMT -4. The time now is 11:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy