I have 2 systemd-nspawn containers (nginx & nginx2) attached to a bridge. Both containers have resolved enabled, get an IPv4 address via DHCP & configure themselves with an IPv6 link-local address. I want to be able to use multicast DNS between them, i.e. nginx.local
& nginx2.local
.
Somehow, using nginx2.local
in the nginx config of nginx (the first container) wasn’t working:
[crit] 336#336: *68 connect() to [fe80::bce2:aeff:fe0b:7e45]:80 failed (22: Invalid argument) while connecting to upstream
I tried pinging nginx2 from nginx, which resolved nginx2.local
to nginx2’s IPv6LL address:
> ping nginx2.local
PING nginx2.local (fe80::bce2:aeff:fe0b:7e45) 56 data bytes
^C
--- nginx2.local ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1056ms
The ping command fails because it’s trying to use an IPv6LL address without specifying a scope, ping fe80::bce2:aeff:fe0b:7e45%eth0
works fine.
Digging deeper, getent ahosts
gives only the IPv6LL address as well:
getent ahosts nginx2.local
fe80::bce2:aeff:fe0b:7e45 STREAM nginx2.local
fe80::bce2:aeff:fe0b:7e45 DGRAM
fe80::bce2:aeff:fe0b:7e45 RAW
I ran a tcpdump capture at the same time as the getent
command & observed the following:
22:28:01.372448 IP6 nginx.mdns > ff02::fb.mdns: 0 AAAA (QM)? nginx2.local. (30)
22:28:01.372960 IP nginx.mdns > mdns.mcast.net.mdns: 0 A (QM)? nginx2.local. (30)
22:28:01.373246 IP6 nginx2.local.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fe80::bce2:aeff:fe0b:7e45 (52)
22:28:01.373495 IP nginx2.local.mdns > mdns.mcast.net.mdns: 0*- [0q] 1/0/0 (Cache flush) A 172.20.13.115 (40)
This indicates that nginx got a response for nginx2’s IPv4 AND IPv6LL address, but getent
only showed me the IPv6LL address. Why does it not return the IPv4 address, despite the query being answered?
Jappie3 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.