I have read various articles about how to do this, but to no avail. What I am trying to simply do is, ssh/scp from my Mac, to my Ubuntu desktop.
My Mac has a link local ipv6 address, starting with fe80. My Ubuntu desktop has ipv6 set up correctly.
If I do ipconfig in my Ubuntu desktop, I get a very weird and long address under "eth0", that looks like this:
inet6 addr: 2601:xxxx:xxxx:xxxx:yxyy:xxxx:xxxy:xxxx/64 Scope/Global
where x's are numbers and y's are letters.
I have tried to do:
ssh username@xxxx:xxxx:xxxx:xxxx:yxyy:xxxx:xxxy:xxxx
as well as some other variants, but nothing works. I also made sure that I have openssh-server installed on my Ubuntu side, via:
sudo apt-get install openssh-server
What do I need to do here?
2 Answers 2
Since both systems have link-local (fe80:) addresses, you can use those to connect. The only tricky thing is that since fe80: is attached to every interface on the Mac, you have to specify which one you want to connect via by adding a "zone index" to the address, separated by "%". So, assuming that en0 is the Mac interface that's connected to the same net as the Ubuntu desktop, you'd use:
ssh username@fe80::xyyx:xxyy:feyx:xyxx%en0
-
Thank you Gordon, I will try it. However, does this generalize to scp, and being able to ssh/scp from the mac to the desktop when I am not at home as well?Spacey– Spacey2017年02月20日 02:00:49 +00:00Commented Feb 20, 2017 at 2:00
-
It'll work with
scpas well, although you need to wrap the address in[ ]to avoid ambiguity (e.g.scp [username@fe80::xyyx:xxyy:feyx:xyxx%en0]:/path/to/remotefile /path/to/localcopy). However, it will not work when the Mac isn't on the same network segment as the desktop; you'd need to have a public IPv6 address on the Mac and connect to the desktop's 2601: address if you're anywhere other than the same network.Gordon Davisson– Gordon Davisson2017年02月20日 04:58:49 +00:00Commented Feb 20, 2017 at 4:58
You don't really have ipv6 set up on your mac. While a link local address is mandatory it is analogous to .169.254.0.0 Just cause you can ping yourself, does not mean you have connectivity to the ipv6 internet. Link local addresses are useless for this as far as I know.
I've messed around with methods including miredo, but really, setting up a tunnel or native IPv6 is the only way to do it.
The exact method would depend on how ipv6 is set up on your network. I run everything off my consumer router with SLAAC from my ISP, but your mileage may vary.
You'd still need to wrap the ip address in square brackets.
-
169.254.0.0/24 is the IPv4 link local address space analogous to IPv6's
fe80::. It is not loopback (127.0.0.1, the IPv6 equivalent of which is::1). IPv6 is not as broken as IPv4 used to be on some OSes, so the presence of link-local addresses is not a sign that IPv6 is not set up. Lastly, you can connect from link local addresses to routable addresses on the same local link (such as an Ethernet LAN). So unless I missed where he said the machines are on different LANs, I don't think we've discovered root cause of the failure yet.Spiff– Spiff2017年02月19日 01:27:14 +00:00Commented Feb 19, 2017 at 1:27 -
Ah. I was unaware of being able to connect to local machines over link local address. My initial assumption was no ipv6 at all.2017年02月19日 01:53:56 +00:00Commented Feb 19, 2017 at 1:53
netstatorlsofor something else to confirm thatsshdon the Ubuntu machine is listening on port 22 on the IPv6 address you're trying to connect to? Are both of these machines on the same LAN?netstat -an | grep .22you want to see a line liketcp6 0 0 *.22 *.* LISTEN. In this outputtcp6means "TCP over IPv6", and*.22means "any IPv6 address, port 22".sudo lsof -i6tcp:sshyou want to see a line showing some command (probablysystemdbut maybexinetdorsshd) listening onTCP *:sshor maybeTCP [some IPv6 address]:ssh. (My apologies, I don't have an Ubuntu box in front of me, so I'm trying to translate from the way it is on macOS. If in doubt, check thelsofman page on your system.)netstat -an | grep .22, then yes, I see this:tcp6 0 0 :::22 :::* LISTEN, and when I dosudo lsof -i6tcp:ssh, then I see:sshd 6417 root 4u IPv6 20448 0t0 TCP *:ssh (LISTEN). Each of those items go by the names COMMAND, PID, USER, FD, TYPE, DEVICE, SIZE/OFF, NODE and NAME respectively...