Test your IPv6 connectivity

17 May 2008  |  Published in IPv6, Internet, Software

If you are connected to this blog using a IPv6 link, you will notice that near the top of the right column of the front page there is a message saying:

"Congratulations ! You're using IPv6 ! Your address is XXXXXXX"

In case you ask, the PHP code that performs this check is below:

if (substr_count($_SERVER['REMOTE_ADDR'],":") > 0 &&substr_count($_SERVER['REMOTE_ADDR'],".") == 0)
{
echo "Congratulations ! You're using IPv6 ! Your address is ";
echo $_SERVER['REMOTE_ADDR'];
echo '.';
}
else
{
echo "You're just using IPv4. Your address is ";
echo $_SERVER['REMOTE_ADDR'];
echo '.';
}

Update: Martin J. Levy suggested the following, more compact code:

function is_connected_ipv6()
{
return (substr_count($_SERVER['REMOTE_ADDR'], ":") > 0 && substr_count($_SERVER['REMOTE_ADDR'], ".") == 0);
}
echo is_connected_ipv6() ? "(via IPv6)" : "(via IPv4)";
Share on Facebook   Share on Twitter

Leave a Response

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

You're just using IPv4. Your address is 38.107.191.114.

Disclaimer

This site does not reflect the views of my employer, nor that of the Internet Society or its Luxembourg chapter

SPF and DKIM adoption rate

  • E-mails reaching this server on 1 Aug 2010
    SPF enabled e-mails: 2.85%
    DKIM signed e-mails: 2.45%
    DKIM signed mails sent: 60

My Twitter feed

Archives



Valid XHTML 1.0 Transitional