Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Jan 2009 11:43:38 +0200
From:      "Yony Yossef" <>
To:        "'H.fazaeli'" <>, "Yony Yossef" <>
Cc:,, Yony Yossef <>
Subject:   RE: howto determine network device unit number? device.hints?
Message-ID:  <001601c976f5$c015f7a0$>
In-Reply-To: <>
References:  <>	<>	<000b01c9768e$745aa160$>	<> <000c01c976ec$87e040b0$> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help

> Yony Yossef wrote:
> > Thanks for the explanation.
> >  
> > So there's no way to determine this in advance.. 
> >   
> What do you mean by 'in advance'? Assuming a fixed hardware 
> configuration, when the kernel is loaded, you know all the 
> interface names and can rename them, i.e., in rc.local.

>From the beginning:

I have a FreeBSD7 machine with two network cards, both carry the same device
name "mtnic".
My driver is a kernel module loaded manualy using kldload.
Upon load, the driver registers the net device by the name "mtnic<unit
number>", that is what you see in ifconfig.

Problem is, this unit number is not constant and changing arbitrarily every
time I reload the driver (card A unit number=0 & card B un=1 or the other
way around).
Therefore, IP assignment to mtnic0 by /etc/rc.conf may assign an interface
with an IP belongs to another subnet, since rc.conf is not changing.

Of course I can keep my own MAC-to-interface mapping and rename the
interfaces after I load the driver.
It doesn't sound like a reasonable solution though.

Plus, I still don't understand why the unit number should change at all,
instead of being determined according to the card PCI location or some other


> > I must build a script that contains my own mapping between MAC 
> > addresses and the wanted interface names and run it after 
> each driver 
> > load, rename the interfaces if necessary.
> >   
> I do not quite understand your requirement. Can you please explain?
> Do you need a script that works on multiple machines with 
> different hardwares?
> > It seems quite wrong, don't you agree?
> >  
> > And how come the unit number is given an arbitrary value? 
> Is there a 
> > good reason for that?
> >  
> > Yony

Want to link to this message? Use this URL: <$c015f7a0$220f000a>