No, you cannot extract the MAC address from the ICMP response.
You can only determine the MAC addresses of the connected machines near you. In ICMP (tracert), you can simply find out the IP address of the target or middle machine.
If you want to determine MAC addresses, you should use ARP-protcols, where applicable on local networks, not the Internet.
ICMP starts after the IPv4 header [ 1 ], and the MAC addresses are associated with the physical / link layer. In low-level layers, MAC addresses will be transparent from higher-level layers such as network (IP) or transmission, ...
To determine the MAC addresses, you must use Raw sockets or the PCAP SDK to access the lower layers of network programming. (I say again, they are not useful over the Internet)
source share