MacOS – Establishing ssh session using Back To My Mac

back-to-my-macicloudmacossshterminal

I am trying to establish a ssh session to my MacBook using "Back to my Mac". So I turned the "Back to my Mac" option on in iCloud and ticked the remote sign in box. But if I issue the command

ssh user_name@computer_name.number.members.btmm.icloud.com

the terminal just goes into the next line and stays black.
Sorry for not providing more information, but I don't know much about this, so I don't know what else information to provide.

Does anybody know what I did wrong?

Edit: As suggested I used the -vvvv flag and got:

OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving "computer_name.number.members.btmm.icloud.com" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to computer_name.number.members.btmm.icloud.com [private_IPv6_address] port 22: Operation timed out
ssh: Connecting to computer_name.number.members.btmm.icloud.com [private_IPv6_address] port 22: Operation timed out

Also the command

ssh localhost

works without any troubles.

Best Answer

"Back to my Mac" uses a special tunnel device configured with two - more or less random and unique - IPv6 addresses from the local address room:

  • a link local address: fe80...
  • a unique local unicast (ULA): fc00… to fdff…

All IPv6 traffic (computer_name.number.members.btmm.icloud.com is the DNS name of a IPv6 host/device!) is wrapped into IPv4 packets, so that a IPv6 capable router isn't needed. On the Apple side it's unwrapped - probably with some 6in4 relay - and then routed to the remote device.

Apparently this doesn't work if you want to ssh from your own host into your own host (aka ssh -6 %localhost-utun1-ULA%). It works with a second device (also registered with your Apple ID in iCloud) in your own private or a remote network.

It's really slow though (tested with two Sierra VMs on one hosting Mac all using the same physical network interface!).