Popular blog tags

mDNS-Discovery-ConsoleApp.Client - mDNS智能设备(客户端)

Published

Enabling mDNS in my device via avahi-daemon

Start by installing the Avahi Daemon on the device:

$ sudo apt install avahi-daemon
$ sudo systemctl restart avahi-daemon

Now that you have Avahi on the device, identify its hostname by running (again on the device):

$ hostnamectl
 

 Static hostname: nano
         Icon name: computer
        Machine ID: a3d9197b765643568af09eb2bd3e5ce7
           Boot ID: e8dd6897fedd4e5cbbe255ecd86a5d47
  Operating System: Ubuntu 18.04.5 LTS
            Kernel: Linux 4.9.140-tegra
      Architecture: arm64

$ sudo systemctl restart avahi-daemon

In line 1 we change the hostname to nano, in line 3 we verify that the name has been successfully changed and in line 11 we restart the mDNS server so that the change takes effect.

Finally verify that you can ping your device from your PC:

$ ping nano.local

PING nano.local (192.168.0.3): 56 data bytes
64 bytes from 192.168.0.3: icmp_seq=0 ttl=64 time=0.638 ms
64 bytes from 192.168.0.3: icmp_seq=1 ttl=64 time=1.187 ms