Virtual Private Networks (VPNs) are designed to solve many privacy problems for users.Due to elaborate encryption between a computer and the provider, it can be exceedingly difficult for a third party to be able to identify what someone using a VPN is up to.
There are many good reasons for using VPNs due to being located in various countries which limit internet access and track the behavior of users. In fact, in these places, many people would wish to hide the fact that they are using a VPN at all, due to their use being restricted.
However, there are legitimate non-restrictive reasons for wanting to detect if users are using a VPN on your network.The elusive nature of these tools poses a problem for those who wish to determine whether users are using a VPN to access your website.
The truth of the matter is that by default, there is no easy way of detecting whether a user is using a VPN or not, unless the IP address that is being used has been identified as part of a VPN.
That said, there are several methods used by network engineers including sniffing large numbers of packets and noticing whether some or all of the traffic coming through is encrypted.While it is common for many internet tools to be using some form of encryption, if every bit of traffic coming through is encrypted, it is a fairly good sign that the user is using a VPN.
Most VPN networks use a fixed set of IP addresses.Over time, these addresses get identified by network engineers and these are eventually provided to lists which are stored in central databases.
The good news is that you can make use of a large amount of work that has been done by others; there are common databases of known VPN IP addresses. While these will not catch every single example of a VPN (if they did, the point of using a VPN would become moot.Many people would simply not use them), you can still identify if a significant part of your traffic is using these tools. The methods for detecting a VPN are similar for the methods of detecting if an IP address is using a proxy.
The easiest way of identifying whether at least some of your traffic is using a VPN is to use an API like AbstractAPI’s geolocation tool.
By signing up for their free service, you can get an API key, and by using something as simple as a snippet of jQuery code on your site, you can get a wide range of information about the user.
Just enter a similar snippet of code to this into your site:
You can get a large amount of information. The API has many parameters you can use, but the data.security will provide information about whether the user is using a VPN.
Below is an example of some of the output you will receive(note, to get all of the below parameters you would need to request them individually, however the security entry will tell you whether the user is using a known VPN: