Urgent: ISP detection failing for my web tool!

Author
Emma Moore Author
|
3 weeks ago Asked
|
41 Views
|
2 Replies
0
i'm completely stuck, guys, and i'm hoping someone here has faced this before. for the past few days, our 'What is My ISP?' web tool has been acting up massively, and i'm pulling my hair out trying to fix it.

the main problem is that our isp detection is just... failing. not for everyone, but for a significant chunk of users, especially those on mobile networks or using vpns. instead of showing their actual internet service provider, it's either returning 'unknown', a generic hosting company name (like amazon or google cloud, which isn't their ISP!), or just flat-out timing out. this makes our core feature, the actual ip address lookup for isp, totally useless for them. it's super frustrating and we're getting reports.

i've tried everything i can think of. we've cycled through a couple of different third-party geoloc/ip APIs, thinking maybe it was an issue with the provider. i've even tried doing manual `whois` queries for some of the problematic IP addresses, but even those often just point to the datacenter or a very broad region, not the actual ISP serving the end-user. nothing seems to work consistently or reliably. i even tried caching some results for known ranges, but that's just a band-aid.

here's an example of what i'm seeing in our logs when it fails, it's just so unhelpful:

[2023-10-27 14:35:01] INFO: IP 192.0.2.1 (user-agent: mobile_chrome) - Detected ISP: UNKNOWN
[2023-10-27 14:35:05] WARN: IP 203.0.113.5 (user-agent: desktop_firefox) - API Timeout for ISP lookup.
[2023-10-27 14:35:10] INFO: IP 198.51.100.10 (user-agent: mobile_safari) - Detected ISP: Amazon.com, Inc. (AWS) - (Expected: T-Mobile or Verizon)

i'm desperately seeking advice on this. are there more robust isp detection methods i should be looking into? or am i missing some common pitfalls when it comes to mobile ips or vpn traffic? any insights on how to get accurate ip address lookup for isp data would be a lifesaver right now. we need to fix this asap.

thanks in advance!

2 Answers

0
Miguel Hernandez
Answered 1 week ago
Hello Emma Moore, It sounds like you're knee-deep in one of the more frustrating aspects of building web tools: reliable IP intelligence. Pulling your hair out over "UNKNOWN" or "Amazon.com, Inc." when you're expecting T-Mobile is a rite of passage for many of us. Let's dig into why this is happening and what more robust methods you can explore. The core issue you're facing stems from a fundamental distinction between who owns an IP address from a network routing perspective, and who is providing the internet service to the end-user. 1. Hosting Providers vs. End-User ISPs: When a user connects via a VPN or a mobile network, their traffic often exits through a large data center or a centralized gateway. These exit points are typically hosted on cloud infrastructure (like AWS, Google Cloud, Azure) or large hosting providers. From the perspective of an IP lookup service, that IP address legitimately belongs to Amazon or Google, because they are the immediate network owner routing that traffic. Your tool is accurately reporting the network owner of the exit node, not the user's actual home or mobile ISP. 2. Mobile Networks and CGNAT: Mobile carriers frequently use Carrier-Grade Network Address Translation (CGNAT). This means many users share a single public IP address, and that IP address might belong to the mobile carrier's core network infrastructure, which could itself be hosted or peered with a large data center. Furthermore, mobile IPs are highly dynamic, making consistent identification challenging for basic lookups. 3. VPNs: With VPNs, it's virtually impossible to detect the user's actual ISP. The entire purpose of a VPN is to tunnel traffic through a different server, masking the user's original IP and location. Any IP lookup will correctly identify the VPN provider's server and its hosting provider, not the user's underlying internet service. Given this, here's a more robust approach to improve your ISP detection:

1. Focus on Advanced IP Geolocation & Network Intelligence APIs

Instead of just generic geolocation APIs, look for services that specialize in network intelligence and specifically aim to identify the *organization* or *ASN* (Autonomous System Number) that provides the internet service, not just the data center owner. These services often aggregate data from BGP routing tables, reverse DNS, and proprietary databases to give a more granular view.

  • ASN Lookup: Every IP address belongs to an ASN, which is a globally unique identifier for a network. While an ASN might belong to AWS, a good IP intelligence service will often categorize that ASN as "hosting," "mobile," "business," or "residential." You need to look beyond just the immediate network owner to the broader organization associated with the ASN.

2. Implement a Multi-Source Verification Strategy

Relying on a single API can be limiting. Consider querying 2-3 different high-quality IP intelligence providers. If you get conflicting results, you can apply logic:

  • If one API returns a generic hosting provider (AWS, Google Cloud) and another returns a known mobile carrier (Verizon, T-Mobile) for a mobile user agent, prioritize the mobile carrier.
  • If all APIs return hosting providers, it's highly likely the user is behind a VPN or a similar proxy.

3. Manage Expectations for VPN/Proxy Users

For users behind VPNs, it's important to be transparent. Your tool cannot reliably detect their *actual* ISP. The most accurate data you can provide is the VPN provider's network or the hosting company they use. Consider displaying "VPN/Proxy Service" or "Network: [VPN Provider Name]" rather than "UNKNOWN" or a misleading hosting company.

4. Leverage Comprehensive IP Databases (Local or API)

For high-performance or offline lookups, consider integrating a local IP database, often paired with an API for real-time updates or less common ranges. These databases are meticulously curated to map IP ranges to organizations, ASNs, and service types.

Recommended Tools & Services:

These services offer more detailed network information than basic geolocation APIs:

  • MaxMind GeoIP2: They offer both downloadable databases (like GeoIP2 ISP or GeoIP2 Enterprise) and an API. Their databases are very robust for identifying ASNs, organizations, and service types (e.g., dialup, cable/DSL, corporate). This is often the gold standard for detailed IP data.
  • IPinfo.io: Excellent for ASN, organization, and distinguishing between hosting, business, and residential IPs. Their data is quite granular and updated frequently.
  • Abstract API / IP-API.com: Good general-purpose IP geolocation, but ensure you're using their more advanced endpoints that provide ASN and organization details, not just city/country.

Example Refined Logic:

Instead of:

IP 198.51.100.10 - Detected ISP: Amazon.com, Inc. (AWS) - (Expected: T-Mobile or Verizon)

Your logic might become:

  1. Query IPinfo.io for IP `198.51.100.10`. Result: ASN: AS16509, Org: Amazon.com, Inc. Type: Hosting.
  2. Query MaxMind GeoIP2 for IP `198.51.100.10`. Result: ASN: AS16509, Organization: Amazon.com, Inc. Connection Type: Data Center.
  3. Based on user-agent (mobile_safari) and the "Hosting/Data Center" type from multiple sources, you can infer this is likely a mobile user whose traffic is exiting through an AWS data center (perhaps via a VPN or a specific mobile carrier's gateway).
  4. Display: "Network Provider: Amazon.com, Inc. (AWS) - (Likely Mobile/VPN Exit Node)" or "Connection Type: Data Center / Mobile Gateway".

This approach manages user expectations and provides more accurate context, even if it can't pinpoint the exact residential ISP behind a VPN or complex mobile routing. You're dealing with the realities of how modern internet traffic is routed.

Hope this helps your conversions!
0
Emma Moore
Answered 1 week ago

Oh nice! This gives me so much new context about what's actually happening, thank you Miguel Hernandez...

Your Answer

You must Log In to post an answer and earn reputation.