0

I'm trying to ssh to some client behind a router that has a dynamic IPv6 address.

Directly using the public IPv6 address of the client works just fine.

Now, I'd like to dynamically construct the IPv6 address based on the hostname of the router and the IPv6 interface id of my client.

For example, let 2001:db8:: be my public prefix and the hostname's (example.com) ip be 2001:db8::1319:8a2e:0370:7347. Then, from the hostname I can find the current public prefix 2001:db8:: and together with the known IPv6 interface ID ::1319:8a2e:0370:7342 of my client I can build the public IPv6 address 2001:db8::1319:8a2e:0370:7342 even if the prefix changed in the meantime.

Is there a syntax for achieving that directly without some kind of external script?

4
  • So you want to take the hostname of the router, get the IP for that hostname, grab probably the ::/64 and then apply the clients local part? Otherwise clarify in you question what you mean by "IPv6 interface id" and please use at least examples 2001:db8:: is available for documentation/examples
    – NiKiZe
    Dec 23, 2021 at 21:56
  • Business networks are assigned fixed IPv6 prefixes. This is for a residential network where the IPv6 addressing changes to help prevent a ToS violation of running services to the public Internet from a residential network,
    – Ron Maupin
    Dec 23, 2021 at 23:58
  • @NiKiZe Yeah, that's what I want. I also added an example.
    – dba
    Dec 24, 2021 at 12:58
  • There is no standard here, you are making assumptions here.
    – NiKiZe
    Dec 24, 2021 at 13:16

1 Answer 1

3

Business class internet service should be providing a static IPv6 prefix. The address space is easily big enough to provide this for everyone.

DNS is the first choice for resolving names to IPs. Consider a DNS updating script, running on a box that knows the prefix. nsupdate, ddclient, something like that. A script to drive that is fairly simple: concatenate a /64 prefix plus interface ID.

Maybe store the prefix in DNS as well, so it can be retrieved by name.

Not the answer you're looking for? Browse other questions tagged .