Networking Forums

Networking Forums > Computer Networking > Linux Networking > Howto resolve which interface a NIC's is mapped to ( nic2if )

Reply
Thread Tools Display Modes

Howto resolve which interface a NIC's is mapped to ( nic2if )

 
 
jakobsg@gmail.com
Guest
Posts: n/a

 
      10-20-2006, 04:23 PM
Hi.
I am working on a lot og linux machines having multiple network
interfaces.
I have two questions regarding the way NIC's are mapped to network
interfaces:

1. How does the system choose which network interface a NIC is mapped
to, and can I reconfigure the mappings?
2. How can I determin which network a NIC is currently mapped to.

For ex:
$ lspci
0000:00:0a.0 Ethernet controller: D-Link System Inc Gigabit Ethernet
Adapter (rev 11)
0000:00:13.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL-8139/8139C/8139C+ (rev 10)

Now which one of these NIC's are mapped to my eth0?


I'm pretty sure that one of you experts can handle these questions, so
thanks in advance!

 
Reply With Quote
 
 
 
 
Tauno Voipio
Guest
Posts: n/a

 
      10-20-2006, 04:32 PM
(E-Mail Removed) wrote:
> Hi.
> I am working on a lot og linux machines having multiple network
> interfaces.
> I have two questions regarding the way NIC's are mapped to network
> interfaces:
>
> 1. How does the system choose which network interface a NIC is mapped
> to, and can I reconfigure the mappings?
> 2. How can I determin which network a NIC is currently mapped to.
>
> For ex:
> $ lspci
> 0000:00:0a.0 Ethernet controller: D-Link System Inc Gigabit Ethernet
> Adapter (rev 11)
> 0000:00:13.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> RTL-8139/8139C/8139C+ (rev 10)
>
> Now which one of these NIC's are mapped to my eth0?
>
>
> I'm pretty sure that one of you experts can handle these questions, so
> thanks in advance!
>


ifconfig returns both the IP address and MAC associated
with a network interface. The hardware should be uniquely
identifiable by the MAC address.

(There have been manufacturing series of NICs with duplicate
MAC addresses, but that's a hardware failure).

In older Sun computers (like Sparcstation 20) all the interfaces
in the same computer got the same MAC address, so here it cannot
be used for distinguishing the interfaces.

--

Tauno Voipio
tauno voipio (at) iki fi
 
Reply With Quote
 
jakobsg@gmail.com
Guest
Posts: n/a

 
      10-20-2006, 04:47 PM
OK, that I know, then I might ask you how do I map see which MAC -
address is associated with a certain NIC on a certain PCI
(bus:slot:func) 0000:00:13.0. That's the real question

Tauno Voipio skrev:
> (E-Mail Removed) wrote:
> > Hi.
> > I am working on a lot og linux machines having multiple network
> > interfaces.
> > I have two questions regarding the way NIC's are mapped to network
> > interfaces:
> >
> > 1. How does the system choose which network interface a NIC is mapped
> > to, and can I reconfigure the mappings?
> > 2. How can I determin which network a NIC is currently mapped to.
> >
> > For ex:
> > $ lspci
> > 0000:00:0a.0 Ethernet controller: D-Link System Inc Gigabit Ethernet
> > Adapter (rev 11)
> > 0000:00:13.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> > RTL-8139/8139C/8139C+ (rev 10)
> >
> > Now which one of these NIC's are mapped to my eth0?
> >
> >
> > I'm pretty sure that one of you experts can handle these questions, so
> > thanks in advance!
> >

>
> ifconfig returns both the IP address and MAC associated
> with a network interface. The hardware should be uniquely
> identifiable by the MAC address.
>
> (There have been manufacturing series of NICs with duplicate
> MAC addresses, but that's a hardware failure).
>
> In older Sun computers (like Sparcstation 20) all the interfaces
> in the same computer got the same MAC address, so here it cannot
> be used for distinguishing the interfaces.
>
> --
>
> Tauno Voipio
> tauno voipio (at) iki fi


 
Reply With Quote
 
Giovanni
Guest
Posts: n/a

 
      10-20-2006, 04:51 PM
(E-Mail Removed) wrote:

> $ lspci
> 0000:00:0a.0 Ethernet controller: D-Link System Inc Gigabit Ethernet
> Adapter (rev 11)
> 0000:00:13.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> RTL-8139/8139C/8139C+ (rev 10)
>
> Now which one of these NIC's are mapped to my eth0?
>
> I'm pretty sure that one of you experts can handle these questions, so
> thanks in advance!



First device detected becomes eth0, next eth1 and so on.
In any case ifconfig should give you the information.

Usually to associate a device to a interface name it is enough to insert
the lines:

alias eth0 <kernel module for your 1st NIC> ## 8139too for Realtek 8139
alias eth1 <kernel module for your 2nd NIC> ##

in the file /etc/modprobe.conf (or /etc/modules.conf for older
distributions).

Ciao
Giovanni
--
A computer is like an air conditioner,
it stops working when you open Windows.
Registered Linux user #337974 < http://giovanni.homelinux.net/ >
 
Reply With Quote
 
Tauno Voipio
Guest
Posts: n/a

 
      10-20-2006, 05:00 PM
> Tauno Voipio skrev:
>
>>(E-Mail Removed) wrote:
>>
>>>Hi.
>>>I am working on a lot og linux machines having multiple network
>>>interfaces.
>>>I have two questions regarding the way NIC's are mapped to network
>>>interfaces:
>>>
>>>1. How does the system choose which network interface a NIC is mapped
>>>to, and can I reconfigure the mappings?
>>>2. How can I determin which network a NIC is currently mapped to.
>>>
>>>For ex:
>>>$ lspci
>>>0000:00:0a.0 Ethernet controller: D-Link System Inc Gigabit Ethernet
>>>Adapter (rev 11)
>>>0000:00:13.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
>>>RTL-8139/8139C/8139C+ (rev 10)
>>>
>>>Now which one of these NIC's are mapped to my eth0?
>>>
>>>
>>>I'm pretty sure that one of you experts can handle these questions, so
>>>thanks in advance!
>>>

>>
>>ifconfig returns both the IP address and MAC associated
>>with a network interface. The hardware should be uniquely
>>identifiable by the MAC address.
>>
>>(There have been manufacturing series of NICs with duplicate
>>MAC addresses, but that's a hardware failure).
>>
>>In older Sun computers (like Sparcstation 20) all the interfaces
>>in the same computer got the same MAC address, so here it cannot
>>be used for distinguishing the interfaces.
>>


(-- top-posting corrected, TV --)

(E-Mail Removed) wrote:
> OK, that I know, then I might ask you how do I map see which MAC -
> address is associated with a certain NIC on a certain PCI
> (bus:slot:func) 0000:00:13.0. That's the real question


The MAC's are on stickers on the cards. Yes, you have to open
the box to see them.

If the NIC's are of different types or manufactures, you
can look at the PCI data with lspci. It lists the devices
by PCI bus positions.

--

Tauno Voipio
tauno voipio (at) iki fi
 
Reply With Quote
 
jakobsg@gmail.com
Guest
Posts: n/a

 
      10-20-2006, 05:06 PM
Stickers don't help me very much in a script that is ment to detect
NIC's and display them along side with which driver it uses and on
which network interface it can be reached.

Thanks anyway


Tauno Voipio skrev:
> > Tauno Voipio skrev:
> >
> >>(E-Mail Removed) wrote:
> >>
> >>>Hi.
> >>>I am working on a lot og linux machines having multiple network
> >>>interfaces.
> >>>I have two questions regarding the way NIC's are mapped to network
> >>>interfaces:
> >>>
> >>>1. How does the system choose which network interface a NIC is mapped
> >>>to, and can I reconfigure the mappings?
> >>>2. How can I determin which network a NIC is currently mapped to.
> >>>
> >>>For ex:
> >>>$ lspci
> >>>0000:00:0a.0 Ethernet controller: D-Link System Inc Gigabit Ethernet
> >>>Adapter (rev 11)
> >>>0000:00:13.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> >>>RTL-8139/8139C/8139C+ (rev 10)
> >>>
> >>>Now which one of these NIC's are mapped to my eth0?
> >>>
> >>>
> >>>I'm pretty sure that one of you experts can handle these questions, so
> >>>thanks in advance!
> >>>
> >>
> >>ifconfig returns both the IP address and MAC associated
> >>with a network interface. The hardware should be uniquely
> >>identifiable by the MAC address.
> >>
> >>(There have been manufacturing series of NICs with duplicate
> >>MAC addresses, but that's a hardware failure).
> >>
> >>In older Sun computers (like Sparcstation 20) all the interfaces
> >>in the same computer got the same MAC address, so here it cannot
> >>be used for distinguishing the interfaces.
> >>

>
> (-- top-posting corrected, TV --)
>
> (E-Mail Removed) wrote:
> > OK, that I know, then I might ask you how do I map see which MAC -
> > address is associated with a certain NIC on a certain PCI
> > (bus:slot:func) 0000:00:13.0. That's the real question

>
> The MAC's are on stickers on the cards. Yes, you have to open
> the box to see them.
>
> If the NIC's are of different types or manufactures, you
> can look at the PCI data with lspci. It lists the devices
> by PCI bus positions.
>
> --
>
> Tauno Voipio
> tauno voipio (at) iki fi


 
Reply With Quote
 
jakobsg@gmail.com
Guest
Posts: n/a

 
      10-20-2006, 05:11 PM
So, basically what you are saying is that I can use the bus/slot order
to determin the interface? Isn't that somewhat an unsafe method? And
why can't I just ask for a NIC's macaddress using it's PCI id?
Giovanni skrev:
> (E-Mail Removed) wrote:
>
> > $ lspci
> > 0000:00:0a.0 Ethernet controller: D-Link System Inc Gigabit Ethernet
> > Adapter (rev 11)
> > 0000:00:13.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
> > RTL-8139/8139C/8139C+ (rev 10)
> >
> > Now which one of these NIC's are mapped to my eth0?
> >
> > I'm pretty sure that one of you experts can handle these questions, so
> > thanks in advance!

>
>
> First device detected becomes eth0, next eth1 and so on.
> In any case ifconfig should give you the information.
>
> Usually to associate a device to a interface name it is enough to insert
> the lines:
>
> alias eth0 <kernel module for your 1st NIC> ## 8139too for Realtek 8139
> alias eth1 <kernel module for your 2nd NIC> ##
>
> in the file /etc/modprobe.conf (or /etc/modules.conf for older
> distributions).
>
> Ciao
> Giovanni
> --
> A computer is like an air conditioner,
> it stops working when you open Windows.
> Registered Linux user #337974 < http://giovanni.homelinux.net/ >


 
Reply With Quote
 
jakobsg@gmail.com
Guest
Posts: n/a

 
      10-20-2006, 07:03 PM
Solved the problem.

Thanks for your input anyway. I found what I needed in ethtool. It is a
very cool tool :-)

$ ethtool -i ethN

Best regards
Jakob Simon-Gaarde

 
Reply With Quote
 
Mikko Rapeli
Guest
Posts: n/a

 
      10-20-2006, 09:46 PM
On 2006-10-20, (E-Mail Removed) <(E-Mail Removed)> wrote:
> Stickers don't help me very much in a script that is ment to detect
> NIC's and display them along side with which driver it uses and on
> which network interface it can be reached.


An example sysfs view on a Debian sarge host with 2.6.8 kernel:

$ cat /sys/class/net/eth0/address
00:10:a7:09:48:c7
$ ls -l /sys/class/net/eth0/device
lrwxrwxrwx 1 root root 0 Oct 3 15:08 /sys/class/net/eth0/device ->
.../../../devices/pci0000:00/0000:00:09.0
$ ls -l /sys/class/net/eth0/driver
lrwxrwxrwx 1 root root 0 Oct 3 15:08 /sys/class/net/eth0/driver ->
.../../../bus/pci/drivers/8139too

On an etch host with 2.6.17 the driver seems to be
[ifname]/device/driver.

So, at least you can easily find out 'which interface uses which NIC and
driver'.

-Mikko
 
Reply With Quote
 
Pascal Hambourg
Guest
Posts: n/a

 
      10-20-2006, 09:47 PM
Hello,

Giovanni a écrit :
>
> First device detected becomes eth0, next eth1 and so on.
> In any case ifconfig should give you the information.


Yes, it is as simple as that.

> Usually to associate a device to a interface name it is enough to insert
> the lines:
>
> alias eth0 <kernel module for your 1st NIC> ## 8139too for Realtek 8139
> alias eth1 <kernel module for your 2nd NIC> ##


This method is broken by design when you decide to activate eth1 before
eth0. The first interface will get the name eth0 whatever name the alias is.

> in the file /etc/modprobe.conf (or /etc/modules.conf for older
> distributions).


Isn't it rather that modutils for 2.4 kernels uses modules.conf while
module-init-tools for 2.6 kernels uses modprobe.conf ?
 
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
LUNs mapped to mount points are much slower than mapped to Drive letters bd Windows Networking 0 12-20-2006 11:40 AM
I am in need of a netsh script that will disable the "Local Area Connection" interface then re-enable that same interface. Spin Windows Networking 3 11-03-2005 12:58 AM
unable to resolve aliased network interface name ziupiu Linux Networking 3 11-04-2004 05:06 AM
Linux API to create logical interface on a physical interface? Zarko Coklin Linux Networking 2 07-18-2004 01:50 AM
Ethernet-Howto and Networking-Howto, etc... Bernard DEBREIL Linux Networking 0 11-27-2003 10:16 PM



1 2 3 4 5 6 7 8 9 10 11