Show Mac For Ip



In this article, I will take you through different ways to List/Get/Display/Find MAC Address in Linux. You might be aware of Ethernet Card/Network Card/NIC Controller which works at Network level and is responsible for communicating with other network devices in a Network Topology. It is used in Layer-2 Communication. You can find the usage of MAC address in wide range of Network Devices currently in use. This is typically in-line with IEEE 802 Network technologies.

Check your IP address on Show My IP instantly with other details like the country, state and the city that IP is located in. However, computers connected to the same TCP/IP local network can determine each other's MAC addresses. The technology called ARP - Address Resolution Protocol included with TCP/IP makes it possible. Using ARP, each computer maintains a list of both IP and MAC addresses for each device it has recently communicated with.

What is MAC Address

MAC is abbreviated as Media Access Control. It is a unique 48 bit(6-byte) address assigned to a Network Interface. It is almost used in all the Network Devices which has network controller in it. It will always show in this form 00:07:Y7:1C:6L:03.

Find MAC Address in Linux

Also Read:25 Useful Linux SS Command Examples to Monitor Network Connections

Method 1: How to find MAC Address in Linux Using ifconfig command

If you want to check MAC Address of all the network interfaces in Linux using our traditional ifconfig command then you need to use ifconfig -a command as shown below.

NOTE:

Please note that here I am using root user to run all the below commands.You can use any user with sudo access to run all these commands. For more information Please check Step by Step: How to Add User to Sudoers to provide sudo access to User.

Method 2: How to find an ethernet MAC Address in Linux Using ifconfig command

If you want to check the MAC Address of a specific network interface using ifconfig command then you need to use network interface name with ifconfig command as shown below. Here we are checking MAC Address of interface enp0s3 using ifconfig enp0s3 command.

NOTE:

Please note that you might find eth0 network interface in your system instead of enp0s3. Hence Please use the network interface name with all the mentioned commands as per your system interface name or else none of the command will work.

Method 3: How to find MAC Address in Linux Using ip addr sh command

If you want to check the MAC address of all the network interfaces then you need to simply use ip addr sh command and check the MAC address from ether field as shown below.

Method 4: How to find an ethernet MAC Address in Linux using ip addr sh command

If you want to check the MAC address of some specific network interface then you need to use the interface name with ip addr sh command and check the MAC address from ether field as shown below. In this example we are checking MAC address of enp0s3 network interface.

Method 5: How to find MAC Address in Linux Using ip link show command

If you want to check the MAC address of all the network interfaces then you can use another useful ip link show command and check the MAC address from link/ether field as shown below.

Method 6: How to find an ethernet MAC Address in Linux using ip link show command

If you want to check the MAC address of some specific network interface then you need to use the interface name with ip link show command and check the MAC address from ether field as shown below. In this example we are checking MAC address of enp0s3 network interface.

Method 7: How to find MAC Address in Linux using ethtool command

You can also use another useful linux tool called ethtool to find MAC address in Linux as shown below. Here I am checking MAC address of my ethernet card enp0s3 using ethtool command hence you need to mention your Interface name before running below command.

Method 8: How to find MAC Address in Linux using Regex with ifconfig command

You can use a simple grep regular expression with ifconfig command to find the MAC Address of an ethernet card in Linux as shown below. Like above example, Here I am using regular expression on my System enp0s3 interface so you need to change and mention your interface name instead of enp0s3 before running below command.

Method 9: How to find MAC Address in Linux using SYS Files

If you want to check MAC address in Linux using SYS files you need to check network address file using below cat command. As mentioned below SYS file is a text file so its contents can always be seen through Linux cat command.

Method 10: How to find MAC Address in Linux using AWK Regex with ifconfig command

You can also use AWK regular expression with ifconfig command to find MAC Address in Linux as shown below. Here we are grepping ether keyword from ifconfig command and then piping to awk to get first and second column output separated by tab.

Method 11: How to find MAC Address in Linux using Sed Regex with ifconfig command

Like above example, you can also use Sed Regular expressions with ifconfig command to find MAC Address in Linux as shown below.

Popular Recommendations:-

Overview

This document describes how to display interface MAC addresses.

Details

The various CLI commands provided below, will display the MAC addresses of the Palo Alto Network interfaces including an HA cluster.

For example to display the MACs for all interfaces on the Palo Alto Networks:

Show

> show interface all


total configured hardware interfaces: 15
name id speed/duplex/state mac address
-------------------------------------------------------------------------------
ethernet1/1 16 1000/full/up 00:1b:17:05:2c:10
ethernet1/2 17 1000/full/up 00:1b:17:05:2c:11
ethernet1/3 18 unknown/unknown/down 00:1b:17:00:0b:12
ethernet1/4 19 unknown/unknown/down 00:1b:17:00:0b:13
ethernet1/5 20 1000/full/up 00:1b:17:00:0b:14
ethernet1/6 21 1000/full/up 00:1b:17:00:0b:15
ethernet1/7 22 unknown/unknown/down 00:1b:17:00:0b:16
ethernet1/8 23 100/full/up 00:1b:17:00:0b:17
ethernet1/9 24 100/full/up 00:1b:17:00:0b:18
ethernet1/10 25 100/full/up 00:1b:17:00:0b:19
ethernet1/11 26 unknown/unknown/down 00:1b:17:00:0b:1a
ethernet1/12 27 unknown/unknown/down 00:1b:17:00:0b:1b
vlan 1 [n/a]/[n/a]/up 00:1b:17:00:0b:01
loopback 3 [n/a]/[n/a]/up 00:1b:17:00:0b:03
tunnel 4 [n/a]/[n/a]/up 00:1b:17:00:0b:04

total configured logical interfaces: 21

To display an individual interface indicate the specific interface in the following command:

> show interface ethernet1/1

For example:

> show interface ethernet1/1

-------------------------------------------------------------------------------
Name: ethernet1/1, ID: 16
Link status:
Runtime link speed/duplex/state: 1000/full/up
Configured link speed/duplex/state: auto/auto/up
MAC address:
Port MAC address 00:1b:17:05:2c:10
Operation mode: ha
-------------------------------------------------------------------------------
Name: ethernet1/1, ID: 16
Operation mode: ha
Interface IP address: 2.2.2.2/24
Interface management profile: N/A
Service configured:
Zone: N/A, virtual system: N/A

Show

-------------------------------------------------------------------------------
Physical port counters read from MAC:
-------------------------------------------------------------------------------
rx-broadcast 0

The following command displays the MAC addresses of an HA cluster:

> show high-availability state

For example:

> show high-availability state

Group 1:

Local Information:

Version: 1

State: active

Priority: 200

Preemptive: False

Platform Model: PA-4050

Version information:

Build Release: 3.0.5

URL Database: 3233

Application Content: 160-463

Threat Content: 160-463

VPN Client Software: 1.0.2

Passive Hold Interval: 10 ms

Passive Link State: auto

Hello Message Interval: 1000 ms

Management IP Address: 10.30.14.7; netmask: 255.255.255.0

HA1 IP Address: 1.1.1.2; netmask: 255.255.255.0

HA1 MAC Address: 00:30:48:5d:45:f7

HA1 encryption enabled: False

HA2 MAC Address: 00:1b:17:01:18:06

Mac show ip address terminal

Running Configuration: synchronized

State Synchronization: synchronized

Application Content Compatibility: Match

Threat Content Compatibility: Match

VPN Client Software Compatibility: Match

Peer Information:

Connection status: up

Version: 1

State: passive

Priority: 1

Preemptive: False

Platform Model: PA-4050

Version information:

Mac

Build Release: 3.0.5

URL Database: 3233

Application Content: 160-463

Threat Content: 160-463

VPN Client Software: 1.0.2

Management IP Address: 10.30.14.6

Mac Show Ip Address Terminal

HA1 IP Address: 1.1.1.1

HA1 MAC Address: 00:30:48:5d:0c:c1

HA2 MAC Address: 00:1b:17:01:14:06

Mac To Ip Address Lookup

On the L3 interfaces, the MAC address listed for an interface using the command show interface all for an HA cluster are the VMAC.

The format of the virtual MAC is 00-1B-17:00: xx: yy where

Mac Show Ip Address Terminal

  • 00-1B-17: vendor ID
  • 00: fixed
  • xx: HA group ID
  • yy: interface ID

Lookup Ip Info On Mac

The following CLI command displays VMAC and VIP for Active-Active HA cluster:

Mac To Ip Address Resolution

> show high-availability virtual-address

For example:

> show high-availability virtual-address

Total interfaces with virtual address configured: 2
Total virtual addresses configured: 2
--------------------------------------------------------------------------------
Interface: ethernet1/1
Virtual MAC: 00:1b:17:00:05:10
Virtual MAC from the peer: 00:1b:17:00:85:10
107.204.232.53 Active:yes Type:floating
--------------------------------------------------------------------------------
Interface: ethernet1/6
Virtual MAC: 00:1b:17:00:05:15
Virtual MAC from the peer: 00:1b:17:00:85:15
192.168.90.1 Active:yes Type:floating
--------------------------------------------------------------------------------

The following CLI command displays VMAC for Active-Passive HA cluster:

> show interface all

ethernet1/5 20 1000/full/up 00:1b:17:00:0b:14

In the above output example, HA Group ID = 0b Hex (11 Decimal) and Interface ID = 14 Hex (20 Decimal).

Note: The MAC addresses of the HA1 interfaces, which are on the control plane and synchronize the configuration of the devices are unique. The MAC addresses of the HA2 interfaces, which are on the data plane and synchronize the active sessions mirror each other.

owner: gcapuno