How to Get MAC Address Linux Computers Generate
The Media Access Control address, also known as the MAC address, is a unique number that comes on every computer. One can also think about it as a hardware number.
Now, if you are wondering what the purpose of a MAC address is, the answer is a bit tricky. The number is inseparable from an internet connection.
For example, if your computer is connected to Wi-Fi or is part of a local area network, the IP address becomes linked to the Media Access Control address. A similar thing applies to Ethernet and Ethernet LAN - addresses are identical.
Why MAC Addresses Exist
Since computers already have multiple unique identification methods, it might seem like the MAC address is redundant. There is some truth in that statement, but redundancy disappears when we are talking about local area networks, particularly those that have dynamic IPs.
Computers need to have a MAC address to avoid potential problems. Say that there is a packet targeting a particular computer connected to a network with dynamic IPs. If the packet comes more than once, imagine what would happen if the original computer went offline and another device took the IP address.
The system would become a bit of a mess, and the packet would get lost. This is where the MAC address comes in, letting the device (computer) identify itself to a packet.
As a computer owner, you might be tempted to tinker with the system settings to modify the gimmick or find out the MAC address. For instance, on Mac OS Terminal or the Control Panel on MS Windows as those seem like the obvious methods, right? Well, not necessarily.
And in the case of Linux, the process is a bit tricky. To get MAC address Linux computers have, you need to put quite a lot of effort.
IP Command
As a Linux user, you should already be aware of commands used to carry out various tasks. To find out the Mac address, you will have to use the IP command.
Note that this command will reveal not just the Media Access Control information but also your IP address. Also, the command is applicable to various Linux systems, such as Fedora, Ubuntu, Kali, etc.
So, how do you get started? Well, first, open the Terminal. Next, you will need to enter certain ipconfig commands in the Terminal.
$ sudo ifconfig
This is the basic command that you need to enter in the Linux terminal to check the IP address of the network the computer is connected to.
$ ip route list
The route list command shows different IP addresses of the device, including the device's names. In case you do not like the default IP address given to the computer, you can make the adjustments by using the grep parameter.
The command for it looks like this: "$ ip route list |grep default". Finally, you can also try the $ ip addr show command. Doing so would use the device's name rather than the IP address. However, it is important to remember that you need to stick precisely to the names given to specific network devices.
By entering the $ ip addr show command in the Linux Terminal, you will see two different phrases representing an internet connection. The first - eth0 - is for Ethernet, while wIp2s0 is for Wi-Fi, aka a wireless connection.
To continue with the process, enter either of the two commands in the Terminal:
$ ip addr show eth0
$ ip add show wIp2s0
Getting the MAC Address on Linux
As already mentioned, computers have unique MAC addresses. To get the MAC address on your Linux computer, enter the following command in the Terminal:
$ ip link show
After you enter the command, you will see two lines describing properties of your computer and an internet connection.
You can ignore the first line and focus on the second one. It shows the current MAC address as well as the current type of link layer if there is one active at the moment.
Getting the MAC Address on macOS
In case you wish to find out the MAC address on macOS, open System Preferences using the Apple menu you can find in the top-left corner of your MacBook.
Next, click on Network. After opening Network, click the Advanced button. Go to the Hardware tab, and you will see the MAC address.
Getting the MAC Address on Windows
To find out the MAC address on MS Windows, open the command prompt using "cmd" and enter "getmac" or "ipconfig /all" (without the quotation marks), and you will see a new window with the information.
As an alternative, you can open the Settings tab via Start and go to Network and Internet Connection. To get the MAC address, click on the "View your network properties" button. The Network Properties tab will include the information about Media Access Control.