- What is a MAC address?
- Finding the IP and MAC address using the command-line
- The IP command
- Finding the IP address in Linux systems
- Finding the MAC Address in Linux systems
Media Access Control (MAC) Address
The MAC address, also known as Media Access Control address, is a unique and separate hardware number of a particular computer, especially in a LAN (Local area network) or in other networks. When you are connected to the Internet as a host or your computer is connected to the Internet, the IP address of your computer is linked to the physical MAC address of the computer on a LAN. The MAC address is the same as the Ethernet address on the Ethernet LAN. In telecommunication protocols, the media access control, which is the sublayer of the data-link layer, uses the MAC address. For each type of device, there is a different MAC sublayer. In the DLC layer, the other sublayer is a logical link control sublayer.
Next, we will show you how to find the IP and MAC addresses of a device with the help of the command-line in Linux.
Finding IP and MAC Address Using the Command-Line
With the help of the IP command, you can find both the IP and MAC address of your network connection. Here, we will discuss the networking command IP in Linux. The network parameters of Linux are useful to withdraw by using this command. This command will work on different Linux systems, such as Kali Linux, Arch Linux, Fedora, Ubuntu, etc.
The IP command
The IP command replaces the ifconfig command, which is part of the net-tools package. The IP command is very strong and powerful. The syntax of the IP command is written as follows:
In the above command, the xx will be replaced by the following two to obtain the preferred result. These operators include:
-s, which is used to show more information related to the command
-V, which is used to show the ip utility version
To check IP address in Kali Linux, enter the ifconfig command, as shown below:
Finding the IP Address of a Linux System
To list each of the IP addresses of a system, write the following command in the terminal:
This command will display all the IP addresses with their device names that are currently available. If someone does not like the default IP address connected to the internet, then they can use a grep parameter. The parameter can be written as shown below:
$ ip route list |grep default
Another option is to use the device name, but in this case, it is essential to use the names of the particular network devices. To do this, enter the following command:
Here, you will see that the Ethernet connection is eth0, while wlp2s0 represents the wireless connection. We will use the eth0 in this example:
Finding the MAC Address of a Linux System
Any network device has a critical parameter, such as a MAC address, that will also include the hardware of the computer or a server. There is a unique MAC address for each device on the network that is connected to the computer.
Enter the ip link command into the terminal, as shown below:
The ip link utility lists several parameters for a device. There are two lines for each of the devices for the link-state and their properties. The first line will show the current state of the particular device, the maximum transmission unit, a set of flags on the device, etc. Similarly, the second line will indicate the current MAC address or the type of link layer currently in use. The previous example found the MAC addresses of the two LAN connections currently in use.
This tutorial showed you how to look up MAC addresses in Linux. The commands in this article work with many distros, including Kali, Arch, and Ubuntu Linux machines.