How can I get MAC address in ubuntu 16.04?

11,902

You can find the MAC address for your network devices with the terminal command:

sudo lshw -C network

The MAC address is called 'serial,' like this, for example:

*-network                 
       description: Ethernet interface
       product: Ethernet Connection I217-LM
       vendor: Intel Corporation
       physical id: 19
       bus info: pci@0000:00:19.0
       logical name: enp0s25
       version: 04
       serial: 11:22:33:44:aa:bb
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       <snip>

If your devices do not appear in ifconfig then they are probably not yet claimed by any drivers.

Share:
11,902

Related videos on Youtube

Jago Bangladeshi
Author by

Jago Bangladeshi

Updated on September 18, 2022

Comments

  • Jago Bangladeshi
    Jago Bangladeshi over 1 year

    I tried with several commands, but it does not work, please see the command:

    khalilullah@khalilullah-W65-67SZ:~$ sudo ifconfig
    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:65536  Metric:1
              RX packets:164 errors:0 dropped:0 overruns:0 frame:0
              TX packets:164 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1 
              RX bytes:12080 (12.0 KB)  TX bytes:12080 (12.0 KB)
    
    khalilullah@khalilullah-W65-67SZ:~$ nmcli device show enp3s0|grep -i hw
    Error: Device 'enp3s0' not found.
    
    khalilullah@khalilullah-W65-67SZ:~$ nmcli device show enp3s0 | grep -i hw
    Error: Device 'enp3s0' not found.
    
    khalilullah@khalilullah-W65-67SZ:~$ nmcli device show wlp4s0 | grep -i hw
    Error: Device 'wlp4s0' not found.
    
    
    khalilullah@khalilullah-W65-67SZ:~$ sudo ifconfig -a
    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:65536  Metric:1
              RX packets:164 errors:0 dropped:0 overruns:0 frame:0
              TX packets:164 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1 
              RX bytes:12080 (12.0 KB)  TX bytes:12080 (12.0 KB)
    
    khalilullah@khalilullah-W65-67SZ:~$ ip addr show
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
    

    How can I get MAC?

    • Simon Sudler
      Simon Sudler almost 5 years
      If ifconfig -a does not return any Ethernet device, the device is not connected or the driver is missing. Take a look into dmesg and search for issues with your network hardware
    • Rinzwind
      Rinzwind almost 5 years
      where did you get enp3s0 from?
  • bhattraideb
    bhattraideb almost 3 years
    Hi, Is serial MAC here?