Tula Networks
Documentation
Toggle sidebar

GeoIP Routing

Route traffic based on client geographic location

GeoIP Routing

GeoIP routing enables Tula's GSLB engine to direct client traffic to the nearest or most appropriate data centre based on the geographic location of the requesting client. This is powered by MaxMind's GeoIP2 database, which maps IP addresses to countries and continents, and by gdnsd's built-in geographic plugin that uses this data to make real-time routing decisions.

How GeoIP Routing Works

When a DNS query arrives at the Tula GSLB node, gdnsd extracts the source IP address of the query -- or the EDNS Client Subnet (ECS) address if provided by the recursive resolver -- and looks it up in the GeoIP2 database. The database returns the country and continent associated with that IP address. gdnsd then consults the configured geographic zone map to determine which data centre should serve that region and returns the corresponding IP address in the DNS response.

This lookup happens entirely in memory and adds negligible latency to DNS resolution. The GeoIP2 database is loaded at startup and can be refreshed without restarting the DNS service.

Configuring Geographic Zones

Geographic zones define the mapping between world regions and your data centres. Each zone groups one or more countries or continents and assigns them to a specific site.

In the Tula web interface, navigate to GSLB > Geographic Zones to configure your mappings:

  1. Create zones that correspond to your data centres (e.g., "EU-West", "US-East", "APAC").
  2. Assign continents or countries to each zone. You can map at the continent level for broad coverage or at the country level for granular control.
  3. Associate each zone with a site by specifying the VIP or endpoint address that should be returned for clients in that zone.

Example mapping:

Zone Regions Data Centre
EU-West Europe (all countries) Frankfurt
US-East North America New York
APAC Asia, Oceania Singapore
Default All other regions New York

Countries not explicitly assigned to a zone inherit their continent's mapping. Continents not explicitly mapped fall through to the default zone.

Mapping Regions to Data Centres

When designing your geographic mapping, consider the following factors:

  • Network path efficiency. Geographic proximity does not always correspond to network proximity. Users in South America may have better connectivity to a US site than to a European one, depending on submarine cable routes and peering arrangements.
  • Regulatory requirements. Some jurisdictions require that user data remain within specific geographic boundaries. Ensure your mappings comply with applicable data residency regulations.
  • Capacity planning. Verify that each data centre has sufficient capacity to handle the traffic volume from its assigned regions. Use weighted responses if you need to split a region's traffic across multiple sites.

Fallback Behaviour

When geographic data is unavailable for a given client IP -- which can occur with private IP ranges, newly allocated IP blocks, or satellite/VPN providers -- Tula falls back through the following chain:

  1. Country lookup -- If the specific country is found, use its zone assignment.
  2. Continent lookup -- If the country is unknown but the continent is identified, use the continent's zone.
  3. Default zone -- If no geographic information is available at all, route to the configured default data centre.

This layered fallback ensures that every client receives a valid DNS response, even when GeoIP data is incomplete. You should always configure a default zone to guarantee coverage.

Updating GeoIP Databases

MaxMind updates the GeoIP2 database regularly to reflect changes in IP address allocations. Keeping your database current ensures accurate geographic routing.

Tula provides built-in GeoIP database management through the web interface:

  1. Navigate to System > GeoIP Database.
  2. Enter your MaxMind licence key (obtained from your MaxMind account).
  3. Tula will download and install the latest GeoIP2 database.
  4. Schedule automatic updates to keep the database current. Weekly updates are recommended.

Database updates are applied without restarting the GSLB service. gdnsd detects the updated database file and reloads it automatically, ensuring zero-downtime updates to your geographic routing data.