Mac address on linux how to find

How to Find Your MAC address in Ubuntu and Other Linux Distros

When you are learning networking or troubleshooting it, you would need to know the MAC address.

A computer can have more than one MAC address. It is because the MAC address is a core part of networking, and each networking peripheral device has its own MAC address.

So, your WiFi card has a MAC address, and so does the Ethernet (LAN) port. Even the Bluetooth has one.

The MAC address, also known as the physical address, is a 12-digit hexadecimal code (48-bits) and is represented as MM:MM:MM:SS:SS:SS

In this tutorial, I’ll share the steps for finding the MAC address of your desired networking interface in Linux. I’ll show both command line and GUI methods.

Method 1: Find MAC address using command line

There are serveral Linux networking commands that can be used to get the MAC address of the WiFi or LAN cards.

Open up your terminal and use the following command, and it will bring the address of the present network cards in your system:

And you’ll be met with the following output:

use ip link command to show mac address

Generally, the wireless device names will be wlan0, wlan1, wlan2, wlo0, wlo1, and wlo2, whereas the Ethernet (wired device) will probably have eth0, eth1, eno0, eno1,enpls0, or enpls1.

You can find the MAC address of each device at the last line of the device description, followed by link/ether and it’s 52:54:00:5c:92:bf in my case.

Get the MAC address of Bluetooth

As I mentioned earlier, all networking devices have a physical address. If you want to see the MAC address of your Bluetooth adapter, you can use this command:

You can see it beside the BD Address field.

[email protected]:~$ hciconfig hci0: Type: Primary Bus: USB BD Address: DC:41:A9:FB:7A:C4 ACL MTU: 1021:4 SCO MTU: 96:6 UP RUNNING RX bytes:17895787 acl:275 sco:250783 events:298882 errors:0 TX bytes:303664302 acl:295384 sco:249895 commands:3380 errors:0

You can also use the bluetoothctl command here.

Method 2: Get MAC address using GUI

If you’re afraid of using the terminal you can use the network settings to get the MAC address details.

I am using Ubuntu with the GNOME desktop environment. If you use some other desktop environments, the screenshots may not look the same.

First, search for settings in the system menu and open the first result.

search for settings in system menu

Now, for the left menu bar, select Network and click on the little gear icon located near to wired network toggle. Even if you’re not connected to a wired network, you can still follow the same approach.

Читайте также:  Проверка драйверов видеокарты linux

select networks and click on gear icon

If you’re on Wi-Fi, there will be an option for Wi-Fi in the left menu bar. From there, you have to follow the same approach (clicking on the gear icon) to get your MAC address.

Once you click on the gear icon, you’ll be met with details of the selected network interface. Here, the MAC address is given as the Hardware address.

find mac address using gui

Here you have it in the easiest way possible!

Final Words

Did you know that the first half of hexadecimal code (24 bits) is used to represent the manufacturer of your network adapter?

Finding a MAC address in Linux is quite easy as you have seen it here. On the same note, you may like to learn about changing the MAC address in Linux.

Let me know if you have any questions or suggestions.

Источник

How to Find Network MAC Address in Linux System

The term MAC Address is a derived abbreviation for Media Access Control Address. The network interface controller (NIC) uses the MAC address as its assigned unique identifier within an existing network segment.

To practically relate to or understand what a MAC address is, think of it as the postal or physical address to a house. The house in this case is the network interface controller (NIC).

There is a key difference between MAC address and IP address and therefore we should not confuse the two. MAC address identifies the device you are using since it is imprinted on the device hardware whereas IP address identifies the connection status among devices seeking to communicate on an existing/configured network.

The MAC address of any device is represented by a 12-digit hexadecimal number. Its display includes a colon or hyphen after every two MAC address digits for easy readability.

For instance, a MAC address can be represented in the following manner.

aa:bb:cc:dd:ee:ff or gg-hh-ii-jj-kk-ll

Approaches to Finding MAC Address in Linux

Depending on the number of network interfaces on your Linux machine like Wi-Fi built-in and Ethernet port, your computer can be associated with more than one MAC Address.

1. Find Linux System Mac Address Using IP Command

The ip command is part of the iproute2 package and can be used to display both the MAC address and IP address of your Linux-powered machine using either of the following commands.

$ ip addr or $ ip address or $ ip address show

Find Linux System MAC Address

Depending on the network adapter or interface present, we can see the availed MAC addresses. In the above screen capture, three distinct MAC addresses can be identified from the ip address command.

Another useful command is the ip link which only focuses on the MAC address and does not display the IP addresses.

Show Linux System MAC Address

2. Find Linux System Mac Address Using Ifconfig Command

The ifconfig command is another effective approach to identifying the MAC address of your Linux machine. We however need to install it first since it is a member of the net-tools package and not installed on Linux by default.

$ sudo apt install net-tools [On Debian, Ubuntu and Mint] $ sudo yum install net-tools [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo emerge -a sys-apps/net-tools [On Gentoo Linux] $ sudo pacman -S net-tools [On Arch Linux] $ sudo zypper install net-tools [On OpenSUSE]

Once installed, run the ifconfig command to find the IP address and MAC address of your Linux system.

Читайте также:  Uncompressing files in linux

Check Linux System MAC Address

Different network interfaces or adapters showcase different MAC addresses as highlighted in the above screen capture.

We have successfully defined and understood how to get the MAC address(es) on our Linux machines.

Источник

How To Find MAC Address on Linux

If you are working as a system or a network administrator, you probably need to find MAC addresses everyday.

MAC addresses represent a very valuable source of information : they uniquely identify computers, more precisely network cards, over a network.

Assigned by the IEEE, MAC addresses can be equally found on Linux or Windows operating systems.

In this tutorial, you are going to learn how you can easily find your MAC address on Linux.

Whether you like running commands directly in the shell, or if you prefer the graphical interface, you will be able to find your MAC address on Linux quickly.

Find MAC Address on Linux

The easiest way to find your MAC address on Linux is to execute the “ifconfig” command with the “-a” option for “all”.

The MAC address is available in the “ether” section, concatening your OUI vendor and your OUI specific address.

For this network interface, you are presented with multiple different information :

  • Network card general information : if the card is up or down, if it is running on unicast or multicast and its MTU.
  • Layer 2 information : the information you are interested in : the MAC addresses as well as the layer 2 protocol used by the network card (in this case Ethernet)
  • Layer 3 information : most of the time, you will be dealing with TCP/IP networks. As a consequence, the layer 3 summarizes the information about your IP address (IPv4 and IPv6 addresses). You are also given your default gateway IP address and netmask address.
  • RX and TX packets : linked to the actual cable used, RX and TX entries represent the packets you are able to receive versus the packets you are able to transmit.

In this case, you are interested in the layer 2 information, more precisely the ether MAC address.

As you can see, when running the “ifconfig” command, my current MAC address is 02:42:35:54:98:2a.

The first three triplets are reserved for the OUI vendor (02:42:35 being the OUI vendor, and 54:98:2a the specific MAC address).

Note : if you are dealing with a virtual machine, or if you are currently renting a VPS, you may be assigned a virtual MAC address that is not linked to a specific vendor.

Also, if you have multiple network interfaces, they will all display their own individual addresses.

You successfully found your MAC address on Linux.

Читайте также:  Fatal error linux pci aspm h no such file or directory

However, using the “ifconfig” command is not the only way for you to get your MAC address.

Find MAC Address using ip

If you are a veteran system administrator, you are probably already very familiar with the “ip” command.

In most cases, it is used in order to determine your current IP address, but it can also be used in order to get your MAC address.

In order to get your current MAC address, execute the “ip addr” command with the “show” option.

Using this command, you will be listed with all the network interfaces available on your current server.

As you can see, the result is pretty much the same than the one from the previous section (3a:2c:fb:46:63:be).

Using OUILookup, you are now able to search for your OUI vendor and have some more information about their location.

Find MAC Address by navigating the filesystem

As you probably already know, on Linux, everything is a file.

As a consequence, a lot of information is stored directly in plain files accessible by users on the filesystem.

Luckily for you, the MAC address can be accessed that way.

In order to find your MAC address on Linux, navigate to the «/sys/class/net» and identify the interface card you are interested in.

Now that you have identified the network interface you are interested in, open the content of the “address” file in this symbolic link.

$ cat /sys/class/net/eth0/address

Congratulations, you have successfully identified your MAC address on your filesystem.

You can now use our website in order to identify the vendor associated with this MAC address.

Relationship between MAC and ARP

Now that you have identified your MAC address, you can use this information in order to troubleshoot network issues.

As a quick reminder, the MAC identifier is used by the ARP protocol in order to establish connections between nodes over a private local network (or LAN network).

Most of the time, this information will be used by switches (which are layer 2 devices) on your network.

Switches will store this information using an ARP table containing a mapping between IP addresses and MAC addresses.

However, switches are not the only ones to have an ARP table : your local server does also.

If you are interested in the MAC addresses currently stored locally on your server, hit the “arp” command in order to see your current cache.

Great, now you know all the MAC addresses that are cached in your server!

Conclusion

In this tutorial, you learnt how you can easily find your MAC address on Linux.

You also learnt about the relationship between your MAC address and the ARP protocol, that is used every single day for private network communication.

If you are interested in MAC addresses, you should probably head over to our blog section as we have many other tutorials on the same subject over there.

You can also check our articles :

Icons made by Smashicons and FreePik from Flaticon.

Источник

Оцените статью
Adblock
detector