In case that avahi-browse didn't work , you need to install it
About arp-scan, maybe you will need to change which device scan.
On my Rasberry Pi, if I want to scan the network, I had to set the interface to wlan0 or br0 on my other Pi.
So I made a little script in python to decipher what avahi-browse output
avahiScan.py
Code: Select all
import sys
import subprocess
cmd = ["avahi-browse", "-a","-r","-p","-t"]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
IPv6=0
IPv4=0
IPDict={}
for line in iter(p.stdout.readline,b''):
#check for the term .local
if line.find('.local'):
sline=line.split(';')
if len(sline) >7:
#now let's checkIP
if not (sline[7] in IPDict):
#ok let's add it
IPDict[sline[7]]= [sline[1] , sline[6].replace('.local','')]
if ':' in sline[7]:
IPv6 = IPv6 + 1
else:
IPv4 = IPv4 + 1
# ok let's print it
if (IPv6+IPv4) == 0:
print('No unit found!')
Header = ['\nIPv4:' , '\nIPv6:']
NCount = [ IPv4 , IPv6]
WhatChar = [ '.' , ':']
IPSpacing = [ '16' , '40']
for idx in range(2):
if NCount[idx] == 0:
continue
print(Header[idx])
for ip in IPDict:
if WhatChar[idx] in ip:
print("{IP: <{fill}} : {device:<5} : {name}".format(IP=ip,fill=IPSpacing[idx],device=IPDict[ip][0],name=IPDict[ip][1]))
It takes around 6 seconds to get the answer
Code: Select all
pi@raspberrypi:~ $ python avahiScan.py
IPv4:
169.254.37.199 : eth0 : raspberrypi
10.11.12.119 : br0 : NAS1
10.11.12.193 : br0 : Pi2
10.11.12.123 : br0 : raspberrypi
169.254.16.177 : wlan0 : raspberrypi
10.11.12.191 : br0 : robot
10.11.12.192 : br0 : PiA
10.11.12.108 : br0 : MacBook-Air-de-Daniel
10.11.12.102 : br0 : NAS2
10.11.12.7 : br0 : SEC0015994608A6
10.11.12.105 : br0 : AP
IPv6:
2607:fa48:6e69:c410:50b7:53e0:b6f6:6f0c : br0 : raspberrypi
2607:fa48:6e69:c410:ba27:ebff:fec5:1b3e : br0 : AP
2607:fa48:6e69:c410:d6:6ff:fec0:d15f : br0 : NAS1
pi@raspberrypi:~ $