Subject: Re: Allowing ifconfig to automatically fill in IPv6 host ID
To: None <>
From: None <>
List: tech-net
Date: 03/25/2002 22:49:51
On Tue, Mar 26, 2002 at 12:36:55PM +0900, wrote:
> >> >How about merging it into ifconfig?
> >> >	ifconfig fo0 inet6 prefix 1:2:3:4::
> >> 	i don't like it... use script or whatever to grab 64bit interface
> >> 	identifier...
> >Which raises the question how one gets that interface id? 
> >I know how to calculate it for Ethernet MAC, but don't know for other
> >media types... is there some interface to retrieve the EUI64 ID?
> 	it really depends on your goal.  if you just need some value,
> 	random number (with universal/local bit turned off) works just fine.
> 	otherwise, you can borrow it from other ethernet interface.
> 	RFC2472 section 4.1 is an excellent description about this.

in particular

ifconfig fo0 | sed -e '1,/inet /d' -e '/inet /d' -e 's/.* fe[0-9][0-9]:://' -e 's/%.*//' | head -1

does the trick for extracting the EUI64 from an ethernet interface