G
I came across this thread while trying to solve this problem and found the above answer not to work for me. 'ethtool' is not installed by default and is not found in the opkg package manager. I wish to avoid installing packages if avoidable anyway. I hope my solution is useful to someone.
My solution:
ifconfig | grep 'eth0 ' | cut -d ' ' -f 11
How it works:
On my Omega2, ifconfig returns a set of information about 4 network interfaces, br-wlan, eth0, eth0.1 and lo. I chose to extract the MAC address of 'eth0'. The output of ifconfig is piped into the grep command which extracts only lines containing 'eth0 ' (note the space on the end, it eliminates 'eth0.1'). The output of grep is only one line and it contains the search term, the MAC address we're looking for and other information we do not need. This is piped into 'cut' with arguments to make it to treat space characters as column delimiters and return only the 11th column.
Limitations:
I had hoped to come up with a cross platform solution but this has certain expectations of the output of ifconfig. For instance, it doesn't work on MacOS. If you're hoping to develop on another machine and test on the Omega2, you might want to use some kind of platform detection.