My OS X machine gets assigned two public IP addresses from Android 7.1.1:
% ifconfig en0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 8c:29:XX:XX:XX:XX
inet6 fe80::8e29:XXff:feXX:XXXX%en0 prefixlen 64 scopeid 0x4
inet 192.168.43.163 netmask 0xffffff00 broadcast 192.168.43.255
inet6 2607:fb90:4bYY:YYYY:8e29:XXff:feXX:XXXX prefixlen 64 autoconf
inet6 2607:fb90:4bYY:YYYY:d427:13ba:ZZZZ:ZZZZ prefixlen 64 autoconf temporary
nd6 options=1<PERFORMNUD>
media: autoselect
status: active
The problem I've encountered is that the temporary
one may change with sleep/wake, whereas the permanent one still has the prefix that is not guaranteed to stay the same (it depends on ME).
I want to use the non-temporary address for ssh
, or, at least, extend the time during which the temporary
address stays the same (e.g., let's say, to get it automatically hardcoded until the /64 prefix gets reassigned upstream). How?!
As a sidenote, I'm trying to make it easier to identify my ssh connections from within the cloud, as well as make my ssh
connections not break between short sleeps; it seems there's an ssh_config(5)
option called BindAddress
, and it does appear to work (ssh -oBindAddress=2607:fb90:4b61:7474:8e29:XXff:feXX:XXXX …
), but I'd prefer to have this configured without hardcoding the prefix that's still temporary in nature. E.g., the solution I'm looking for likely involves system preferences; it's OK if it's not exclusive to ssh.
Best Answer
A similar question on SuperUser prompted me to look into sysctl settings, with the following setting available to prefer the permanent IPv6 autoconf addresses to the temporary ones:
For ssh sessions that aren't expecting any ongoing interaction, this would make it possible to go to sleep, and wake up within a number of minutes without any SSH connections suffering a disconnect (which would previously happen due to the prior IPv6 address being de-provisioned upon the wakeup from sleep). (Don't need no mosh!)