Wednesday, January 14, 2015

One-liner to check (and ping6) IPv6 devices

A one-line to check IPv6 devices on your LAN:

$ ping6 -c3 -I wlan0 ff02::1 | awk ' /bytes from/ { print $4 }' | sort -u | sed 's/:$//'

fe80::1af4:6aff:fe9c:ced4
fe80::212:40ff:fe8a:8e38
fe80::66d1:a3ff:fe31:9c57
fe80::c24a:ff:fe2c:dcbc
fe80::d263:b4ff:fe00:2a61

So: 5 IPv6-enabled devices on my LAN. At least: 5 devices that react on the broadcast ping6.


You can feed that into ping6 to see if they are ping6-able:

$ ping6 -c3 -I wlan0 ff02::1 | awk ' /bytes from/ { print $4 }' | sort -u | sed 's/:$//' | awk '{ print "ping6 -c3 -I wlan0 " $1 }'  | /bin/sh | awk ' /PING/ { print $2 } /packets transmitted/ { print $0 "\n" }  '  

fe80::1af4:6aff:fe9c:ced4(fe80::1af4:6aff:fe9c:ced4)
3 packets transmitted, 3 received, 0% packet loss, time 2000ms

fe80::212:40ff:fe8a:8e38(fe80::212:40ff:fe8a:8e38)
3 packets transmitted, 3 received, 0% packet loss, time 2004ms

fe80::66d1:a3ff:fe31:9c57(fe80::66d1:a3ff:fe31:9c57)
3 packets transmitted, 3 received, 0% packet loss, time 2002ms

fe80::c24a:ff:fe2c:dcbc(fe80::c24a:ff:fe2c:dcbc)
3 packets transmitted, 3 received, 0% packet loss, time 2004ms

fe80::d263:b4ff:fe00:2a61(fe80::d263:b4ff:fe00:2a61)
3 packets transmitted, 3 received, 0% packet loss, time 2002ms

So ... they are all ping6-able.




No comments: