How IP and GEO Filtering Work: BGP Routing, GeoIP Databases, and Ad Crawler Safety
A clear, practical guide to IP and GEO filtering: how ASN network lookups differ from GeoIP location databases, why mobile city location drifts, and how to avoid blocking ad review bots.
- 01 How Does a Website Know Who Owns an IP Address—and What Country It Is In?
- 02 Why Does GeoIP Show the Wrong City on Mobile Phones, Leased IPs, and VPNs?
- 03 How to Handle Country-Specific Offers Without Triggering "Destination Not Working" Bans
- 04 3 Quick Checks Before Launching a Country-Targeted Ad Campaign
How Does a Website Know Who Owns an IP Address—and What Country It Is In?
IP and GEO filtering is how a website or traffic tracker looks at an incoming visitor's IP address to identify two things: what kind of network they are connecting from (home internet, mobile phone carrier, or rented cloud server) and which country or region they are located in. For media buyers, understanding how these lookups actually work saves you from two expensive mistakes: accidentally blocking Google or Facebook ad review bots from other countries, or throwing away real mobile buyers because a database guessed the wrong city.
When a click hits your server, two completely separate lookups happen behind the scenes—and confusing them is the #1 source of bad filtering rules:
- Network Ownership via BGP & ASN (Who Runs the Network—Not Physical Location): BGP (Border Gateway Protocol, RFC 4271) is the postal routing system of the internet. BGP tables map an IP range to an ASN (Autonomous System Number)—the unique ID of the organization operating that network, such as
AS15169(Google),AS32934(Meta),AS3320(Deutsche Telekom), orAS16509(Amazon AWS). BGP itself contains zero physical coordinates or city names. A global cloud provider like AWS uses the exact same ASN (AS16509) for servers in Virginia, Frankfurt, and Tokyo. - Physical Location via GeoIP Databases (An Educated Estimate, Not GPS): To estimate which country or city an IP block is used in, commercial database providers (such as MaxMind GeoIP2, IPinfo, IP2Location, and Cloudflare) combine regional registry records (ARIN, RIPE, APNIC), network latency measurements, and operator-published location files called Geofeeds (IETF RFC 8805).
Because GeoIP is a lookup table rather than a live GPS reading from the user's phone, anytime an internet provider moves an IP block to a new city, the database can lag behind reality by days or weeks.
Reads X-Forwarded-For / CF-Connecting-IP ONLY if socket IP
Maps IP prefix to Autonomous System (Mobile ISP
Resolves Country and Region using MaxMind/IPinfo + self-published ISP geofeeds
Applies localization while allowing verified global ad crawlers
Read from connection or trusted proxy header
Home ISP, Mobile Carrier, or Cloud Server Host
Lookup table (accurate for country, drifts on mobile)
Why Does GeoIP Show the Wrong City on Mobile Phones, Leased IPs, and VPNs?
Media buyers who target a specific city or state in Google Ads or Facebook Ads often panic when their tracker logs show clicks coming from a city 300 kilometers away. As documented in MaxMind's GeoIP2 Accuracy Benchmarks, GeoIP accuracy depends heavily on how the user connects to the internet:
- Mobile 4G/5G Carrier Gateways: When someone on a smartphone in Munich or Manchester taps your ad, the ad platform knows they are in Munich using app location signals. However, their mobile carrier often routes their internet traffic through a central national gateway in Frankfurt or London before it reaches your website. To your server's GeoIP database, that buyer looks like they are in Frankfurt—even though they are physically standing in Munich.
- Leased and Reassigned IPv4 Blocks: Because IPv4 addresses are scarce, internet providers and hosting companies frequently rent blocks of 256 addresses (
/24) across borders. Until the new operator updates its RFC 8805 geofeed and commercial GeoIP databases refresh, an IP block serving real customers in Spain or Poland may still show up in databases as the US or Netherlands. - Apple iCloud Private Relay & Corporate VPNs: While Apple's Private Relay keeps iPhone users in their correct country and time zone, corporate security networks (like Zscaler) often route company employees in multiple European branches through one central office gateway in Dublin, London, or Frankfurt.
| Connection / Network Type | Country-Level GeoIP Accuracy | City / Region GeoIP Accuracy | Safe Media-Buying Filtering Rule |
|---|---|---|---|
| Fixed Home Broadband (Fiber/Cable ISP) | High (~99% in major markets) | Moderate to High (within metro area) | Safe for country-level localization; avoid strict city-level blocks. |
| Mobile Cellular 4G/5G (CGNAT) | High (matches national carrier) | Low (resolves to regional carrier gateway) | Never block mobile users for city/state GeoIP mismatches. |
| Apple iCloud Private Relay | High (preserves country/timezone) | Moderate (assigned to regional relay pop) | Do not block Cloudflare/Akamai/Fastly egress ASNs on iOS traffic. |
| Ad Network Crawlers (AdsBot / Meta) | N/A (Often crawls from US/IE data centers) | N/A (Data center location, not target geo) | Always allow HTTP 200 OK regardless of crawler GeoIP country. |
How to Handle Country-Specific Offers Without Triggering "Destination Not Working" Bans
The single most common mistake in GEO filtering is setting Cloudflare, Nginx, or a PHP script to block or 302-redirect visitors whose IP address is outside your campaign's target country.
Why does that break your ads? As explained in Google Search Central's Locale-Adaptive Pages Guide and Google Ads Destination Requirements (Answer 6368661), official ad review bots (AdsBot-Google, facebookexternalhit, Bytespider) frequently inspect your landing page from data centers in the United States, Ireland, or Singapore—even when your ad campaign targets only Germany, Brazil, or Japan. If your server blocks or redirects US IP addresses, the review bot gets locked out of your landing page, triggering an immediate Destination Not Working or Cloaking / Circumventing Systems disapproval (Answer 15938075).
Here is the safe, compliant way to run country-specific pages:
- Give Each Language or Country Its Own URL: Put your German offer at
/de/offerand your Spanish offer at/es/offer, and allow any IP address in the world to open/de/offerwithHTTP 200 OK. - Use Polite Banners Instead of Hard Blocks: If someone from outside your delivery area opens the page, show the normal page with a friendly banner at the top ("Note: Delivery for this offer is currently available within Germany").
- Monitor IP, ASN & Country Together in Your Logs: When using a traffic analysis tool like Cloaking Master, media buyers can view IP, network owner (ASN/ISP), and GeoIP country side by side for every click—making it easy to see when foreign ad review bots or mobile carrier gateways visit a regional page and ensuring official crawlers are never geo-blocked.
3 Quick Checks Before Launching a Country-Targeted Ad Campaign
Before spending money on a regional campaign in Google, Meta, or TikTok, run these three checks on your IP and GEO setup:
- Test Your Regional URL With US/Global Crawler Tools: If your campaign targets France (
FR), runhttps://yourdomain.example/fr/offerthrough Google Search Console's URL Inspection tool and Meta's Sharing Debugger (which connect from US/EU servers). Confirm your server returnsHTTP 200 OKand shows the full French page without redirecting to/en/or returning a403block. - Check IPv6 Compatibility (
AAAARecords): Over half of mobile phone traffic in many countries runs on IPv6 (longer 128-bit addresses like2a01:...). Make sure your server, firewall, and GeoIP database handle IPv6 addresses just as cleanly as older IPv4 addresses. - Keep Your GeoIP Database Updated: If your server looks up countries using a local MaxMind GeoLite2/GeoIP2 file instead of CDN headers, set an automatic weekly update so newly reassigned ISP blocks and RFC 8805 geofeeds stay fresh.
- Remember the difference: BGP tells you the network owner (ASN—such as a mobile carrier vs.
- Never block mobile ad traffic based on city-level GeoIP, because cellular carriers route traffic from many citie…
- Keep your paid landing pages open (
HTTP 200 OK) to ad crawlers from every country, and use polite top banners …
Mobile carriers route cellular traffic through regional PGW/GGSN core gateways hundreds of kilometers away from the user.
Frequently Asked Questions (FAQ)
Does BGP tell a server what city or country a user is physically located in?
No. BGP (Border Gateway Protocol) only announces which network operator (ASN) routes a given IP block. Physical country and city estimates come from separate GeoIP databases and RFC 8805 geofeeds.
Why do mobile users in one city show up as a different city 200 km away in my server logs?
Mobile phone carriers route cellular data from many towns through centralized regional gateways. GeoIP databases record the city of the carrier’s gateway equipment rather than the shopper’s phone GPS.
Can I block all IP addresses outside my target country in Cloudflare WAF to stop foreign bots?
Blocking all foreign IPs on a paid ad landing page is dangerous because AdsBot-Google, Meta’s crawler, and TikTok review systems regularly inspect your link from US, Irish, or Singaporean data centers. Blocking them causes *Destination Not Working* disapprovals.
Related Technical Guides
View Topic Archive →Traffic Filtering Explained: Edge Defense, Synthetic Case Study, and Policy Compliance
A clear, complete guide to web traffic filtering: how edge firewalls, bot management, and attribution routing work together—plus a step-by-step case study on avoiding costly false positives.
Why Advertising Traffic Gets Flagged as Suspicious: Diagnosing IVT, CGNAT, and False Positives
A clear, practical guide to why your paid ad traffic gets flagged as bots or fraud: separating real click fraud and scrapers (IVT) from mobile carrier CGNAT, iCloud Private Relay, and proxy misconfigurations.
VPN, Proxy, and Hosting Traffic Explained: ASN Taxonomy, Residential Proxies, and False-Positive Risks
A clear, practical comparison of cloud hosting IPs, commercial VPNs, Apple iCloud Private Relay, residential proxies, and 4G/5G mobile proxies—and how to block scrapers without losing real buyers.
Google Ads Landing Page Quality Checklist: Destination Rules, AdsBot Access, and Technical QA
A clear, practical checklist for Google Ads landing pages: passing Destination Requirements, avoiding AdsBot-Google firewall blocks, keeping Display and Final URLs matched, and understanding Quality Score.