Eu gostaria de usar o link-local para conectar um dispositivo incorporado (executando systemd-networkd) a um PC (Ubuntu, Win, OS X) usando um cabo crossover (sem switch ou servidor DHCP).
Quando eu conecto em uma rede que fornece DHCP, tudo funciona bem, o endereço *.local
está vinculado ao IP do DHCP e o navegador avahi é capaz de detectar o meu dispositivo na rede.
Eu só tentei uma conexão cruzada com o Ubuntu por enquanto, se eu usar a GUI para alterar a configuração de rede de Automático (DHCP) para Somente Local de Link ambos dispositivo embutido e PC obtêm um IP LL e eu sou capaz de executar ping no dispositivo do meu PC usando o LL IP (obtido usando ip a
enquanto conectado através de uma interface serial), mas não consigo endereçá-lo usando o *.local
name e avahi-browser
também não está encontrando nada.
Eu não pude encontrar um exemplo online discutindo meu caso de uso, o que é estranho, já que o zeroconf é destinado para lidar com tais casos de uso.
Estas são as configurações de IP do meu dispositivo incorporado (Ubuntu 16.04.01 no ARMhf):
root@rp-f00321:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:26:32:f0:03:21 brd ff:ff:ff:ff:ff:ff
inet 169.254.171.143/16 brd 169.254.255.255 scope link eth0
valid_lft forever preferred_lft forever
inet6 fe80::226:32ff:fef0:321/64 scope link
valid_lft forever preferred_lft forever
3: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default
link/sit 0.0.0.0 brd 0.0.0.0
Estas são as minhas configurações de rede com fio:
root@rp-f00321:~# cat /etc/systemd/network/wired.network
[Match]
Name=eth0
[Network]
LinkLocalAddressing=yes
DHCP=yes
IPForward=yes
IPMasquerade=yes
Eu também tentei adicionar as próximas duas opções, mas isso não ajudou:
MulticastDNS=yes
IPv4LLRoute=yes
Status do daemon do Avahi:
root@rp-f00321:~# systemctl status avahi-daemon -l -n 50
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
Loaded: loaded (/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/avahi-daemon.service.d
└─ad.conf
Active: active (running) since Wed 2016-10-26 10:16:04 UTC; 41min ago
Main PID: 1552 (avahi-daemon)
Status: "avahi-daemon 0.6.32-rc starting up."
CGroup: /system.slice/avahi-daemon.service
├─1552 avahi-daemon: running [rp-f00321.local
└─1553 avahi-daemon: chroot helpe
Oct 26 10:16:04 rp-f00321 systemd[1]: Starting Avahi mDNS/DNS-SD Stack...
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: Process 1456 died: No such process; trying to remove PID file. (/var/run/avahi-daemon//pid)
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: Found user 'avahi' (UID 107) and group 'avahi' (GID 110).
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: Successfully dropped root privileges.
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: avahi-daemon 0.6.32-rc starting up.
Oct 26 10:16:04 rp-f00321 systemd[1]: Started Avahi mDNS/DNS-SD Stack.
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: Successfully called chroot().
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: Successfully dropped remaining capabilities.
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: Loading service file /services/bazaar.service.
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: Loading service file /services/ssh.service.
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: Joining mDNS multicast group on interface eth0.IPv6 with address fe80::226:32ff:fef0:321.
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: New relevant interface eth0.IPv6 for mDNS.
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: Joining mDNS multicast group on interface eth0.IPv4 with address 169.254.171.143.
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: New relevant interface eth0.IPv4 for mDNS.
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: Network interface enumeration completed.
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: Registering new address record for fe80::226:32ff:fef0:321 on eth0.*.
Oct 26 10:16:04 rp-f00321 avahi-daemon[1552]: Registering new address record for 169.254.171.143 on eth0.IPv4.
Oct 26 10:16:05 rp-f00321 avahi-daemon[1552]: Server startup complete. Host name is rp-f00321.local. Local service cookie is 1486970882.
Oct 26 10:16:06 rp-f00321 avahi-daemon[1552]: Service "rp-f00321 SSH" (/services/ssh.service) successfully established.
Oct 26 10:16:06 rp-f00321 avahi-daemon[1552]: Service "rp-f00321 HTTP" (/services/bazaar.service) successfully established.
Eu poderia fazer ping no meu PC usando o nome .local
, mas ele parou de funcionar agora:
# ping dent.local
PING dent.local (169.254.100.55) 56(84) bytes of data.
64 bytes from Dent.local (169.254.100.55): icmp_seq=1 ttl=64 time=0.776 ms
64 bytes from Dent.local (169.254.100.55): icmp_seq=2 ttl=64 time=0.634 ms
Estas são as configurações de IP do meu PC host (Ubuntu 16.04):
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether c4:8e:8f:f5:a3:93 brd ff:ff:ff:ff:ff:ff
5: enx00e04c534458: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:e0:4c:53:44:58 brd ff:ff:ff:ff:ff:ff
inet 169.254.100.55/16 brd 169.254.255.255 scope link enx00e04c534458
valid_lft forever preferred_lft forever
inet6 fe80::e07d:b734:e921:e87/64 scope link
valid_lft forever preferred_lft forever
E estas são minhas tentativas de ping:
$ ping 169.254.171.143
PING 169.254.171.143 (169.254.171.143) 56(84) bytes of data.
64 bytes from 169.254.171.143: icmp_seq=1 ttl=64 time=0.679 ms
64 bytes from 169.254.171.143: icmp_seq=2 ttl=64 time=0.706 ms
^C
--- 169.254.171.143 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.679/0.692/0.706/0.029 ms
$ ping rp-f00321.local
ping: unknown host rp-f00321.local