Sunday, January 29, 2012

MAC Address in Ubuntu

Each Ethernet adapter on your computer has a corresponding MAC address. On Ubuntu, use the following command to display all Ethernet adapters on your computer along with a bunch of details.


$ ifconfig

eth0      Link encap:Ethernet  HWaddr c8:0a:a9:55:a5:44 
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:42

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:46879 errors:0 dropped:0 overruns:0 frame:0
          TX packets:46879 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9499263 (9.4 MB)  TX bytes:9499263 (9.4 MB)

wlan0     Link encap:Ethernet  HWaddr 70:f1:a1:5f:e4:1f 
          inet addr:10.0.0.7  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::72f1:a1ff:fe5f:e41f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1430  Metric:1
          RX packets:91695 errors:0 dropped:0 overruns:0 frame:0
          TX packets:79413 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:75188528 (75.1 MB)  TX bytes:12304230 (12.3 MB)


Buried in those details is the MAC address. Or you could simply use


$ ifconfig | grep HWAddr


to simply list all the MAC Addresses on your computer.


Here's a sample output from ifconfig | grep HWAddr


eth0      Link encap:Ethernet  HWaddr c8:0a:a9:55:a5:44 
wlan0     Link encap:Ethernet  HWaddr 70:f1:a1:5f:e4:1f 

No comments:

Post a Comment