howto determine network device unit number? device.hints?

Julian Elischer julian at elischer.org
Thu Jan 15 01:16:36 PST 2009


Yony Yossef wrote:
> Thanks for the explanation.
>  
> So there's no way to determine this in advance.. 
> 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.

you must agree it's flexible.

> 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?

device discovery depends on what slot you put the card into.
so if you move it, it's number may change.

also, how do you identify the particular card you want to have a 
particular unit number? considering it may move (and for example
USB network interfaces WILL move if you add a keyboard or any
other device..

also to do as you want would take 2 passes.
first one to find the numbers needed and another to do what's left.


>  
> Yony
> 
> 
> 
>   _____  
> 
> From: H.fazaeli [mailto:fazaeli at sepehrs.com] 
> Sent: Thursday, January 15, 2009 10:26 AM
> To: Yony Yossef
> Cc: freebsd-net at freebsd.org; freebsd-questions at freebsd.org
> Subject: Re: howto determine network device unit number? device.hints?
> 
> 
> 
> for example, say you have 2 interface em0 and em1 which
> you like to swap their minor numbers:
> 
> ifconfig em0 name tmp
> ifconfig em1 name em0
> ifconfig em0 name em1
> 
> or to assign cisco-like names to you interfaces:
> 
> ifconfig xl0 name fastEthernet0 
> ifconfig em0 name gigaEthernet0 
> ifconfig fastEthernet0 192.168.1.0/24
> 
> 
> Yony Yossef wrote: 
> 
>  
> 
> 
> 
>   
> 
> -----Original Message-----
> 
> From: H.fazaeli [mailto:fazaeli at sepehrs.com] 
> 
> Sent: Wednesday, January 14, 2009 6:24 PM
> 
> To: Yony Yossef
> 
> Cc: freebsd-net at freebsd.org; freebsd-questions at freebsd.org; 
> 
> Eitan Shefi; Oleg Kats; Liran Liss
> 
> Subject: Re: howto determine network device unit number? device.hints?
> 
> 
> 
> 
> 
> you may not change unit numbers as they are strictly 
> 
> controlled by kernel.
> 
> However, on freebsd 5.3+, you may use 'ifconfig name <your-name-here>'
> 
> to achieve the same affect
> 
> 
> 
>     
> 
> 
> 
> Sorry, I don't understand the usage of ifconfig you suggested and the effect
> 
> it will cause.
> 
> Can you please explain it?
> 
> Yony
> 
> 
> 
>   
> 
> Yony Yossef wrote:
> 
>     
> 
> Hi,
> 
> 
> 
> I would like to determine the unit number of my network cards, e.g.
> 
> make the device on pci0:16 be assigned every time with unit 
> 
>       
> 
> number 0 
> 
>     
> 
> and pci0:19 with unit number 1.
> 
> 
> 
> Is it done by /boot/device.hints?
> 
> if so, how?
> 
> 
> 
> My cards are:
> 
> 
> 
> mtnic0 at pci0:19:0:0:     class=0x020000 card=0x001715b3 
> 
>       
> 
> chip=0x636815b3
> 
>     
> 
> rev=0xa0 hdr=0x00
> 
> mtnic1 at pci0:16:0:0:     class=0x020000 card=0x001715b3 
> 
>       
> 
> chip=0x636815b3
> 
>     
> 
> rev=0xa0 hdr=0x00
> 
> 
> 
> So I've tried:
> 
> 
> 
> hint.mtnic.0.at="pci0:16"
> 
> hint.mtnic.1.at="pci0:19"
> 
> 
> 
> but it doesn't work. They keep switching arbitrarily.
> 
> I'm using FreeBSD 7.0.
> 
> 
> 
> Thanks
> 
> Yony
> 
> _______________________________________________
> 
> freebsd-questions at freebsd.org mailing list 
> 
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> 
> To unsubscribe, send any mail to 
> 
>       
> 
> "freebsd-questions-unsubscribe at freebsd.org"
> <mailto:freebsd-questions-unsubscribe at freebsd.org> 
> 
>     
> 
>   
> 
>       
> 



More information about the freebsd-questions mailing list