- Determining # of lan cards in system

PDA

View Full Version : Determining # of lan cards in system


Mike Shapp
07-24-2004, 10:09 PM
Is there anyway to determine the number of lan cards installed in a system?
netstat won't work because not all of the lan cards will be configured.

Also, do the network interfaces always start with eth?

Thanks in advance

Mike Shapp
mikeshapp@yahoo.com

Michael Heiming
07-24-2004, 10:09 PM
Mike Shapp <mikeshapp@yahoo.com> wrote:
> Is there anyway to determine the number of lan cards installed in a system?
> netstat won't work because not all of the lan cards will be configured.

Presuming only ethernet NIC in some recent system:

$ /sbin/lspci | grep Eth
00:0d.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
00:0f.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
00:11.0 Ethernet controller: Intel Corp. 82557/8/9 [Ethernet Pro 100] (rev 05)

--
Michael Heiming

Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of SPAM

David Efflandt
07-24-2004, 10:09 PM
On Sat, 25 Oct 2003 13:52:11 GMT, Mike Shapp <mikeshapp@yahoo.com> wrote:
> Is there anyway to determine the number of lan cards installed in a system?
> netstat won't work because not all of the lan cards will be configured.

While lspci -v (other reply) may find PCI and cardbus devices, it would
not find my 16-bit wireless nic or 16-bit 10/100 pc card. It also would
not tell you if those devices are configured, but down for a reason (like
not connected).

> Also, do the network interfaces always start with eth?

My wireless PC card is wlan0 (using wlan-ng).

You could see which interfaces are configured (which skips lo, but may
include aliases or virtual interfaces) with:

ls /proc/sys/net/ipv4/conf | grep [0-9]

I imagine detecting unconfigured nics would be more involved (kudzu or
SuSE's hardware detection may give you a clue). But even that may not
always pick the best module (like my cases where rtl8139 did not work, but
8139too does, or tulip did not work, but de4x5 does).

--
David Efflandt - All spam ignored http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/

Neil Horman
07-24-2004, 10:10 PM
Mike Shapp wrote:
> Is there anyway to determine the number of lan cards installed in a system?
> netstat won't work because not all of the lan cards will be configured.
Depends what you mean by configured. If you mean no network information
assigned (i.e. no ip address, etc), then you're ok. ifconfig -a should
give you everything you need. You can record the output of ifconfig -a,
discount any interfaces you are not interested in (lo, usb ethernet
ports, etc). and count the number of times your interface name (commonly
eth0), occurs.

>
> Also, do the network interfaces always start with eth?
Nope, but its the de-facto standard for your typical 10-base-T pci card.
The only time you tend to see a different name is if the medium is
different (i.e. wlan for wireless, usb for ethernet over usb, ppp for
point to point connections, etc).
>
> Thanks in advance
>
> Mike Shapp
> mikeshapp@yahoo.com
>
>
HTH
Neil

--
/***************************************************
*Neil Horman
*Software Engineer
*Red Hat, Inc., www.redhat.com
*gpg keyid: 1024D / 0x92A74FA1
*http://www.keyserver.net
***************************************************/

not availible
07-24-2004, 10:35 PM
I would look at the network installation scripts,
you will need to poll all io ports net cards might be hiding,
if you want to find isa cards.
Might look into clear cases then just swing the web cam towards
the case and look.

How do you define a network card?
I've seen 8 port net cards, is this one card, or 8 networks
on one card.

Without looking in the case it will not be a simple script.
Then even if you write all that nasty code and search, how do you
acount for cards that failed to respond, they could be dieing.
Also I had a realtec 8029 that would lock up and appear invisible
if the network cable had a short in it. Card was fine as long as the
bad cable was disconnected.

Robert