How do I get the ethernet address of a network interface? To find the ethernet address of a network interface requires using the DLPI ethernet ioctls. The following program shows how to issue the low-level ioctl to read the ethernet address of the interface. #include #include #include #include #include int main(int argc,char *argv[]) { int fd, status; struct strioctl strcmd; unsigned char addr[6]; fd = open(argv[1],0,0); if (fd == -1) { perror("enaddr: open"); exit(1); } strcmd.ic_cmd = DLIOCGENADDR; strcmd.ic_timout = 0; strcmd.ic_len = sizeof(addr); strcmd.ic_dp = addr; status = ioctl(fd,I_STR,&strcmd); if (status == -1) { perror("enaddr: ioctl"); exit(1); } printf("%02.2x:%02.2x:%02.2x:%02.2x:%02.2x:%02.2x\n",addr[0],addr[1],addr[2],addr[3],addr[4],addr[5]); } Save the file then do the following. # cc -D_KMEMUSER a.c -o enaddr # # netstat -in Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Collis lo0 8232 127.0.0.0 127.0.0.1 0 0 0 0 0 ie0 1500 129.134.36 129.134.36 5204 0 619 0 0 # ./enaddr /dev/ie0 00:00:c3:02:64:ab Here we see that the ie0 interface's ethernet address is 00:00:c3:02:64:ab. For more information see DLioctl(3).