On my website I try to block bad users and bots. After detecting bad behaviour (ignoring robots.txt, too many clicks etc) the users IP address is added to a MYSQL database.
When visiting the website the IP of the user will be checked against the MYSQL database containing bad IP's. If it's present an error message will be served.
This all works well with IPv4 but I'm unsure how to block IPv6 addresses, as they will change quite often for the same user.
For example how to block the user with the following IPs:
2a02:908:1a4:ff00:1943:5691:f11b:6ad8
2a02:908:1a4:ff00:b51b:7d3:e816:ff4e
2a02:908:1a4:ff00:e4f6:3f53:2efc:9ae2
Is it a good idea to subtract the first part which stays the same using: https://stackoverflow.com/a/7290676 so I end up blocking 2a02:908:1a4:ff00:: ?
I don't want to block an entire City / ISP just a single abusing user.
Update: With the situation above I don't want to block users completely, just display a message / restrict access to some pages and maybe eventually unblock after some time / action. I'm already using CSF (and iptables) to block unwanted visitors.
Thanks from Holland!