Everyone at some time or another wants to know what their public IP address is. In the current implementations of Windows Vista, Windows 7, and now Windows 8, by default the IPv6 capabilites are enabled when you install the operating system. This includes the 6to4 adapter which most people are using right now and don't realize it, its seemless and transparent, you may already be visting IPv6 enabled sites and not know it. Unless you are tunneled, and have not disabled the IPv6 in Windows, you are probably getting your Ipv6 access thru the 6to4 adapter built into Windows. This adapter has an IPv6 address assigned based upon your IPv4 address which is mapped into an IPv6 address, its a Unicast address. The 6to4 adapter is not a hardware adapter, its a software/logical construct and in the operating system logic hierarchy the 6to4 adpater is directly below your installed network card in the #2 networking interface position (unless you are set up for a tunnel in which case the ISATAP or teredo adapter may be in the #2 position, however, the 6to4 adapter is also recognized by Windows as a tunnel network adapter for its media type. The Unicast address assigned to the 6to4 adpater is your public IPv6 address, its easy to find out what it is without even opening the browser or having to go to some web site to find out as long as you already know what your public IPv4 address is (which you can find out eaisly also just by doing an 'ipconfig' in a command prompt window). The instructions for doing this are simple, it involves a simple conversion to hex and then formatting the results:
Now, how do you know if your IPv6 is basically installed and working? Open up a command prompt window and enter (if on Windows 7 - it may be a little bit different on Vista, don't remember right now) "ping -6 -n 5 ::1" and hit enter. The ::1 is the universal loopback IPv6 address for local machines, you should see 5 replies that look like this:With an example IPv4 address (or your public IPv4 address) of 192.168.2.100, simply convert the octets to hex>
192 = C0
168 = A8
2 = 02
100 = 16
this gives us this > C0a8:0264 and when put together in a 6to4 adapter IPv6 format we add a few things so it looks like this > ::C0a8:0264 (the colons are important so don't leave them out). Then we need to complete the address by adding the RFC 6to4 adapter prefix and suffix like this > first the RFC prefix signifyiong a 6to4 address > 2002: then we add our hex conversions so our address now looks like this > 2002::C0a8:0264 then we finish it off by adding our convert hex again like this > 2002::C0a8:C0a8:0264 and there you have your public IPv6 6to4 address. These addresses need each octet to be two digits, so if when converting to hex you come up with a single digit you simply add a 0 in front of it, for example, if in the hex conversion we came up with simply f we add a zero so it becomes 0f and plug it into the Ipv6 address that way. The IPv6 format uses double colon notation which is pretty much the standard, the double colons stand for something in an IPv6 address - 0's - so if we expanded the ::C0a8:0264 and did not use the double colon notation we would get 0:0:0:0:0:0:C0a8:0264. I'll leave further explaination regarding the double colon notation out at this time because its a whole different thing than what the scope of this post covers so i'll leave the study for this up to you.
or similar, if you see that then IPv6 is installed on the computer, however, this does not tell us if IPv6 is actually working. The 'ping -6' tells windows to ping using only IPv6, the '-n 5' sets the number of responses at 5 and of course the IPv6 loopback address of ::1 is what you are pinging, all together this tells Windows to ping your machine with IPv6 pings and if you do not receive them then you do not have IPv6 components installed, so thats how you tell if your IPv6 is installed on the computer but not if it is actually working for accessing IPv6 enabled web sites. To tell if IPv6 is really working you can use ping again to check if IPv6 enabled web sites can be pinged with an IPv6 ping, for example, 'ping -6 -n 1 http://www.google.com' will return its IPv6 addresses instead of its IPv4 address so you know that IPv6 is working at that point because if it wasn't then you would have no IPv6 name resolution and the Ip address for 'www.google.com' would be returned with IPv4 addresses instead of Ipv6 addresses. If on Windows Vista I think its 'ping6' and not 'ping -6' like it is on Windows 7 but the rest of the command is the same on either. If you didn't know it yet the '::1' is the IPv6 loopback address equal of the IPv4 loopback address 127.0.0.1 for the local machine.C:\Windows\system32>ping -6 -n 5 ::1
Pinging ::1 with 32 bytes of data:
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Ping statistics for ::1:
Packets: Sent = 5, Received = 5, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
So, you pinged and your Ipv6 stuff seems to be working, now just to verify go to > http://test-ipv6.com/, make note of the IPv6 public address they show. Unless your ISP or router/network assigns you a different IPv6 address when your packets are launched into internet cyberspace you could have done the same thing yourself and gotten the same public IP address info with the windows calculator in programmers mode and converting your public IPv4 address. To save you a little time in the conversion I quickly put together a short code snippet to do the conversion for you that directly translates and follows the directions I gave above to show how this is done so you can also follow it eaisly in the code, use it to convert and compare it to what the web site tells you. If you are really using the 6to4 adpater and your router or ISP does not assign a different address on the way to the internet then your result from using the code will match what the web site tells you your public 6to4 IPv6 address is. To demonstrate the steps for conversion I explained above for your 6to4 IPv6 public address from your public IPv4 address the below code snippet will show it to you programatically:
Code: Select all
Procedure.s ConvertPublicIpv4AddressToPublicIPv6Address(addrin$)
; returns the IPv4 address converted to Ipv6 for 6to4 IPv6 addresses
For oct=1 To 4
stroct$ = StringField(addrin$, oct, ".")
Select oct
Case 1
oct1_ip6$ = LCase(Hex(Val(stroct$)))
Case 2
oct2_ip6$ = LCase(Hex(Val(stroct$)))
Case 3
oct3_ip6$ = LCase(Hex(Val(stroct$)))
Case 4
oct4_ip6$ = LCase(Hex(Val(stroct$)))
Default
EndSelect
Next
;note: the proper format convention is using lower case letters
If Len(oct1_ip6$) = 1
oct1_ip6$ = "0" + oct1_ip6$
EndIf
If Len(oct2_ip6$) = 1
oct2_ip6$ = "0" + oct2_ip6$
EndIf
If Len(oct3_ip6$) = 1
oct3_ip6$ = "0" + oct3_ip6$
EndIf
If Len(oct4_ip6$) = 1
oct4_ip6$ = "0" + oct4_ip6$
EndIf
; the from the directions we give it the 2002 prefix
ip4toip6$ = "2002:" + oct1_ip6$ + oct2_ip6$ + ":" + oct3_ip6$ + oct4_ip6$ + "::" + oct1_ip6$ + oct2_ip6$ + ":" + oct3_ip6$ + oct4_ip6$ + " (appears to be a 6to4 address)"
ProcedureReturn ip4toip6$
EndProcedure
; your public IPv4 address here
Debug ConvertPublicIpv4AddressToPublicIPv6Address(addrin$)
Code: Select all
Procedure ipv6instcmd()
ipv6installed.b = #False
apprun = RunProgram("ping", "-n 1 ::1", "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Hide)
If apprun
While ProgramRunning(apprun)
a$=ReadProgramString(apprun)
CompilerIf #PB_Compiler_Unicode
b$ = PeekS(@a$, -1, #PB_UTF8)
;Debug b$
If FindString(b$, "Packets: Sent = 1, Received = 1, Lost = 0 (0% loss)", 1) > 0
ipv6installed = #True
Break
EndIf
CompilerElse
b$=a$
OemToChar_(a$, b$)
;Debug b$
If FindString(b$, "Packets: Sent = 1, Received = 1, Lost = 0 (0% loss)", 1) > 0
ipv6installed = #True
Break
EndIf
CompilerEndIf
Wend
CloseProgram(apprun)
EndIf
ProcedureReturn ipv6installed
EndProcedure
Select ipv6instcmd()
Case #True
ipv6inst$ = "Yes"
Case #False
ipv6inst$ = "No"
Default
EndSelect
Tunnel adapter 6TO4 Adapter:
Connection-specific DNS Suffix . : (your DNS Suffix will be here if you have one)
IPv6 Address. . . . . . . . . . . : 2002::C0a8:C0a8:0264 (this is our example address from above, your 6to4 IPv6 public address will be here, may differ on receiving end if ISP or router assigns different)
Default Gateway . . . . . . . . . : (your IPv6 Default Gateway address will be here if you have one)