what's the right area type for Ip in mysql? and what's the proper way of storing it?

This tutorial may help you: http://daipratt.co.uk/mysql-store-ip-address/.

The best say of saving IPv4 addresses is by using an INT area (not VARCHAR as you may expect). You are converting them using PHP's [cde] and back using either MySQL's [cde] function or PHP's [cde].

If you want to store IPv6, you will want to make use of a BINARY area rather and PHP's [cde] function.

Generally you are able to opt for VARCHAR(45) as it will likely be lengthy enough to even store IPv6.

you are able to store these questions binary area having a period of 128 bits (16 bytes, ip2long or INET_NTOA). to transform any ip to the binary representation, you should use the php function [cde]. this process is useful for both IPv4 and IPv6 addresses. [cde] may be used to return the string representation from the saved ip (no matter version)