Random MAC address generator
Do you want to generate a random MAC address? No problem with this neat tip sent in by one of our readers, just paste the following into the command line:
openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'
The hexadecimal output will be the generated MAC address, and will look something like this: 07:e0:17:8f:11:2f
This is pretty helpful if you need to create a new MAC address for something like your router or cable modem. Of course you can also spoof your MAC address rather easily in Mac OS X if you want to use one of the generated addresses for that purpose too.
This command has been tested to work in Linux and Mac OS X.

I always just concoct random hex strings in my head, this is a bit less brain work so thanks
You need to be careful that this does not generate multicast mac addresses, as these are technically illegal as source macs. The strict definition of a multicast mac address is one where the least significant bit of the first byte is set to 1. So if the first octet’s LSB is 1 (01, 03,05, a1, etc) you technically have a multicast mac source. See http://en.wikipedia.org/wiki/MAC_address.
Using multicast src macs might not cause immediate connectivity problems, but certainly has implications for switches learning the mac address preventing unicast flooding, and routers allowing arp to resolve.
Cisco, for example, will not allow mac learning if the source is non-unicast, and Cisco routers will not install arp entries for multicast macs to unicast ip addresses.
I think you need to rethink this post taking into consideration these consequences.
ruby -e ‘print (“%02x”%((rand*64).to_i*4|2))+(0..4).inject(“”){|s,x|s+”:%02x”%(rand*256).to_i} + “\n”‘
The result is a locally administered, non-multicast MAC address.
“(rand*64).to_i” should be written as “(rand 64)”
“(rand*256).to_i” should be written as “(rand 256)”
Thanks Ben and bob for this.
[...] note that the MAC address above is not the real one of my drives but a generated fake, for the sake of understanding the [...]
[...] that value returned from ifconfig to another hex value in the format of aa:bb:cc:dd:ee:ff. You can generate a random one if need [...]
The ruby snippet was broken. I don’t know ruby. I love perl though:
perl -e ‘printf “\n%02x:”, $x=(int(rand(128))*2); for($i=0;$i<4;$i++){printf "%02x:",$x=int(rand(256));}printf "%02x", $x=int(rand(256));printf"\n\n";'
[...] shown you how to generate MAC addresses randomly and then how to go about changing a MAC address in OS X Lion and OS X Mountain Lion, but why have [...]
And with bash calculation use this:
printf ‘%02x:’ $(( 0x$(od /dev/urandom -N1 -t x1 -An | cut -c 2-) & 0xFE | 0×02)); \
od /dev/urandom -N5 -t x1 -An | cut -c 2- | sed ‘s/ /:/g’
How to change mac address in nokia n8?
I am change mn my mac address but my computer not conectinge in conecting other wi-fi.in conctinge other computer this wi-fi.
in my password is carickd.
The one from Holger is correct:
printf ‘%02x:’ $(( 0x$(od /dev/urandom -N1 -t x1 -An | cut -c 2-) & 0xFE | 0×02)) ; od /dev/urandom -N5 -t x1 -An | cut -c 2- | sed ‘s/ /:/g’