At home I have a ipv6 modem, my ISP provides only ipv6. My RPi is connected to modem/router over ethernet and gets ipv6 address. I can reach it (ssh) locally from my windows laptop using ipv6 global address. However when I am outside, i.e. at work or at school I get only ipv4 address, therefore I can not reach to RPi using ipv4 address. I searched in internet, didn't find any useful methode. How can I connect to RPi with ipv4 address?
3 Answers
If your RPi only has an IPv6 address and your client only has an IPv4 address then you cannot connect. Maybe connect over IPv4 to a server that has both IPv4 and IPv6, and then connect from there using IPv6 to the RPi.
Getting an IPv4 address for your RPi will be very difficult as unused IPv4 address aren't freely available anymore. The real solution is for every network to support IPv6, so explain to the network admins at work and at school that they should implement it. The usual excuse of "our users don't need it" has been shown to be wrong: you need it!
-
I explained them that I need IPv4, they switched my global address from IPv6 to IPv4. Now I can reach to RPi using IPv4 address from outside. Commented Nov 17, 2017 at 9:04
In general, as the IPv4 address space is much smaller than the IPv6 address space (by 2^96), there is no universal translation possible to reach all IPv6 addresses from the IPv4 address space. You can't in general access the full IPv6 as you can't get the missing address bits in that IPv4 lack. There are applications of NAT64 with clients in IPv4 and servers in IPv6, but these work only under closely administered constraints in system configuration.
For these reasons, your ISP needs to provide Dual Stack (DS) connectivity, either as full DS or alternatively as DS Light, so that you are able to use IPv4 as before until the final sunset of IPv4 (not really foreseeable yet).
With DS Light you will be located behind a CGN Carrier Grade NAT, so that you are sharing your public IPv4 address with typically at least 16 other users, but depending on ISP more users might be mapped onto the same public IPv4 address. So, with DS Light, you are lost, as this is a "crippled" IPv4 working only on the client side, but not on the server side. While there are specifications to automatically forward CGN ports to your home router, good luck in getting an ISP that allows it, and the end system software to initiate it.
So if you want to access the Pi from an IPv4 network, you need an ISP that gives you full DS. In that case you can simply forget about IPv6 for the moment, and then need to forward the SSH port from your home router with the public IPv4 address to the private IPv4 address of your Pi.
If you rent a shell/SSH service that has dual stack (Both IPv4 and IPv6) then you can SSH from school and from there start another ssh session to your home machine.
Example: https://www.remot3.it