TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Trivial way to determine between ISP and cloud derived IPs?

2 pointsby johnnyApplePRNGover 3 years ago
I am considering creating a restriction preventing free credits from being doled out on my SaaS to users originating from a cloud-based IP address (AWS, Google, Azure, Etc.)<p>Curious what any pitfalls of this approach might be?<p>And any suggestions as to how to go about it?<p>Simply adding all cloud based company ips to a blacklist would be a good start. Do any half-decent ones already exist before I create my own?

3 comments

LinuxBenderover 3 years ago
I don&#x27;t have a complete answer for you and I can&#x27;t really comment whether this is good or bad, but you can get some netblocks from the cloud providers themselves. I am missing the ipv6 method. This only covers ipv4. Here are some bash snippets.<p>Google:<p><pre><code> for line in $(dig +short txt _cloud-netblocks.googleusercontent.com | tr &quot; &quot; &quot;\n&quot; | grep include | cut -f 2 -d :) do dig +short txt &quot;${line}&quot; done | tr &quot; &quot; &quot;\n&quot; | grep ip4 | cut -f 2 -d : | sort -n | uniq | xz -9ecv &gt; .&#x2F;_GOOGLE.netset.xz </code></pre> Amazon:<p><pre><code> curl --url &quot;https:&#x2F;&#x2F;ip-ranges.amazonaws.com&#x2F;ip-ranges.json&quot; -o .&#x2F;aws.json grep ip_prefix .&#x2F;aws.json | awk -F &quot;\&quot;&quot; &#x27;{print $4}&#x27; | sort -n | uniq | xz -9ecv &gt; .&#x2F;_AWS.netset.xz </code></pre> I don&#x27;t have one for Azure handy at this time. Skip the xz compression step if you just want plain text. If some day they remove these services, you can also look up all the CIDR blocks using sites like this [1] Put in a name or IP to start with, then click on the AS number link, then click on prefixes v4 and prefixes v6.<p>[1] - <a href="https:&#x2F;&#x2F;bgp.he.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;bgp.he.net&#x2F;</a>
toast0over 3 years ago
You can lookup the AS of an IP and blacklist thr cloud providers you care about by AS Number.<p>Maxmind has a free database as part of GeoLite2 [1], but you can also put together a database from IP assignments or BGP data or ?<p>Most larger clouds publish their IPs as well.<p>Pitfalls are that you do need to update your database frequently, and it is difficult to validate changes. You&#x27;re likely to get some real people who are using a VPN or something in cloud ranges, and some abuse&#x2F;automation that is using residential ISPs, so it&#x27;s not perfect, but it may help somewhat.<p>[1] <a href="https:&#x2F;&#x2F;dev.maxmind.com&#x2F;geoip&#x2F;geolite2-free-geolocation-data" rel="nofollow">https:&#x2F;&#x2F;dev.maxmind.com&#x2F;geoip&#x2F;geolite2-free-geolocation-data</a>
rdbellover 3 years ago
Depending on how motivated your users are, this could be a difficult battle for you. Even if you use a paid service like MaxMind to identify residential IP addresses, your users can tunnel their traffic through residential proxies to skirt detection.<p>I’d recommend tackling the issue from another angle if possible.