-1

Wikipedia states about MAC-48 string format:

The standard (IEEE 802) format for printing MAC-48 addresses in human-friendly form is six groups of two hexadecimal digits, separated by hyphens (-) or colons (:)

I'd like someone who actually has access to IEEE 802 documents to confirm that at every position there should be exactly two hexadecimal digits.

In other words: is that address valid: 01:23:4:56:78:9A? Or do I need to express "4" with leading zero explicitely: 01:23:04:56:78:9A?

kamituel
  • 101
  • 4
  • I have never seen it any other way, why do you ask, is a piece of software complaining ? If it is your own code can you not allow both forms? – rob May 09 '14 at 09:27
  • 1
    @Rob: I've seen countless other forms. `01230456789A`,`01.23.04.56.78.9A`, `0123.0456.789A`, also in the respective lowercase variant. – Sven May 09 '14 at 09:30
  • @SvW - I'm concerned only with `:` notation. – kamituel May 09 '14 at 09:31
  • @rob - I'm writing a unit test for a piece of software and I realized I'm not sure about the format. And I think I don't have access to IEEE :/ – kamituel May 09 '14 at 09:32
  • I can download the docs from http://standards.ieee.org/about/get/802/802.html?utm_source=Mainsite_CSE&utm_medium=CSE_Promotion&utm_term=802&utm_campaign=Standards_Promotion-802 A quick scan of ieee802-2001 doesn'r seem to mandate anything but you may find differently. – user9517 May 09 '14 at 09:40
  • I don't see how this is a practical system administration issue that needs to be solved either - it's more a do my research for me thing. – user9517 May 09 '14 at 09:40
  • @Iain - at first I thought I don't have access to those specs (now, following your link, I can see they're available). But even now, IEEE 802 is like tens of documents - if someone knows the answer already, it'd be great. If not, I don't expect you or anyone else to do my research. I thought the whole point of StackExchange sites was to take from other's knowledge on one side, and share ours on the other. – kamituel May 09 '14 at 09:55
  • When you say `I'd like someone who actually has access to...` then you are asking for research. If you're going to do your own research then surely you should you would pay for access? As I demonstrated you don't need to pay yet you sill complain about having to read 10s of documents - how is this no 'do my research for me' ? – user9517 May 09 '14 at 10:08
  • As I said - for me, it's **a lot** for work to go through all those specs looking for an answer. For someone who already knows it, it's instant. So, if you know the answer, please share knowledge. If don't, just skip it - I don't expect you to read IEEE specs for me. – kamituel May 09 '14 at 10:34

1 Answers1

2

Please refer to this for example.

The 48-bit address (universal or local) is represented as a string of six octets. The octets are displayed from left to right, in the order that they are transmitted on the LAN medium, separated by hyphens. Each octet of the address is displayed as two hexadecimal digits.

Also, I have NEVER seen any MAC address omitting a digit.

MichelZ
  • 11,068
  • 4
  • 32
  • 59
  • 1
    Actually I have. A lot. As far as I am concerned the 6 hex-numbers seperated by colons format is the standard, but one should never assume that the digits include leading-zero's to make them 2-digit numbers each. Even though it is the standard a lot of alternatives exist. xxxx.xxxx.xxxx in particular is very popular because Cisco uses this in all it's equipment. – Tonny May 09 '14 at 10:15
  • Thank you @MichelZ for that link, it's basically what I was looking for! – kamituel May 09 '14 at 10:36
  • @Tonny - in my case, I'll probably go with strict test and reject all MAC addresses not conforming to it. If it's too much, I'll change it later. – kamituel May 09 '14 at 10:36
  • 1
    @kamituel For me it would depend on the context. If it is user-input I would allow the 3 most common formats: xx:xx:xx:xx:xx:xx (allowing 1 digit numbers, assuming they need a leading 0), xx-xx-xx-xx-xx-xx (also allowing 1 digit numbers) and xxxx.xxxx.xxxx (NOT accepting missing digits). Consider that in this case the user may be copy-pasting the mac from another application that uses another format. It's a nuisance to have to convert in that case. For a machine interface I would insist on the official format and throw an error if the caller didn't comply to the interface specification. – Tonny May 09 '14 at 20:35