Generate unique mac address

Hi,

I want to generate 2000 mac address. Please let me know how to do so.
Perl script or there is some tool availlable wherein i can give the count and it will generate that many mac-address

Thanks,
Kriti

You know that there's more to MAC addresses than just a sequence of 6 HEX numbers separated by : . But, as vague as you are in your request, this will do:

$ awk 'BEGIN {while (i < 2000) {a=sprintf ("%.12X", i++); gsub(/../,"&:",a); sub(":$","",a); print a}}'
00:00:00:00:00:00
00:00:00:00:00:01
.
.
.
1 Like

Thanks for your help. I am not into scripting. Just started with it. Can you tell me how to save the following code and run it into linux.

Copy / paste into terminal?

1 Like

Hey i got how to run it..

#!/usr/bin/awk -f
BEGIN {while (i < 2000) {
a=sprintf ("%.12X", i++);
gsub(/../,"&:",a);
sub(":$","",a);
print a
}
}

~

Save it in a file and run using below cli

echo | awk -f <file_name>