Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Find Raspberry Pi in network (looking for MAC address vendor prefix of Raspberry Pi Foundation using nmap, awk for ipv4 / ping6, ip, grep for ipv6 neighbour discovery)
sudo nmap -sP 192.168.0.0/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}'
IFACE=eth0
# trigger IPv6 neighbour discovery with link-local scope multicast:
ping6 -c2 -I $IFACE ff02::1 > /dev/null
# print the results, filtered by MAC address vendor prefix of Raspberry Pi Foundation:
ip -6 neigh | grep b8:27:eb
@LuisDiazUgena

This comment has been minimized.

Copy link

LuisDiazUgena commented Mar 13, 2018

Thanks. It was very useful. I've done some small changes to recursively search until the user breaks the loop:

echo "************************"
echo "Prees [Ctrl + C] to exit"
echo "************************"
IFACE=wlan0
#IFACE=eth0
# trigger IPv6 neighbour discovery with link-local scope multicast:
ping6 -c2 -I $IFACE ff02::1 > /dev/null
# print the results, filtered by MAC address vendor prefix of Raspberry Pi Foundation:
while :
do
        ip -6 neigh | grep b8:27:eb
        sleep 30
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.