DeutschEnglish

Submenu

 - - - By CrazyStat - - -

19. April 2016

Linux: Find the MAC address of your wireless adapter like wlan0

Filed under: Linux — Tags: , , , , , , , , , , , , — Christopher Kramer @ 14:57

You tried ifconfig and iwconfig, but they all don’t show you the MAC address of your wireless adapter under Linux? For me, on Arch Linux and Ubuntu. This is what gives you what you want and its so beautifully short and simple:

ip addr

The MAC address comes after “link/ether”. This works for wired ethernet adapters (eth0 etc.), wireless adapters (wlan0 etc.) and any other ethernet device  (e.g. IEEE 802.11s mesh point devices).

If you are on Windows, read my old blog post about getting the MAC address on Windows.

Hope this helps somebody to find it a little faster.

Recommendation

Try my Open Source PHP visitor analytics script CrazyStat.

6 Comments »

  1. Why not use

    ifconfig

    instead?

    Comment by Tobias — 6. May 2016 @ 10:19

  2. @ Tobias: ifconfig does not always list all interfaces. For me, it lists lo, eth0 and wlp3s0 (which is my PCI express wifi adapter). But it does not list my USB wifi adapters wlan0, wlan2, wlx7cdd….
    (Yes I have a couple of different wifi adapters as I am doing wifi experiments…)

    Maybe it only lists adapters in managed mode (some of my adapters are in monitor mode, some in mesh mode, some in managed mode). Or it only lists adapters that are Ethernet adapters. Because a wifi adapter is not necessarily an Ethernet adapter. It becomes one e.g. once it is connected in managed mode. But for example in monitor mode, it is not an Ethernet device, only an IEEE 802.11 device. Still, it has a MAC address.

    I found “ip addr” always lists all wifi devices. iwconfig also does, but it does not print the MAC address.

    Another possible command is “iw dev”, if iw is installed.

    Comment by Christopher Kramer — 6. May 2016 @ 12:02

  3. @Tobias: And, of course, because ifconfig is deprecated 😉
    http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2

    Comment by Christopher Kramer — 6. May 2016 @ 12:07

  4. “They *should* be deprecated […]”

    I have never had a network interface not listed in the ifconfig output.

    Comment by Tobias — 9. May 2016 @ 16:32

  5. @Tobias: It depends on the distro. For Arch, net-tools are officially said to be deprecated for years:
    https://www.archlinux.org/news/deprecation-of-net-tools/

    Also, some man pages like this http://linux.die.net/man/8/ifconfig say:
    “This program is obsolete! For replacement check ip addr and ip link. For statistics use ip -s link.”

    But of course, as long as ifconfig is present in your system and it gives you what you are searching for, that’s fine. I just noticed that it does not do the job for me any longer.

    Comment by Christopher Kramer — 9. May 2016 @ 17:09

  6. how can I get mc address on my windows? kindly clear out my doubts regarding on this topic.it is very important to get aware of this types of things.

    Comment by Skype for business tech support — 18. June 2018 @ 18:45

RSS feed for comments on this post. TrackBack URL

Leave a comment