GeoDNS plug-in

Note: This plug-in requires an "Unlimited Zones" license for Simple DNS Plus.

This plug-in provides a different DNS response depending on what country the DNS request originates from.

This can be used to direct Internet traffic (web, FTP, streaming media, etc.) to a server geographically closer to the end-user, or with contents specific for a geographical area.
Note that this is based on the IP address of the resolving DNS server sending the DNS request, which could be in a different country than end-user. However most end-users will typically be using a DNS server in their own country.

To determine the sender's country, the plug-in uses an IP-to-Country database - see "Data files" below.

Countries are grouped into "regions" for each of which a unique server alias can be defined. The plug-in is pre-configured with a default set of 10 regions (North America, Middle East, etc.) based on CIA's World Factbook, but you can configure this in any way that you prefer.

There are two variants of the plug-in - "CNAME" and "Clone" - both included in the same .dll file. The "CNAME" variant responds with a server name alias (CNAME-record). The "Clone" variant responds with one or more cloned host records (A/AAAA records).

The host name pointed to by this CNAME-record - or the cloned host records - may represent multiple IP addresses (multiple A/AAAA-records) defined elsewhere - for example a local or remote DNS zone or by another plug-in.

On the "Plug-In Settings" tab, enter the following settings (explained below the image):

  • Host name
    Enter the host name that you want to provide GeoDNS data for. For example "www.example.com".
    IMPORTANT: For the "CNAME" plug-in variant, always use a sub-name (like a "www." prefixed name) for which no other DNS records exist. Never use a zone name (such as "example.com") because the CNAME-record would conflict with the zone's SOA- and NS-records and cause various problems.
    If you want to allow end-users to enter your web-site address without the www prefix, you should use the "Clone" plug-in variant.
  • Data file
    Specify the data file to use (see "Data files" below).
    Click the "..." button to browse the local file system and find the file.
    Click the "Test" button to get a count of IP address ranges and countries in the file, and to look up IP addresses in it.
  • Automatically re-load data file when it is updated
    When checked, the plug-in will monitor the data file for updates.
  • Default server alias
    The alias to serve / clone from if the country/region is not found or does not have a specific server IP address / alias defined.
  • DNS record TTL (Time To Live)
    How long the DNS record served may be cached by other DNS servers / caches.
  • Edit Regions / Servers...
    Click this button to open the Regions dialog where you can configure regions and map these to server IP addresses/aliases:

  • Edit Countries / Regions...
    Click this button to open the Countries dialog where you can configure countries and map these to regions:

The GeoDNS plug-in can also be used as a source when setting up DNS request rules for other plug-ins:

For an example of using this for blocking DNS requests from specific countries, see Blocking DNS requests from specific countries.

Data files

As there is no standard for this, we developed our own data file format (.geodns files) - designed to be compact and fast to read into memory in a single pass (the whole database is kept in memory rather than randomly accessing the file).

For file layout specifics see https://github.com/jhsoftware/sdnspi-GeoDNS/blob/master/data-file-format.md

Several companies / web-sites provide IP-to-Country databases - both paid and free.

Two free options are:

https://db-ip.com/db/download/ip-to-country-lite

https://dev.maxmind.com/geoip/geolite2-free-geolocation-data?lang=en

The zip file containing the plug-in (see below) also contains utility programs (convert-dbip.exe / convert-maxmind.exe) which can convert the IP-to-country data files from these sites into the database format used by the plug-in.

To use these download the data file and run (for example):

convert-dbip.exe dbip-country-lite-2023-03.csv.gz ipcountry.geodns

convert-maxmind.exe GeoLite2-Country-CSV_20230321.zip ipcountry.geodns

Do NOT unzip the source files first. The conversion utility will automatically decompress and extract relevant files.

Note: We recommend that you regularly update the data files as this data (IP address / country mappings) does change all the time.

How to obtain this plug-in

Download from https://github.com/jhsoftware/sdnspi-GeoDNS/releases, un-zip it to the Simple DNS Plus plug-in directory (typically "C:\Program Files\Simple DNS Plus\PlugIns"), unblock it (IMPORTANT), and then restart Simple DNS Plus.

Open source

This source code for this plug-in is available at https://github.com/jhsoftware/sdnspi-GeoDNS

Contributions are most welcome.

Related KB articles:

 Comments
Gravatar
13 Jan 2023 06:19 UTC
Nathaniel Courtens
Hello,

In the last image I see a box that reads "Not (revers result)" ... shouldn't it be reading "Provides no revers results"?

Also, can you please provide me with some links on how to best set up a CDN using simpledns.plus.

I have bin using your software for many years. My setup is running from one server, but now it is time to upgrade to be more SEO friendly. I would like to better understand my options. As for now I have https://www.filmfix.com/ served from California (my api location) and https://go.filmfix.com/ serving from Switzerland. But as I understand Google needs to index from one URL; so I need to split the DNS request using GeoDNS. How would this effect email and SSL certificates? Also, I have only parts of the website hosted via https://go.filmfix.com/ they are mainly static html pages. The remaining pages are via the main (api) server.

You help is very much appreciated.
Nathaniel
Gravatar
11 Feb 2023 19:05 UTC
Nathaniel Courtens
Provided link http://software77.net/geo-ip/ in not working.
(Never published. Used for replies and to show your Gravatar icon. Never used for any other purpose.)
Connect