Linux + Formula To Convert IPV6 Address To IP Address

- 1 answer

Formula to convert IPv6 Address to IP address number

I'm looking for a formula to convert IPV6 address to IP address .

for example - lets say we have the ipv6 as the following

Input IPV6 address : 2001:0db8:0000:0000:0000:ff00:0042:8329

Output IP Number converted :



to IP address

As already written in the comments, the word "IP address" may both be an "IPv6 address" and an "IPv4 address".

And it is even worse: As far as I remember the latest RFCs correctly, the correct answer to the question: "What is the IP address of that computer?" is the IPv6 address (and not the IPv4 address) if the computer both has an IPv4 and an IPv6 address!

I'm looking for a formula to convert IPV6 address to IP address.

The first questions is: Does the SSH server have an IPv4 address at all?

This is not neccessarily the case.

And if it has an IPv4 address, it is not possible to calculate it from the IPv6 address because both addresses are completely unrelated to each other.

how ? when using ssh , how to ssh to ipv6?

The next question is: Does the client computer have an IPv6 address at all?

If your computer has an IPv6 address, you can simply connect to an IPv6 address using SSH:

ssh 2001:0db8:0000:0000:0000:ff00:0042:8329

If your computer does not have an IPv6 address (e.g. because your internet provider does not support IPv6), you have to find out the IPv4 address of the SSH server.

As I already wrote, you cannot calculate that address but you have to ask the person that operates that server.

If the SSH server does not have an IPv4 address and your computer does not have an IPv6 address, it will get rather difficult. Maybe you even have to pay for a service that can "translate" IPv4 to IPv6...