[Lxc-users] updated lxc template for debian squeeze - with attachedscript ; )
Michael H. Warfield
mhw at WittsEnd.com
Fri Mar 11 16:52:51 UTC 2011
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 at canyon ~]$ declare -i BYTE=$(( 0xC1 & ~ 3 | 2 ))
[mhw at 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 | mhw at 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!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20110311/20c8dc9c/attachment.pgp>
More information about the lxc-users
mailing list