Banning by IPv4 and IPv6

北城余情 提交于 2019-12-11 03:47:09

问题


If I want a ban a user by IP in my website, is it possible to do it by both IPv4 and IPv6? Some browsers apparently use IPv4 addresses by default and others, if they have the possibility, use IPv6 addresses. So, if I ban someone by their current IP, they would only have to user another navigator to bypass the ban.

tl;dr: is it possible to translate IPv4 addresses to IPv6 or something like that to "unify" them?

I'm using PHP as the server-side technology.


回答1:


No, it isn't really possible. They are entirely separate network protocols that don't have to have anything to do with each other.

In addition, I would suggest that banning by IP address should only be used in conjunction with other methods, as it is very easy to use a proxy or other means to hit your server from a different IP address.




回答2:


You can't really translate one to the other, the IPv4 and IPv6 Internets are essentially two logically seperate neworks that happen to share much of the same infrastructure.

Things you can do.

  1. Look out for addresses associated with the 6to4 and teredo transition mechanisms. When you see one translate it to the corresponding IPv4 address for abuse control comparisions.
  2. Be aware that customers tend to get allocated IPv6 in blocks of at least /64, so there isn't generally much point in banning an individual IPv6 address.
  3. Include a couple of mostly invisible resources (e.g. 1x1 pixel transparent images) on critical pages, one served from a v4 only hostname and one served from a v6 only hostname. Use these images to collect both of the user's addresses (if they exist).


来源:https://stackoverflow.com/questions/12468069/banning-by-ipv4-and-ipv6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!