[TriLUG] reliably get network devices

Reginald Reed reginald.reed at gmail.com
Tue Jun 24 08:24:22 EDT 2008


I'm curious as to why you wouldn't want to use MAC addresses.  I
combination of the MAC + ifconfig output would be pretty good mapping
of physical to logical.  Since, in most instances, the MAC address of
a NIC wouldn't change, you could easily determine the mapping to ethX
on any boot.

What am I missing?

--Reggie

On Tue, Jun 24, 2008 at 7:00 AM, Kevin Hunter <hunteke at earlham.edu> wrote:
> At 6:28a -0400 on Tue, 24 Jun 2008, Carl Crider wrote:
>> Don't know if this is what you are looking for. Maybe I'm just confused by
>> the question.
>
> Heh, then perhaps I'm not asking the question I think I'm asking!
>
>> ifconfig -a
>>
>> ifconfig | less
>
> This is the next step in what I want to do.  The problem is that this
> will return what the OS has, but what the OS has (or provides) does not
> appear to be a guaranteed or set mapping.  That is eth0 might be one NIC
> card on one boot, then the other on a different boot.  I'm looking for a
> consistent mapping.  I could use the MAC addresses, but then I'm back to
> individually identifying cards, which is not an option.
>
> I wonder if the underlying problem is that the OS uses the
> non-deterministic "order in which they respond to a probe" to be the
> order of the NICs, in which case I may be up a creek.  I hope not.
>
> So, how do I dynamically (programmatically) probe what NICs are
> available and get a consistent mapping?
>
> Thanks,
>
> Kevin
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG FAQ  : http://www.trilug.org/wiki/Frequently_Asked_Questions
>



More information about the TriLUG mailing list