Reputation: 4568
I am confused about what the introduction of IPv6 means for me as a developer and my legacy applications.
I understand IPv4 and IPv6 are inherently incompatible. Will IPv4 clients be able to visit websites using IPv6, and will IPv6 clients be able to visit IPv4 websites?
I check the IP addresses of my Spring MVC website visitors like this:
private String getIp(HttpServletRequest request) {
return request.getRemoteAddr();
}
So far, this has always returned IPv4 addresses on the format a.b.c.d. Will this change if a client using IPv6 connects to my website? Or could it happen that various tunneling techniques make IPv6 clients masquerade themselves as IPv4 clients depending on my website setup?
When it comes to retrieving and processing IP addresses, are there any other IPv6 issues I am likely to face?
Upvotes: 2
Views: 953
Reputation: 10514
I understand IPv4 and IPv6 are inherently incompatible. Will IPv4 clients be able to visit websites using IPv6, and will IPv6 clients be able to visit IPv4 websites?
Without some kind of transition mechanism an ipv4 only client will not be able to talk to an ipv6-only server or vice-versa.
The original idea was that the whole world would move from "single stack ipv4" to "dual stack". Then once everyone was on dual-stack we could start turning off IPv4 and moving to "single stack ipv6".
However that didn't happen, network operators have seen little pressure to deploy IPv6 and IANA and most of the RIRs have run out of IPv4 addresses. So we have ended up in the situation where the days of plentiful IPv4 are over but there are still many v4-only clients and servers.
A variety of transitional mechanisms have popped up. Including:
None of them solve all the problems and some of them create problems of their own but used in combinations they can allow you to run a v6-only internal network with only a relative handful of IPv4 addresses to talk to the rest of the world.
I check the IP addresses of my Spring MVC website visitors like this:....So far, this has always returned IPv4 addresses on the format a.b.c.d. Will this change if a client using IPv6 connects to my website? Or could it happen that various tunneling techniques make IPv6 clients masquerade themselves as IPv4 clients depending on my website setup?
If your server accepts an ipv6 connection directly it will obviously see an ipv6 address.
If your server listens for both ipv4 and ipv6 connections by using a socket on "::" (Linux enables this by default, windows requires a specific socket option to enable it) then ipv4 addresses will be passed to the application using the socket as "ipv4 mapped addresses". The libraries you use may or my not hide this from you (I'm not familiar with what spring MVC does).
If you accept connections from a nat64 or proxy you will obviously see the address of the nat/proxy. In the case of a proxy it may be possible to determine the clients real IP address from information sent by the proxy.
When it comes to retrieving and processing IP addresses, are there any other IPv6 issues I am likely to face?
Anywhere that stores/transmits IPv4 addresses as a 32-bit integer or as a string with a short length limit is likely to need rework.
I strongly recommend you set yourself up a test network and start experimenting with this stuff.
Upvotes: 1
Reputation: 9978
Not without a translation device or a proxy server between them. Direct communication between an IPv4-only and IPv6-only system is impossible. There are some public proxies like the SixXS IPv4Gate and IPv6Gate, you can run your own proxy on a machine with both IPv4 and IPv6 or you can use DNS64/NAT64 to connect from an IPv6-only network to IPv4 servers
Yes, request.getRemoteAddr()
will give you IPv6 addresses when clients use IPv6 to connect to your server. If a client uses for example NAT64 then they will look like an IPv4 client to you, so you won't see an IPv6 address. It will look like a big IPv4 NAT box on your side.
Yes. Think about things like:
There is a whitepaper that highlights the most important issues you will encounter as a software developer.
Upvotes: 4