Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 03-01-2005, 03:15 AM   #1
Registered: Mar 2003
Location: Malaysia
Posts: 63

Rep: Reputation: 15
Question How to the no of attached ethernet adapters

Hi all,
I am writing a network application for the Red Hat system that requires to know the number of the network cards eth (ethernet adapters) attached to the system where the application is installed.

The way that I am using now to determine the number of NIC cards is by counting the number of the files that their names taking the form ifcfg-eth, where ifcfg-eth0, ifcfg-eth1 and so on are the configuration files for each adapter.

Is there another way by using C language that helps me to determine the number of adapters attached to my Red Hat system??

Old 03-01-2005, 03:40 AM   #2
Registered: Aug 2004
Location: .au
Distribution: debian, BSD
Posts: 104

Rep: Reputation: 16
depending on the kernel you're running, you could just open /proc/pci and match on 'Ethernet Controller' ... or match eth* on /proc/sys/net/ipv4/conf either or, there's a few ways to do it - up to you to decide which is the best..


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
a lil help with ethernet adapters... bmxwrestler180 Linux - Hardware 14 09-01-2006 06:20 PM
Wireless Adapters superdude_876 Slackware 7 10-18-2005 06:11 PM
Virtual Adapters ImpactDNI Linux - Networking 2 08-12-2005 07:38 AM
How do I use 2 ethernet adapters? elspxvwcyr Linux - Networking 4 12-07-2004 03:48 PM
USB Adapters sihere Linux - Software 2 12-30-2001 05:29 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:44 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration