Deven Shanbhag
2013-Jun-18 02:50 UTC
Need help in generating MAC Address using Virt-install or any other command
Hello all, Need some help in generating random mac address for my guest vm. I am Specifically looking for the command line as i already have vm file scp''d in the host. Can somebody pl help. Thnks
Ian Campbell
2013-Jun-18 07:42 UTC
Re: Need help in generating MAC Address using Virt-install or any other command
On Tue, 2013-06-18 at 12:50 +1000, Deven Shanbhag wrote:> Hello all, > Need some help in generating random mac address for my guest vm.Not so long ago I wrote: http://www.hellion.org.uk/cgi-bin/randmac.pl because all the other ones I could find got the handling of the address scope and OUI wrong. Ian.> I am Specifically looking for the command line as i already have vm > file scp''d in the host. Can somebody pl help. Thnks > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xen.org > http://lists.xen.org/xen-users
Fajar A. Nugraha
2013-Jun-18 08:23 UTC
Re: Need help in generating MAC Address using Virt-install or any other command
On Tue, Jun 18, 2013 at 9:50 AM, Deven Shanbhag <deven.shanbhag@yahoo.com> wrote:> Hello all, > Need some help in generating random mac address for my guest vm. I am Specifically looking for the command line as i already have vm file scp''d in the host. Can somebody pl help. ThnksThis is what I use: $ cat /usr/local/bin/genmac #!/bin/bash prefix="00:16:3E" mac="$prefix" for seqnum in 1 2 3 ;do part=`dd if=/dev/random bs=1 count=1 2>/dev/null | xxd -ps -u` mac="$mac:$part" done echo $mac -- Fajar