On Solaris, is there a command that I can run to get the MAC address of an ethernet card without running "/sbin/ifconfig -a" as root. Running /sbin/ifconfig -a as a non root user leaves out the MAC address - go figure!
Thanks,
Paul
On Solaris, is there a command that I can run to get the MAC address of an ethernet card without running "/sbin/ifconfig -a" as root. Running /sbin/ifconfig -a as a non root user leaves out the MAC address - go figure!
Thanks,
Paul
Try an "arp -a"
, and look for your own hostname. (This works for me on the Solaris 9 machine I tried it on, but your mileage may vary.)
I know this is an older question, but another option is:
/usr/sbin/prtpicl -c network -v
the :local-mac-address
field will give you what you need. You will also be able to pull up MACs for disabled interfaces.
You can identify the port by the :instance
and :driver-name
values. I think this only works on SPARC platforms, and not x86 Solaris, but not certain.
Try "dladm" command with subcommand "show-phys" with -m option to see a list of MAC Addresses:
$ dladm show-phys -m
dladm show-linkprop -p mac-address
is the documented, definitive Solaris 11 answer (as of Sep 2017):
Check the MAC addresses of all the interfaces on the system.
...
# dladm show-linkprop -p mac-address LINK PROPERTY PERM VALUE DEFAULT POSSIBLE net0 mac-address rw 8:0:20:0:0:1 8:0:20:0:0:1 -- net1 mac-address rw 8:0:20:0:0:1 8:0:20:0:0:1 -- net3 mac-address rw 0:14:4f:45:c:2d 0:14:4f:45:c:2d --
None of the other answers are guaranteed to return the actual MAC address of all NICs on Solaris 11.
On my Solaris 11 installation, prtpicl
doesn't return any MAC address no matter what arguments I give it.
arp -an
doesn't even show all the configured physical NICs:
Net to Media Table: IPv4
Device IP Address Mask Flags Phys Addr
------ -------------------- --------------- -------- ---------------
net2 224.0.0.251 255.255.255.255 S 01:00:5e:00:00:fb
aggr0 224.0.0.251 255.255.255.255 S 01:00:5e:00:00:fb
aggr0 192.168.1.92 255.255.255.255 60:6c:66:4f:c5:c7
aggr0 192.168.1.43 255.255.255.255 b8:88:e3:f5:4c:0b
aggr0 192.168.1.45 255.255.255.255 02:08:20:93:0b:d3
net2 192.168.1.35 255.255.255.255 SPLA 00:0e:0c:72:9f:6b
net2 192.168.1.1 255.255.255.255 70:f1:96:19:5b:88
aggr0 192.168.1.5 255.255.255.255 SPLA 00:14:5e:1b:14:0a
aggr0 192.168.1.4 255.255.255.255 00:1d:09:07:5a:93
aggr0 192.168.1.6 255.255.255.255 00:14:5e:2a:75:36
aggr0 192.168.1.25 255.255.255.255 00:11:25:90:d0:07
aggr0 192.168.1.251 255.255.255.255 00:c0:b7:d2:00:60
aggr0 192.168.1.244 255.255.255.255 00:10:75:07:55:94
net2 192.168.1.244 255.255.255.255 00:10:75:07:55:94
net2 224.0.0.22 255.255.255.255 S 01:00:5e:00:00:16
aggr0 224.0.0.22 255.255.255.255 S 01:00:5e:00:00:16
aggr0 192.168.1.151 255.255.255.255 4c:66:41:af:e8:fc
net2 192.168.1.151 255.255.255.255 4c:66:41:af:e8:fc
netstat -pn
produces identical results.
aggr0
is an aggregated link of net0
and net1
, which physically are /dev/bge0
and /dev/bge1
. So what does dladm show-phys -m
show?
dladm show-phys -m
shows the MAC address of aggr0
for both net0
and net1
, not the MAC address of the underlying physical NICs:
LINK SLOT ADDRESS INUSE CLIENT
net1 primary 0:14:5e:1b:14:a yes aggr0-net1
vboxnet0 primary 8:0:27:4e:ea:4d no --
net0 primary 0:14:5e:1b:14:a yes aggr0-net0
net2 primary 0:e:c:72:9f:6b yes iprb0
Well, at least that does tell us that aggr0
is an aggregated link using net0
and net1
, but the MAC address of both net0
and net1
is the MAC address of aggr0
, not the actual physical NIC MAC address.
But dladm show-linkprop -p mac-address
shows
LINK PROPERTY PERM VALUE EFFECTIVE DEFAULT POSSIBLE
net1 mac-address rw 0:14:5e:1b:14:a 0:14:5e:1b:14:a 0:14:5e:1b:14:b --
vboxnet0 mac-address rw 8:0:27:4e:ea:4d 8:0:27:4e:ea:4d 8:0:27:4e:ea:4d --
net0 mac-address rw 0:14:5e:1b:14:a 0:14:5e:1b:14:a 0:14:5e:1b:14:a --
net2 mac-address rw 0:e:c:72:9f:6b 0:e:c:72:9f:6b 0:e:c:72:9f:6b --
estub0 mac-address ? ? ? ? ?
aggr0 mac-address rw 0:14:5e:1b:14:a 0:14:5e:1b:14:a 0:14:5e:1b:14:a --
vnic0 mac-address rw 2:8:20:da:88:79 2:8:20:da:88:79 2:8:20:da:88:79 --
vnic1 mac-address rw 2:8:20:31:af:de 2:8:20:31:af:de 2:8:20:31:af:de --
vnic2 mac-address rw 2:8:20:fb:4:e7 2:8:20:fb:4:e7 2:8:20:fb:4:e7 --
vboxbridge0 mac-address ? ? ? ? ?
samba/net0 mac-address rw 2:8:20:93:b:d3 2:8:20:93:b:d3 2:8:20:93:b:d3 --
Using awk
and sort
to display just the default MAC address of each NIC:
dladm show-linkprop -p mac-address | grep -v LINK | awk '{ print $1 " " $6 }' | sort
produces
aggr0 0:14:5e:1b:14:a
estub0 ?
net0 0:14:5e:1b:14:a
net1 0:14:5e:1b:14:b
net2 0:e:c:72:9f:6b
samba/net0 2:8:20:93:b:d3
vboxbridge0 ?
vboxnet0 8:0:27:4e:ea:4d
vnic0 2:8:20:da:88:79
vnic1 2:8:20:31:af:de
vnic2 2:8:20:fb:4:e7
Note that the default MAC address of aggr0
is the actual MAC address of net0
//dev/bge0
, but that's only because when I created the aggregate link I didn't bother to assign a different MAC address and left it the default, which per the create-aggr
section of the dladm
man page is selected from one of the interfaces that are part of the aggregation.