This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

How do i disabled IPv6
#8
RE: How do i disabled IPv6
A quick search on Google lead me here: http://stackoverflow.com/questions/12435...shows-ipv6

Quote:The server is then accepting connections on an IPv6 socket. Some operating systems can do both IPv4 and IPv6 on an IPv6 socket. When that happens the IPv6 address will look like
Code:
::ffff:192.0.2.123
or
Code:
::ffff:c000:027b
which is the same address but written in hexadecimal.
If you see IPv6 addresses like
Code:
2a00:8640:1::224:36ff:feef:1d89
then your webserver really is reachable over IPv6 :-)
Anyway, to convert everything back to a canonical form you can use something like:
Code:
// Known prefix
$v4mapped_prefix_hex = '00000000000000000000ffff';
$v4mapped_prefix_bin = pack("H*", $v4mapped_prefix_hex);

// Or more readable when using PHP >= 5.4
# $v4mapped_prefix_bin = hex2bin($v4mapped_prefix_hex);

// Parse
$addr = $_SERVER['REMOTE_ADDR'];
$addr_bin = inet_pton($addr);
if( $addr_bin === FALSE ) {
 // Unparsable? How did they connect?!?
 die('Invalid IP address');
}

// Check prefix
if( substr($addr_bin, 0, strlen($v4mapped_prefix_bin)) == $v4mapped_prefix_bin) {
 // Strip prefix
 $addr_bin = substr($addr_bin, strlen($v4mapped_prefix_bin));
}

// Convert back to printable address in canonical form
$addr = inet_ntop($addr_bin);
Using this code, when you input one of the following:
Code:
::ffff:192.000.002.123
::ffff:192.0.2.123
0000:0000:0000:0000:0000:ffff:c000:027b
::ffff:c000:027b
::ffff:c000:27b
192.000.002.123
192.0.2.123
you always get the canonical IPv4 address
Code:
192.0.2.123
as output.
And of course IPv6 addresses get returned as canonical IPv6 addresses:
Code:
2a00:8640:0001:0000:0224:36ff:feef:1d89
becomes
Code:
2a00:8640:1::224:36ff:feef:1d89
etc.


Yet, also note this: http://stackoverflow.com/questions/31233...ddr-in-php

Quote:
Code:
$_SERVER['REMOTE_ADDR']
always contains the address of the visitor. If it contains an IPv6 address then the visitor used IPv6 and there is no IPv4 address. And vice versa of course. These days you have to be able to deal with both.
Some visitors will have only IPv4, some will have only IPv6 and some will have both. The browser decides what is available and what it will use, and that's all you'll see. Note that a browser that has both might even switch between IPv4 and IPv6 between requests if it deems that necessary for good connectivity.
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:


Messages In This Thread
How do i disabled IPv6 - by Exile - 04-11-2017, 10:13 AM
RE: How do i disabled IPv6 - by Me.B - 04-12-2017, 08:12 PM
RE: How do i disabled IPv6 - by Exile - 04-13-2017, 03:02 AM
RE: How do i disabled IPv6 - by TGates - 04-14-2017, 05:20 AM
RE: How do i disabled IPv6 - by Exile - 05-16-2017, 02:49 PM
RE: How do i disabled IPv6 - by TGates - 05-17-2017, 12:47 AM
RE: How do i disabled IPv6 - by Exile - 05-17-2017, 09:59 AM
RE: How do i disabled IPv6 - by TGates - 05-17-2017, 01:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Domain disabled page incorrect QuakeMedia 2 5 ,487 08-19-2017, 03:41 AM
Last Post: TGates
ipv6 DNS records trs998 8 19 ,986 08-28-2016, 04:59 PM
Last Post: vicii
PHP exec disabled - problem enabling. asobiek 2 7 ,737 07-07-2016, 05:33 AM
Last Post: Me.B

Forum Jump:


Users browsing this thread: 1 Guest(s)