18 October 2010

Solaris HWADDRs from OBP

Occasionally, it's useful to know the hwaddr or MAC addr of an interface
without actually booting a box, such as when you are setting up a
jumpstart config for said box.  On Sun Sparc based machines, this
information can be obtained within the OpenBoot (OB) environment.
As an aside, until recent years, all network interfaces on a Sun Sparc
box had the same hwaddr, though this was configurable via setting the
'local-mac-address?' variable at obp to true or false:

        {11} ok setenv local-mac-address? true
        {11} ok printenv local-mac-address?
        local-mac-address? =    true

Newer Sun Sparc boxes tend to have 'local-mac-address?' preset to
true.  Why is this of concern?  If 'local-mac-address?' is set to false,
all interfaces will share the same hwaddr, whereas if set to true,
all interfaces hold a unique hwaddr.

The following has been culled from a Sun Fire T2000, though should
be similar on other Sparc server types.  To get a listing of network
interfaces installed on the system and select one for information,
use 'show-nets'.  Select the interface desired (in this case, 'a') and
'cd' there:

        {11} ok show-nets
        a) /pci@7c0/pci@0/pci@2/network@0,1
        b) /pci@7c0/pci@0/pci@2/network@0
        c) /pci@780/pci@0/pci@1/network@0,1
        d) /pci@780/pci@0/pci@1/network@0
        q) NO SELECTION
        Enter Selection, q to quit: a
        /pci@7c0/pci@0/pci@2/network@0,1 has been selected.
        Type ^Y ( Control-Y ) to insert it in the command line.
        e.g. ok nvalias mydev ^Y
                 for creating devalias mydev for /pci@7c0/pci@0/pci@2/network@0,1
        {11} ok cd /pci@7c0/pci@0/pci@2/network@0,1

To get the interface hwaddr, use '.properties' and look for the entry
'mac-addresses', which should be close to the top:

        {11} ok .properties
        local-mac-address        00 14 4f 7e 17 f1
        mac-addresses            00 14 4f 7e 17 f1
        assigned-addresses       82070110 00000000 03020000 00000000 00020000
                                 81070118 00000000 00001020 00000000 00000020
        compatible               pciex8086,105e.108e.105e.6
                                 pciex8086,105e.108e.105e
                                 pciex8086,105e.6
                                 pciex8086,105e
                                 pciexclass,020000
                                 pciexclass,0200
        reg                      00070100 00000000 00000000 00000000 00000000
                                 03070110 00000000 00000000 00000000 00020000
        max-frame-size           00010000
        address-bits             00000030
        device_type              network
        name                     network
        interrupts               00000002
        cache-line-size          00000010
        class-code               00020000
        subsystem-id             0000105e
        subsystem-vendor-id      0000108e
        revision-id              00000006
        device-id                0000105e
        vendor-id                00008086

Below, the same process as above has been repeated on the same T2000
host, however, choosing a different interface, illustrating the separate,
unique hwaddr since 'local-mac-address?' is set to true:

        {11} ok show-nets
        a) /pci@7c0/pci@0/pci@2/network@0,1
        b) /pci@7c0/pci@0/pci@2/network@0
        c) /pci@780/pci@0/pci@1/network@0,1
        d) /pci@780/pci@0/pci@1/network@0
        q) NO SELECTION
        Enter Selection, q to quit: d
        /pci@780/pci@0/pci@1/network@0 has been selected.
        Type ^Y ( Control-Y ) to insert it in the command line.
        e.g. ok nvalias mydev ^Y
                 for creating devalias mydev for /pci@780/pci@0/pci@1/network@0
        {11} ok cd /pci@780/pci@0/pci@1/network@0
        {11} ok .properties
        local-mac-address        00 14 4f 7e 17 ee
        mac-addresses            00 14 4f 7e 17 ee
        assigned-addresses       82040010 00000000 00200000 00000000 00020000
                                 81040018 00000000 00000000 00000000 00000020
        compatible               pciex8086,105e.108e.105e.6
                                 pciex8086,105e.108e.105e
                                 pciex8086,105e.6
                                 pciex8086,105e
                                 pciexclass,020000
                                 pciexclass,0200
        reg                      00040000 00000000 00000000 00000000 00000000
                                 03040010 00000000 00000000 00000000 00020000
        max-frame-size           00010000
        address-bits             00000030
        device_type              network
        name                     network
        interrupts               00000001
        cache-line-size          00000010
        class-code               00020000
        subsystem-id             0000105e
        subsystem-vendor-id      0000108e
        revision-id              00000006
        device-id                0000105e
        vendor-id                00008086