-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Sometimes addresses *.local only return IPv6 addresses.
This is a major issue when using .local mDNS, since you apparently have to specify the interface when using link-local addresses.
But to be fair it's happens pretty randomly.
Sometimes running dog myothermachine.local (requesting the A record for myothermachine.local from 127.0.0.53) helps, but doesn't currently.
Here's a Python script to reproduce it:
# set lan_device_1 and lan_device_2
import socket
import subprocess
import time
def check(comment, hostname):
print(f' {comment}')
for tup in socket.getaddrinfo(hostname, 443, type=socket.SOCK_STREAM):
(family, type, proto, canonname, sockaddr) = tup
type_str = 'IPv6' if family == socket.AF_INET6 else 'IPv4'
print(' ', type_str)
def check_all():
check('localhost', 'localhost')
check('own hostname', socket.gethostname() + '.local')
check('google.com', 'google.com')
check('LAN device 1', lan_device_1)
check('LAN device 2', lan_device_2)
check_all()
import sys
if len(sys.argv) > 1 and sys.argv[1] == 'immutable':
sys.exit(0)
print('stopping nsncd')
subprocess.run(['sudo', 'systemctl', 'stop', 'nscd'], check=True)
check_all()
print('starting nsncd')
subprocess.run(['sudo', 'systemctl', 'start', 'nscd'], check=True)
print('restarting the process')
# even sleep doesn't help here. I'm guessing glibc doesn't reconnect to nsncd
subprocess.run([sys.executable, sys.argv[0], 'immutable'], check=True)$ python main.py
localhost
IPv6
IPv4
own hostname
IPv4
IPv6
google.com
IPv4
IPv6
LAN device 1
IPv4
IPv6
LAN device 2
IPv6
stopping nsncd
localhost
IPv6
IPv4
own hostname
IPv4
IPv6
google.com
IPv4
IPv6
LAN device 1
IPv4
IPv6
LAN device 2
IPv4
IPv6
starting nsncd
restarting the process
localhost
IPv6
IPv4
own hostname
IPv4
IPv6
google.com
IPv4
IPv6
LAN device 1
IPv6
LAN device 2
IPv6Example of ssh not working
$ ssh myothermachine.local
ssh: connect to host myothermachine.local port 22: Invalid argument
$ ssh myothermachine.local -v
[...]
debug1: Connecting to myothermachine.local [fe80::1234] port 22.
debug1: connect to address fe80::1234 port 22: Invalid argument
ssh: connect to host myothermachine.local port 22: Invalid argumentSystem info
x86_64-linux
Linux 6.14.0, NixOS, 25.05 (Warbler), 25.05.20250402.2c8d3f4
systemd 257.3
GNU libc 2.40
nsncd 1.5.1
Metadata
Metadata
Assignees
Labels
No labels