[Lxc-users] updated lxc template for debian squeeze - with attachedscript ; )

John Soros johnny at r0x0r.me
Fri Mar 11 15:47:16 UTC 2011


> 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)
--
Sticky bits on disk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20110311/e8c21b30/attachment.pgp>


More information about the lxc-users mailing list