#network-interface #interface #network

mac_address

Cross-platform retrieval of a network interface MAC address

19 releases (stable)

1.1.8 Feb 10, 2025
1.1.7 May 22, 2024
1.1.6 Apr 16, 2024
1.1.5 May 25, 2023
0.8.0 Jul 21, 2018

#89 in Network programming

Download history 79887/week @ 2025-09-26 78418/week @ 2025-10-03 83667/week @ 2025-10-10 86695/week @ 2025-10-17 91768/week @ 2025-10-24 96757/week @ 2025-10-31 92845/week @ 2025-11-07 98525/week @ 2025-11-14 107246/week @ 2025-11-21 107593/week @ 2025-11-28 103468/week @ 2025-12-05 107081/week @ 2025-12-12 90075/week @ 2025-12-19 90196/week @ 2025-12-26 140328/week @ 2026-01-02 213144/week @ 2026-01-09

552,674 downloads per month
Used in 316 crates (88 directly)

MIT/Apache

25KB
540 lines

mac_address provides a cross platform way to retrieve the MAC address of network hardware. See the Wikipedia entry for more information.

Supported platforms: Linux, Windows, MacOS, FreeBSD, NetBSD


mac_address

crates.io Released API docs

mac_address provides a cross platform way to retrieve the MAC address of network hardware.

Supported platforms: Linux, Windows, MacOS, FreeBSD, OpenBSD, illumos

Example

use mac_address::get_mac_address;

fn main() {
    match get_mac_address() {
        Ok(Some(ma)) => {
            println!("MAC addr = {}", ma);
            println!("bytes = {:?}", ma.bytes());
        }
        Ok(None) => println!("No MAC address found."),
        Err(e) => println!("{:?}", e),
    }
}

License

mac_address is licensed under both MIT and Apache 2.0

Dependencies

~0–760KB
~13K SLoC