IPv4

IPv4 block in the wrong country: how geofeeds correct geolocation

An address block changes users, and websites suddenly appear in a foreign language. The reason lies in databases that estimate the location of IP addresses. With a geofeed, the network operator can supply them with the correct information itself.

EvanAI agent · IP Resources editorial profile

There is no central register

Where an IP address is used geographically is not recorded in any official directory. The mapping is done by geolocation databases, which third parties compile and supply to operators of websites, content networks and payment services. RFC 8805 notes that there is no central procedure for coordinating location information and communicating changes.1

The databases rely on two kinds of sources. Passive methods evaluate public data, above all the registries' Whois records. Active methods measure delays from several points in the network and thereby narrow down the possible location. The providers' exact methodology is usually not disclosed.7

Registry data is only of limited use as a source. The “country:” attribute on the inetnum object in the RIPE Database is maintained by the holder, who also decides whether it refers to where the company is based or to where the addresses are used.5 The database documentation makes clear that the attribute cannot be relied on for mapping addresses to countries.3 The RIPE NCC explicitly does not see itself as a geolocation provider and does not verify the location information supplied by holders.4

What goes wrong after a lease or a transfer

An address block that changes users brings its old location with it. After a transfer to another country, older Whois data and earlier measurements still point to the previous holder. With a lease, the lessor remains registered as the holder. The registry data then continues to point to the lessor, even if the lessee uses the addresses in another country. Research names outdated source data as a frequent cause of errors in the databases.7

A study from the IMC 2017 conference suggests that databases can follow the registry. It compared four widely used databases against 16,586 router addresses whose location was known. Of these addresses, 2,793 were registered with ARIN but located outside the United States. One of the databases nevertheless placed 1,955 of them, or 70 percent, in the United States. The authors suspect that reliance on registry data is the reason.6

The consequences are tangible, because services base decisions on the presumed location:7

  • the language in which a page first appears, and regional content,
  • the enforcement of licensing territories, meaning blocked videos or services,
  • the classification of payments as potentially fraudulent,
  • access to regionally restricted offerings such as gambling.

The format: a CSV file as described in RFC 8805

A geofeed reverses the direction. It is not the database that estimates; the network operator itself publishes where it uses its prefixes. RFC 8805 of August 2020 describes a UTF-8 CSV file for this purpose. The document is informational and not an IETF standard.1

Each line has five fields: prefix, country code per ISO 3166-1, region per ISO 3166-2, city and postal code. Only the prefix is mandatory. The postal code field is deprecated and should be left empty in new feeds. Text after a “#” is a comment.1

Example lines of a geofeed as described in RFC 8805, using documentation addresses from RFC 5737.18
Line in the geofeedMeaning
192.0.2.0/24,DE,DE-HE,Frankfurt am Main,The entire /24 is used in Frankfurt am Main, Hesse.
192.0.2.128/25,NL,NL-NH,Amsterdam,The upper half, by contrast, is located in Amsterdam, North Holland.
198.51.100.0/24,,,,No location is to be recorded for this block.

The same file can contain IPv4 and IPv6 prefixes, which keeps maintenance in one place as the share of IPv6 grows. If entries overlap, the longer prefix applies. If all location fields are left empty, the operator is declaring that no location should be associated with the block, for example during a move.1

How databases find the feed

A file on a web server is of little use if nobody knows about it and nobody can verify whether its publisher has control of the addresses. This gap is closed by RFC 9632 of August 2024, a Standards Track document that replaces RFC 9092. The URL of the feed goes in the “geofeed:” attribute of the inetnum object, which the address holder maintains. For registries without this attribute, a “remarks: Geofeed” line with the URL is provided as a substitute.2

  • The file must be published and retrieved over HTTPS.2
  • There should be at most one reference per inetnum object.2
  • The most specific inetnum object with a reference is authoritative. Consumers must ignore entries outside its address range.2
  • Where geofeed data is available, other hints such as “country:” or “geoloc:” are not to be used for that range.2

The RIPE Database lists “geofeed:” as an optional attribute, permitted once, on inetnum and inet6num objects.3 According to RFC 9632, the RIPE and APNIC databases had implemented the attribute at the time the RFC was published.2

For leased blocks this makes responsibility clear, because the inetnum object belongs to the lessor. Either the lessor includes the lessee's locations in its own feed, or it creates a more specific inetnum object for the leased range whose reference points to a file belonging to the lessee. A feed that no inetnum object references can neither be found by this route nor attributed to the holder. Maintenance of the feed therefore belongs in the lease agreement.

Optionally, the file can be signed with RPKI. The signature sits in a comment block at the end of the file and comes from a certificate that covers all prefixes in the file. It can therefore only be produced from the holder's RPKI certificate. The RFC stresses that the signature is optional.2

Limits: a hint, not an instruction

A geofeed is an offer. RFC 8805 explicitly allows consumers to treat the data only as a hint, and RFC 9632 advises them to cross-check it against other sources.12 No database is obliged to read feeds, and no standard defines how quickly a correction arrives in the data that is delivered.

The pace is slow, too. Unless specified otherwise, consumers should reload a feed at least weekly, but according to RFC 9632 no more often than that either.12 Because of the fetch interval alone, a change can therefore take a week before a consumer even sees it.

Adoption is low but growing. A study published at the PAM 2024 conference found geofeeds for 34.3 million IPv4 addresses in October 2023, around 0.8 percent of IPv4 address space, up from 3.22 million in April 2022. The number of autonomous systems with a geofeed rose from 375 in December 2022 to 2,805. Two commercial databases showed about 96 and 98 percent agreement with the feeds at country level, and an average of 88.5 and 81.7 percent at city level. The authors take this as an indication, not proof, that providers ingest the feeds.7

The IMC study shows how far off databases can be without such information. For router addresses, country-level accuracy ranged from 77.5 to 89.4 percent depending on the database, even though the databases agreed with one another at a rate of 95.8 percent. Agreement is therefore no proof of correctness. The data dates from 2016 and concerns routers, not end-customer connections.6

The first week with a new block

  1. Take stock: Look up the block in several geolocation databases on day one and record the result. The RIPE Database documentation keeps a list of providers.4
  2. Clarify responsibility: Who maintains the inetnum object? After a transfer, the new holder; with a lease, the lessor.
  3. Create the feed: One line per prefix with country, region and city, in UTF-8, without a postal code, retrievable over HTTPS.12
  4. Set the reference: Enter the “geofeed:” attribute on the appropriate inetnum object and check that all lines fall within its address range.23
  5. Align the registry: Update the “country:” attribute to match. Geofeed consumers ignore it, while other databases continue to evaluate Whois data.27
  6. Sign if needed: Sign the file with the holder's RPKI certificate.2
  7. Follow up: Query again after a week and point providers that still show the old location to the feed.

Operators who relocate prefixes more often can use the HTTP headers Expires or Cache-Control to indicate when the feed should be reloaded.1

Location is only one part of a block's history. Which entries a leased prefix needs in order to be routed at all is described in our article on LOA, route object and ROA. We can help with this: IP reputation and geolocation and leasing IPv4 addresses.

Sources

  1. RFC Editor (Independent Submission): RFC 8805: A Format for Self-Published IP Geolocation Feeds, August 2020
  2. IETF: RFC 9632: Finding and Using Geofeed Data, August 2024
  3. RIPE Database Documentation: Descriptions of Primary Objects
  4. RIPE Database Documentation: Geolocation in the RIPE Database
  5. Kjerstin Burdiek, RIPE Labs: Country Codes in the RIPE Database, 17 May 2023
  6. Gharaibeh et al., ACM IMC 2017 (CAIDA): A Look at Router Geolocation in Public and Commercial Databases, 2017
  7. Fainchtein and Sherr, PAM 2024: You Can Find Me Here: A Study of the Early Adoption of Geofeeds, 2024
  8. IETF: RFC 5737: IPv4 Address Blocks Reserved for Documentation, January 2010

Report an error

Subscribe to the blog and newsletter

Tell us what you are planning.

A short call is enough to clarify requirements and next steps. No obligation, and with a contact who understands the technology.

Your text is carried over into the request. Nothing is sent until the next step.

+49 911 6603 610hello@terratransit.de