Networking Forums

Networking Forums > Computer Networking > Linux Networking > ipaddr -> device

Reply
Thread Tools Display Modes

ipaddr -> device

 
 
Mike - EMAIL IGNORED
Guest
Posts: n/a

 
      05-20-2004, 02:04 AM
On RedHat 9, programming in C++, on a machine that
has several ethernet cards, I need to determine the
device (eth0, eth1, etc.) from the ip address
(192.168.1.10, etc.). Is there a function that
will do this?

Thanks in advance for your help.

Mike.
 
Reply With Quote
 
 
 
 
Robert Spielmann
Guest
Posts: n/a

 
      05-20-2004, 11:56 AM
On Wed, 19 May 2004 22:04:42 -0400
Mike - EMAIL IGNORED <(E-Mail Removed)> wrote:

> On RedHat 9, programming in C++, on a machine that
> has several ethernet cards, I need to determine the
> device (eth0, eth1, etc.) from the ip address
> (192.168.1.10, etc.). Is there a function that
> will do this?


read /etc/network/interfaces? (if the IP addresses are static)

>
> Thanks in advance for your help.
>
> Mike.



--
"Dieser Satz enthält exakt trei Feehler."
Douglas R. Hofstadter, Metamagicum
 
Reply With Quote
 
Mike - EMAIL IGNORED
Guest
Posts: n/a

 
      05-21-2004, 01:53 AM
Robert Spielmann wrote:
>
> On Wed, 19 May 2004 22:04:42 -0400
> Mike - EMAIL IGNORED <(E-Mail Removed)> wrote:
>
> > On RedHat 9, programming in C++, on a machine that
> > has several ethernet cards, I need to determine the
> > device (eth0, eth1, etc.) from the ip address
> > (192.168.1.10, etc.). Is there a function that
> > will do this?

>
> read /etc/network/interfaces? (if the IP addresses are static)

[...]

I do not have this file on my RH9. My ip addresses are static.

Mike.
 
Reply With Quote
 
Floyd L. Davidson
Guest
Posts: n/a

 
      05-21-2004, 05:26 AM
Mike - EMAIL IGNORED <(E-Mail Removed)> wrote:
>Robert Spielmann wrote:
>>
>> On Wed, 19 May 2004 22:04:42 -0400
>> Mike - EMAIL IGNORED <(E-Mail Removed)> wrote:
>>
>> > On RedHat 9, programming in C++, on a machine that
>> > has several ethernet cards, I need to determine the
>> > device (eth0, eth1, etc.) from the ip address
>> > (192.168.1.10, etc.). Is there a function that
>> > will do this?

>>
>> read /etc/network/interfaces? (if the IP addresses are static)

>[...]
>
>I do not have this file on my RH9. My ip addresses are static.


He probably meant /proc/net/dev, but that is not really
satisfactory because while it does list interfaces, it does not
list the ip addresses.

There have been many articles posted to Usenet showing the correct
use of SIOGCIFCONF using C, which should suffice as an example of
where to start with C++. (I've posted several myself.)

Go to http://groups.google.com/advanced_group_search and do a
search the word SIOGCIFCONF restricted to comp.os.linux.* only,
and you'll come up with several articles.

--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) (E-Mail Removed)
 
Reply With Quote
 
Cameron Kerr
Guest
Posts: n/a

 
      05-21-2004, 06:36 AM
Robert Spielmann <(E-Mail Removed)> wrote:
> On Wed, 19 May 2004 22:04:42 -0400
> Mike - EMAIL IGNORED <(E-Mail Removed)> wrote:


>> I need to determine the device (eth0, eth1, etc.) from the ip address
>> (192.168.1.10, etc.). Is there a function that will do this?

>
> read /etc/network/interfaces? (if the IP addresses are static)


Certainly not, that's Debian specific, and devices can be configured in
various other ways (esp dhcp).

--
Cameron Kerr
(E-Mail Removed) : http://nzgeeks.org/cameron/
Empowered by Perl!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
802.11 Broadcom device missing from device manager tinanewtonart Broadband Hardware 1 03-12-2009 08:18 AM
Device Available to connect Wired router from Wireless Device? Bakshi Network Routers 2 03-22-2008 01:55 PM
Unable to remove hidden device in device manager mario Wireless Networks 9 05-10-2007 05:25 PM
HELP! There's an Unidentified Device on my Device Manager! > > > Alan Windows Networking 2 05-02-2004 04:24 AM
SuSE 6.3 & rc.config & IPADDR Lisa Linux Networking 5 01-09-2004 07:29 PM



1 2 3 4 5 6 7 8 9 10 11