How to check PHP application for IPv6 compatibility?

I have an existing php web application, I'm on IPv4, how can I fake an IPv6 address to check if the application is compatible with it? or is there a better way to check IPv6 compatibility?

Update: My application registers the user's ip when performing certain actions. IP addresses are stored in the database (from another question, I can understand that BINARY is the best type of column). The application should also be searchable by IP.

I want apache / php to work as if I were using IPv6, I need to be sure that the compatibility of my application with IPv6 is ready for production on both IPv4 and IPv6 networks.

+4
source share
4 answers

I agree with Topener; don't worry about it, your site will work with IPv6. You also do not need to worry about Apache or PHP, they will work fine.

You should only care about storing IPv6 addresses in the database, etc. Make sure that you can store them appropriately and that your database can handle the IPv6 address.

You can simply change $ _SERVER ['REMOTE_ADDR'] to an IPv6 address:

echo $_SERVER['REMOTE_ADDR']; // will give you your current IP (probaply IPv4) // change the REMOTE_ADDR to an IPv6 address $_SERVER['REMOTE_ADDR'] = '3ffe:6a88:85a3:08d3:1319:8a2e:0370:7344'; 

Here you can find additional information about storing IPv6 addresses in the database:

How to save an IPv6-compatible address in a relational database

+5
source

Your site will work with IPv6. The only thing you need to check is if you are storing IPv6 or registering any kind, you must save it correctly. To fake this, simply enter some variable and put it in the database or whatever you want to do with it.

Example: 2001:db8::1:0:0:1 and 2001:0DB8:0:0:1::1 and fe80::202:b3ff:fe1e:8329

Otherwise, do not worry about it!

0
source

If your application is registering IP addresses, make sure the storage fields are large enough. Make sure that any application that processes these logs knows how to handle IPv6 addresses. If you need to search for addresses by block / range, you must use the appropriate storage types for this. If you perform access control based on IP address, it gets a little more complicated because IPv6 clients can often change the source address when they have privacy extensions, so you can allow access for / 64 instead of a separate address.

And most importantly: test, test, test :-)

0
source

Also note that string comparison is not enough to compare IPv6 addresses. There are different representations of the same IP address, for example 2001:0DB8:0:0:1::1 - this is a short form 2001:0db8:0000:0000:0001:0000:0000:0001 .

0
source

Source: https://habr.com/ru/post/1396942/


All Articles