Networking Tips & Tools: mDNS, Zeroconf, link-local
This article briefly goes over some basic tools available to help discover an Ouster Sensor on your network.
Command Line Tools
Linux
avahi-browse:
This is a tool built into Ubuntu to help find mDNS (multicast Domain Name System) services that are on your network.
Example usage
avahi-browse -lrt _roger._tcp
NOTE: Ouster sensors advertise on mDNS with the service type
_roger._tcp
. So this command tells avahi-browse to resolve all services of type_roger._tcp
. Any sensors that you have connected on any interface will report back their hostnames, IPv6 and IPv4 addresses, as well as a text field with sensor information (serial number, part number, etc)
ping6:
This is a ping tool for IPv6 addresses
Example usage:
ping6 fe80::be0f:a7ff:fe00:65%<interface>
fe80
is the link-local prefixbe0f:a7ff:fe00:65
is a unique value based on the MAC address of the sensor.<interface>
is the Linux name of the interface the sensor is on. i.e.eth0
Don’t forget that
%
between theaddress
and the<interface>
curl:
curl
(client URL) is a tool for accessing data via URLsThe Ouster Sensors host a web server that can be queried with
curl
Example usage for IPv6 link-local:
curl -6 "[fe80::be0f:a7ff:fe00:65%eth0]/api/v1/system/network" | jq -S
nmcli:
nmcli
(Network Manager Command-Line) is a tool to show connections and devices on your machine.nmcli conn show
shows connections
nmcli conn dev
shows devices
macOS/Windows
dns-sd:
This tool work similar to
avahi-browse
on Linux but is for macOSExample usage
dns-sd -B _services._dns-sd._udp
Browses a list of all services on the network including Ouster sensors
dns-sd -B <Service Type>
<Service Type> for our sensors is
_roger._tcp
Browses a list of sensors on your network
dns-sd -L "<Instance Name>" <Service Type>
Resolves information about a specific sensor name <Instance Name>
Python
Python socket
library:
Can quickly get the IPv6 and IPv4 addresses of a sensor from its hostname
Example terminal usage:
python3
, starts a Python 3 interpreterIn the Python 3 Interpreter use these commands:
import socket socket.getaddrinfo( '<hostname>', <port_number>) # set <port_number> to 0 to search all ports
Example output below:
python-zeroconf:
This is a multicast DNS Service Discovery tool for Python
Install command:
pip install zeroconf
pyinstaller:
PyInstaller freezes (packages) Python applications into stand-alone executables, under Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and AIX.
Install command:
pip install pyinstaller
Example usage:
pyinstaller yourprogram.py