vb.net - generate mac address

XK8ER used Ask the Experts™
hello there,
I would like to know how can I make a function that can generate random valid mac addresses.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


not really this is a vb.net question!
1.) A MAC address is 48bit (12 hexadecimal digits) long and is written hexadecimal in the form 01-23-45-67-89-AB-CD
It consists of two parts. The vendor part (first 6 digits) and the device part (last 6 digits).
A list of all vendor codes can be found here: http://standards.ieee.org/regauth/oui/oui.txt
The device part are unique numbers assigned by the vendor.

2.) What do you want to do with your generated MAC addresses?
If you dont have a vendor code I think it will not be possible to get a real valid MAC address for network use. You can only take a random address of any vendor with any number and hope it is not used by anyone else:

Dim Buffer(6-1) as Byte
Dim Random As New Random()

If you want to show the bytes in hexadecimal form you can use the class Conversion.Hex

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial