I think your question should be this from what I understand you.
with what kind of data I keep the IP addresses in mysql
When we need to store IP addresses in our databases, the most convenient (and almost done by inertia) is to assign the field a VARCHAR type with a length of 15 characters. However, there is a better option that little by little I am finding myself in the main CMS and Frameworks: INT UNSIGNED.
Thus, using the MySQL command INET_ATON, the IP address would be encoded in a 4-byte string that we could retrieve by its opposite INET_NTOA
# Tomamos una direccion IP y la convertimos en una cadena de enteros:
SELECT INET_ATON('192.168.0.10') AS ipn;
# Esto se traduciría en 3232235530
# El proceso inverso:
SELECT INET_NTOA(3232235530) AS ipa;
# Nos devuelve nuestra direccion IP anterior: 192.168.0.10