1. login root account 2. open terminal 3. command: sudo -i 4. command: cd /var/www/ 5. command: nano getmac.php 6. following copy and pate to getmac.php "", "MAC_ADDR" => ""); function ReadMacAddressUbuntuCommand() { global $Result; if (strtoupper(substr(PHP_OS, 0, 3)) === 'LIN') { $ifconfigResult = shell_exec("/sbin/ifconfig -a | grep -o -E '([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})'"); if ($ifconfigResult != null) { $macAddress = trim($ifconfigResult); if ($macAddress != "") { $Result["STATUS"] = "OK"; $Result["MAC_ADDR"] = $macAddress; } } else { $Result["STATUS"] = "CANNOT_GET_MAC_ADDRESS"; } } else { $Result["STATUS"] = "NOT_UBUNTU_SYSTEM"; } } if (isset($_REQUEST["CMD"]) && $_REQUEST["CMD"] == "GETMAC") { // First test read a fixed txt file $FixMacAddressFile = "./StationMacAddress.txt"; $MacAddressFile = fopen($FixMacAddressFile, "r"); if ($MacAddressFile) { $MacAddressFixed = rtrim(fread($MacAddressFile, filesize($FixMacAddressFile))); fclose($MacAddressFile); if (preg_match('/^(?:(?:[0-9a-f]{2}[\:]{1}){5}|(?:[0-9a-f]{2}[-]{1}){5}|(?:[0-9a-f]{2}){5})[0-9a-f]{2}$/i', $MacAddressFixed) == 1) { $Result["STATUS"] = "OK"; $Result["MAC_ADDR"] = $MacAddressFixed; } else { ReadMacAddressUbuntuCommand(); } } else { ReadMacAddressUbuntuCommand(); } } echo json_encode($Result); ?> 7. Press keyboard: Ctrl + X >>>>> enter : Y >>>>>>>>>>> Press : Enter 8. Commnd: ip addr show (this is check MAC address ) f4:8e:38:d6:88:5f 9. Copy the MAC address 10. Command : nano StationMacAddress.txt 11. paste the mac address StationMacAddress.txt than save and exit like step 7 12. Command: service apache2 restart 13. open browser and input this url localhost:8888/getmac.php?CMD=GETMAC in address bar, if success and will show the mac address