I have outlined a working solution above. From my Debian KVM hypervisor, farlap, nmap(1) identifies my FreeBSD VM gunsynd:Well... An all working solution isn't there.
Code:
[farlap[1799] sudo nmap -sn 192.168.1.0/24
...
MAC Address: 52:54:00:00:04:8F (QEMU virtual NIC)
Nmap scan report for gunsynd.my.domain (192.168.1.30)
...
Not particularly relevant. If you have no control of the DHCP server used for the subnet, I suggested "allow the DHCP server to allocate the IP address dynamically" above.You cannot suppose you know where is the DHCP server and even if it will be used
On the contrary, from the hypervisor:And even more, you still don't know the MAC address of the VM
Code:
[farlap.1800] $ uname -a
Linux farlap 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.38-2 (2023-07-27) x86_64 GNU/Linux
[farlap.1801] # cd /etc/libvirt/qemu
[farlap.1802] # grep "mac address" gunsynd.xml
<mac address='52:54:00:00:04:8f'/>
Code:
[gunsynd.131] $ uname -a
FreeBSD gunsynd.my.domain 13.3-RELEASE-p7 FreeBSD 13.3-RELEASE-p7 GENERIC amd64
[gunsynd.132] $ ifconfig vtnet0 | grep ether
ether 52:54:00:00:04:8f
You can change the MAC address of most NICs (virtual or physical) if you really want to. What I said was that the "MAC address of the guest virtual NIC is a static thing", as it is allocated when a VM is created and continues with that value for life unless someone deliberately changes it. Thus, in that regard, the MAC value for a VM behaves exactly like a conventional hardware NIC.furthermore it can be changed.