I exposed my personal web server to the outside world by opening port 80 for incoming on my firewalls and doing the proper port forwarding. Then I went to whatismyipaddress.com to get my outside IP address to test in Internet Explorer. Using the IP address whatismyipaddress.com gave me (IPv6 it seems) in the IE address text box resulted in IE doing a Bing search with the address. I tried the address in Firefox with address bar search turned off and Firefox gave me "The address isn't valid". I spent lots of time making sure my firewall and port forwarding settings were right, which they were. No matter what I tried, I couldn't get to my web server using that address. Then I went to canyouseeme.org which reported my IP address as a IPv4 address. I was surprised. I thought that IPv4 was no longer in use on the internet. I tried that address in the browser and I immediately got to my website.
Why does my IPv6 address as reported by whatismyipaddress.com not work in either browser when the IPv4 does in both? I thought IPv4 was history on the internet.
The reason your external IPv6 IP (the one that looks something like like XXXX:XXXX:XXXX::
) doesn't work is because of the way IPv6 works.
Take this address for example: 2607:5600:52c:1::
. This address is globally routable, and in fact, that address belongs to me.
Now We have an IPv6 address, and we want to connect on, say... port 1000
.
The URIs we are used to seeing are these: <protocol>://<host>[:<port>]/[<path>][#<hash>]
which means that for an IPv6 site, we would expect to use http://2607:5600:52c:1::/foo#bar
. This is where it gets interesting.
We could always do 2607:5600:52c:1::1000
but in reality that would be transparently translated to 2607:5600:052c:0000:0000:0000:1000
which is a problem, since that means no port. This is where RFC3986 comes in to play. You want section 3.2.2: Host
A host identified by an Internet Protocol literal address, version 6 [RFC3513] or later, is distinguished by enclosing the IP literal within square brackets ("[" and "]"). This is the only place where square bracket characters are allowed in the URI syntax. In anticipation of future, as-yet-undefined IP literal address formats, an implementation may use an optional version flag to indicate such a format explicitly rather than rely on heuristic determination.
Ok. You've told me about why, so how do I fix it?
Simple. According to RFC3986 you need to use this notation: [IPv6-ADDRESS]
which means in our example, you need to use this: http://[2607:5600:52c:1::]
which will work. This also means we can connect to port 1000 by using [2607:5600:52c:1::]:1000
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments