What is a Public vs Private IP Address?
As we mentioned, all IPv4 addresses take a format of xxx.xxx.xxx.xxx. However, not all IP addresses are the same. The first set of numbers may often tell us something specific, such as whether an IP address is public or private. While almost all IP addresses are public (meaning that they can be accessed by anyone, and reference specific locations), there are three ranges reserved for private IP access. These are used to designate private networks.
Private addresses include the following ranges:
10.0.0.0 – 10.255.255.255
172.16.0.0 – 172.31.255.255
192.168.0.0 – 192.168.255.255
If you are running a local wireless network in your home (I.e. you have a wireless router which multiple devices in your house can connect to the internet, such as several laptops, televisions, phones, any smart appliances, etc.), you are most likely using the 192.168.*.* range. You can determine which local or private range you are connected to by running ipconfig from the command line on your computer.
What information can you get by querying an IP address?
Due to the availability of IP address databases, provided by government authorities in different regions of the world, we can get a large amount of information from an IP address. We can get information about the city of the user, their region, the IP's geolocation (longitude and latitude), their connection type (such as a proxy or VPN), their internet provider and more.
How can I get an IP address from my users or visitors?
There are several methods for getting your visitor or users' IP addresses, depending on the language or framework you're using. Abstract has a few guides on this, including "How to get a visitors IP address using PHP" and "How to get an IP address using jQuery".