[ale] Network Vendor String
Jeff Lightner
jlightner at water.com
Tue Oct 10 12:19:20 EDT 2006
Neat. That one worked on my FC4 and RHEL 4 systems.
Of course on FC/RH I can just get the vendor name out of
/etc/sysconfig/network-scripts/ifcfg-<nic>. The perl script might be
good for other distros,
lspci (even with -v or -vv) will show you vendor but won't show which
NIC name (e.g. eth0) it is. This perl script does.
You can find out which NICs you have configured with just the "ifconfig"
command. "ifconfig -a" should show you both the configured and the
unconfigured NICs.
-----Original Message-----
From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of
To: ale at ale.org
Christopher Fowler
Sent: Tuesday, October 10, 2006 12:04 PM
To: Atlanta Linux Enthusiasts
Subject: Re: [ale] Network Vendor String
Pass #2
--- [ Cut Here ] --------------------------------
#!/usr/bin/perl
use LWP::UserAgent;
die "$0 <interface>\n" unless $ARGV[0];
my $ifconfig = `/sbin/ifconfig $ARGV[0] | head -n1`;
$ifconfig =~ m/HWaddr\s(.+?)$/;
my $mac = $1;
$mac =~ m/^(..):(..):(..)/;
my $vendor = "$1$2$3";
my $ua = LWP::UserAgent->new();
my $response = $ua->post("http://www.coffer.com/mac_find/",
{ 'string' => $vendor });
$response->content() =~ m/$vendor\s+(.+?)\n/;
my $manuf = $1;
print "Vendor String: $vendor, Manufacturer: $manuf\n";
-------------------------------------------------------
On Tue, 2006-10-10 at 11:53 -0400, Christopher Fowler wrote:
> Pass #1:
>
> --- [ Cut Here ] -------------------
> #!/usr/bin/perl
> die "$0 <interface>\n" unless $ARGV[0];
> my $ifconfig = `/sbin/ifconfig $ARGV[0] | head -n1`;
> $ifconfig =~ m/HWaddr\s(.+?)$/;
> my $mac = $1;
> $mac =~ m/^(..):(..):(..)/;
> my $vendor = "$1:$2:$3";
> print "Vendor: $vendor\n";
> --- [ Cut Here ] -------------------
>
> On Tue, 2006-10-10 at 08:46 -0700, ale at jeffx.com wrote:
> > Say I am writing a little script to obtain hardware inventory on my
linux
> > system. I want the vendor string of the network card(s). I know
there
> > has to be a way to get it because the installer reads the
information as
> > does network-configuration tools.
> >
> > I have looked around in /proc with no success. Is there a way to
get that
> > information?
> >
> > Regards,
> > Jeff
> >
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > http://www.ale.org/mailman/listinfo/ale
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list