How to find a VM or container by MAC address in Proxmox VE

This article explains how to locate a virtual machine or container in a Proxmox VE cluster using its MAC address.

Prerequisites

  • SSH access to the Proxmox node with root privileges

Quick Method

The MAC address is stored in Proxmox configuration files. You can search directly with grep:

grep -ri "00:50:56:a1:b2:c3" /etc/pve/nodes/

Replace 00:50:56:a1:b2:c3 with the MAC address you want to search for.

Example Output

/etc/pve/nodes/pve1/qemu-server/105.conf:net0: virtio=00:50:56:a1:b2:c3,bridge=vmbr0,firewall=1

The path indicates the node (pve1), type (qemu-server or lxc), and VMID (105).

Script with Formatted Output

For more readable output that includes the VM or container name:

#!/bin/bash
TARGET_MAC="00:50:56:a1:b2:c3"

# Search in QEMU VMs
for conf in /etc/pve/nodes/*/qemu-server/*.conf; do
  if grep -qi "$TARGET_MAC" "$conf" 2>/dev/null; then
    vmid=$(basename "$conf" .conf)
    node=$(echo "$conf" | cut -d'/' -f5)
    name=$(grep -oP '^name:\s*\K.*' "$conf")
    echo "Found: VMID $vmid ($name) on node $node [QEMU]"
  fi
done

# Search in LXC containers
for conf in /etc/pve/nodes/*/lxc/*.conf; do
  if grep -qi "$TARGET_MAC" "$conf" 2>/dev/null; then
    vmid=$(basename "$conf" .conf)
    node=$(echo "$conf" | cut -d'/' -f5)
    name=$(grep -oP '^hostname:\s*\K.*' "$conf")
    echo "Found: VMID $vmid ($name) on node $node [LXC]"
  fi
done

Replace 00:50:56:a1:b2:c3 with the MAC address you want to search for.

Example Output

Found: VMID 105 (web-server) on node pve1 [QEMU]

Notes

  • The search is case-insensitive thanks to grep's -i flag.
  • This method does not require the VM to be running or have the Guest Agent installed.
  • The /etc/pve/ directory is a shared filesystem across the cluster, so you can run the command from any node and find VMs on all nodes.