On Fri, 2011-03-11 at 16:47 +0100, John Soros wrote: > > Can someone explain to me why we can't simply use a block of addresses > > with the 0200 (local administration) bit or'ed in. Out of 48 bits of > > addressing, we can use 46 bits of them for anything we want as long as > > that bit is set and the 0100 bit (multicast) is clear. By the > > standard, those are locally managed and allocated MAC addresses that > > are not guaranteed to be globally unique. They don't even need to be > > unique in an entire network, only on the local subnet. Use any > > convention you want. Stuff the 32 bit IP address of the host in the > > lower 32 bits and you've still got 14 bits worth of assignable > > addressing per host. That's what that bit is intended for. > > > > > - Walter > > isn't that what the script does? : > ==snip== > rndbit="" > while [[ $rndbit != "2" && $rndbit != "6" && $rndbit != "A" && $rndbit != "E" > ]]; do > rndbit="$(hexdump -n 1 -v -e '/1 "%02X"' /dev/urandom |sed 's,^.,,g' |tr -d > '\n')" > done > macaddr=$(echo -n "0${rndbit}"; hexdump -n 5 -v -e '/1 ":%02X"' /dev/urandom) > ==/snip== > I agree it's not as pretty as or'ing a random mac with 0200 but the > result should be the same. Of course if someone finds a way to bitwise > or on the commandline i'll be happy to update the patch. > Thanks, > (whoops, ok so how to be sure the adress is not multicast)
Ok... Does this not work for you? Works for me... [mhw@canyon ~]$ declare -i BYTE=$(( 0xC1 & ~ 3 | 2 )) [mhw@canyon ~]$ echo ${BYTE} 194 (0xc2) Since you're using the "[[" expression, I think you're pretty locked into bash are you not? > -- > Sticky bits on disk. Regards, Mike -- Michael H. Warfield (AI4NB) | (770) 985-6132 | m...@wittsend.com /\/\|=mhw=|\/\/ | (678) 463-0932 | http://www.wittsend.com/mhw/ NIC whois: MHW9 | An optimist believes we live in the best of all PGP Key: 0x674627FF | possible worlds. A pessimist is sure of it!
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d
_______________________________________________ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users