I want to create a webpage detecting (possibly dual-stack) client's ipv4 and ipv6 address, is there an easy way to do it without frames? With frame I guess I can load two pages, each of them only available in IPv4 or IPv6 (Two domain names one with A record only and the other with AAAA only). Is there another clean & easy way to do it? http://test-ipv6.com/ can do it but I guess their implementation is pretty complicated for just showing the ip addresses. Thanks. I am thinking about doing it with php $_SERVER["REMOTE_ADDR"], but how can I pass it to other pages without ajax(which I don't know how to use)? The test page on a dual-stack domain name, 1 callback page on ipv4 only, 1 callback on ipv6 only. How can I pass the callback to the test page? If I use things like curl I get the server's address instead of the client's address.
1
votes
How much are you paying me to design this for you?
– Michael Hampton
I feel this is relevant to you: fud.no/ipv6
– Kvisle
@Kvisle that information is way out of date.
– Alnitak
Why go the easy route for a nigh on useless function?
– Steve-o
@Alnitak It contains the ansers to realdreams' question - monitoring dual stack access haven't changed since then.
– Kvisle
3 Answers
2
votes
0
votes
Old post, but you need create 2 subdomains at your DNS Server. The 1st should be IPv4 and the other IPv6 .
On ipv4.subdaomain.com, use only an A Record. On ipv6.subdomain.com use an AAAA Record.
Now, in your javascript send an AJAX request to ipv6.subdomain.com and ipv4.subdomain.com. In php return the ip address on the client.
-1
votes
If you use a server side scripting language like PHP you can use the following code to do so
<?php
function look_me_up()
{
$records = dns_get_record( trim(`hostname --fqdn`) );
foreach($records as $record)
{
if ($record['type'] == 'A')
$ip = $record['ip'];
}
return $ip;
}
?>
http://php.net/manual/en/function.gethostbyname.php
It does not need be in a frame, you could use a jquery ajax call to get the info if the page is not PHP. I am unclear of all the details of your existing page to make a good recommendation for portion of the question.
Good Luck!