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

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("")}, 16) = 0

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

$ host myserver                   
myserver has address

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.

closed as off-topic by Ron Trunk, rnxrx, Teun Vink Aug 15 '18 at 5:05

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "NE is a site for to ask and provide answers about professionally managed networks in a business environment. Your question falls outside the areas our community decided are on topic. Please visit the help center for more details. If you disagree with this closure, please ask on Network Engineering Meta." – Ron Trunk, rnxrx, Teun Vink
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Sadly host configuration is off topic here. You can try asking onSuper User. – Ron Trunk Aug 15 '18 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... – Metamorphic Aug 15 '18 at 5:12
  • I'm going to copy-paste into a Super User question and then delete this one, unless someone objects. – Metamorphic Aug 15 '18 at 6:02
  • I wasn't able to delete it because it already has an answer. – Metamorphic Aug 21 '18 at 17:08

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.