0

Since this question is off-topic I moved it to Super User. But I was unable to delete it.

Here is the new location.

Here is the original question:


I'm trying to connect to a headless server via my laptop; they share a wired link via a Linksys wireless router ("Linksys EA6350") and TP-Link ethernet switch. I'm running Arch Linux on both machines, using a pretty default Systemd setup with dhcpcd for the network configuration.

I recently experienced the following error when trying to ssh to the server:

$ ssh -v -v -F /dev/null myserver
OpenSSH_7.7p1, OpenSSL 1.1.0h  27 Mar 2018
debug1: Reading configuration data /dev/null
debug2: resolving "myserver" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to myserver [fe80::9cd8:b045:5974:c5cf] port 22.
debug1: connect to address fe80::9cd8:b045:5974:c5cf port 22: Invalid argument
ssh: connect to host myserver port 22: Invalid argument

Running the same with strace shows the error comes from connect:

connect(3, {sa_family=AF_INET6, sin6_port=htons(22), inet_pton(AF_INET6, "fe80::9cd8:b045:5974:c5cf", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = -1 EINVAL (Invalid argument)

Usually I have a local named forwarding DNS queries but the error persists when I go back to using the router's DNS server directly:

$ sudo cat /etc/resolv.conf
# Generated by resolvconf
nameserver 192.168.1.1

The error is intermittent: every few minutes I am able to connect successfully. When I can connect successfully, I see that connect is using an IPv4 address:

connect(3, {sa_family=AF_INET, sin_port=htons(22), sin_addr=inet_addr("192.168.1.149")}, 16) = 0

However, the host command shows the same IPv4 address whether the connection is working or broken:

$ host myserver                   
myserver has address 192.168.1.149

After reading this question I thought to specify the interface manually (ssh -v -v -F /dev/null -B en0 myserver). This eliminates the error when it occurs, but it is not a permanent solution for me and it doesn't explain why the error suddenly appeared.

4
  • Sadly host configuration is off topic here. You can try asking onSuper User.
    – Ron Trunk
    Commented Aug 15, 2018 at 0:29
  • OK that's confusing, I come to the main page of this site and register and I see a header with "Questions Tags Users Badges Unanswered Ask Question". I look around wondering how I can figure out if this is the right place to ask, and eventually I give up and just decide that other similar questions are in the list of questions so it must be OK. But I was supposed to scroll down to the very bottom and click tiny "Help" and then click on "What topics can I ask about here?", OK I got it. Can someone help me migrate this to Super User? Sorry for the trouble... Commented Aug 15, 2018 at 5:12
  • I'm going to copy-paste into a Super User question and then delete this one, unless someone objects. Commented Aug 15, 2018 at 6:02
  • I wasn't able to delete it because it already has an answer. Commented Aug 21, 2018 at 17:08

1 Answer 1

5

Whatever is doing hostname resolution is returning link-local IPv6 address(es) that aren't valid for the interface selected -- i.e. "any". Link-local addresses must specify the interface -- eg. fe80:...:1%eth0

Why you're getting a link-local address is unknown. Perhaps people familiar with Arch linux could provide further assistance.

(Also, ip -6 [route|addr|...] is apparently necessary to see IPv6 information on your system)

Not the answer you're looking for? Browse other questions tagged or ask your own question.