dns

now browsing by tag

 
 

Configuring and using georouting

Scenario:

You have several servers around the world publishing a website or an application that is accessed by users coming from different countries and geographies.

You want to be able to decide which server(s) users will reach based on their country/countries of origin, and you want to handle “fallback” scenarios in case one or more servers are not available.

GSLB.me georouting allows the creation of an unrestricted number of “routing rules” to achieve flexible, granular and precise DNS balancing and traffic distribution.

Georouting rules can be based on:

  • country of origin of the requesting DNS client
  • ASN (Autonomous System Number) of origin of the requesting DNS client
  • ISP (Internet Service Provider) of origin of the requesting DNS client

In the following configuration example we will assume:

  • the FQDN that will be resolved by clients worldwide is geo-name.myowndomain.com. This is your website/application host name.
  • we have three servers (targets) that run contents for geo-name.myowndomain.com, that is: you own three servers to support your applications/services/websites:
    • 1 Server in Australia, having IP 1.1.1.1
    • 1 Server in France, having IP 2.2.2.2
    • 1 Server in the USA, having IP 3.3.3.3
  • the following georouting rules need to be configured to implement such requirements. Please note that rules ordering is crucial to achieve the desired DNS balancing behaviour
    • clients coming from Brazil, Argentina, Peru and Chile will have to be sent to the US-based server (IP address 3.3.3.3). If the US-based server is down, then clients will be redirected to the French server (IP address 2.2.2.2)
    • clients coming fromVerizon UK shall be sent to the US-based server (IP address 3.3.3.3).
    • clients coming from either The United Kingdom or the USA will be sent to the Australian and French servers (IP addresses 1.1.1.1 and 2.2.2.2 respectively). Selecting either the Australian or the French server has to be done in round-robin. If both the Australian and the French server are down, clients will be redirected to the US-based server (IP address 3.3.3.3). Notice that due to the previous, ISP-based rule, users in the UK that connect through Verizon UK will get a 3.3.3.3 reply, whereas other UK-based users will get 1.1.1.1 and 2.2.2.2.
    • clients coming from ASN (Autonomous System Number) AS23564 shall be sent to the Australian server (IP address 1.1.1.1) with no fallback
    • clients originating from other countries will use either 1.1.1.1, 2.2.2.2 or 3.3.3.3 based on their vicinity (geographical proximity) to the three servers. This is a kind of fallback rule, to make sure that valid DNS replies are always sent back to requesting clients.

How to configure it:

Log on to GSLB.me using your credentials or register if you still don’t have an account

Screenshot-1

 If not already done, create an authoritative DNS zone: we will add a geohost to it later on. Georouting rules are applied to geohosts so in order to use georouting the minimum requirement is to set up a geohost: this howto shows the full picture, also including authoritative zone creation.

howto.georouting.1

Fill out domain name and contact e-mail address

howto.georouting.2

when done, click “Save” to save the newly created zone, which is then displayed on the left-hand side of the web interface.

howto.georouting.3

we now need to create the geohost where we will set up georouting. Right clicking on the zone name displays the menu where “Add Geohost” has to be clicked.

howto.georouting.4

In the geohost edit panel, fill out at least the geohost name and set the balancing algorithm to “Georouting” (the “Setup Georouting” button will be enabled automatically) and save the changes. This creates the geohost where georouting will be configured.

howto.georouting.5

The newly created geohost is now displayed in the main zones tree: the yellow star icon indicates that changes have been saved but are still not active, we will commit them later on.

howto.georouting.6

Geohost targets must be added now: each target is one of the servers that host the website/application that we want to access through georouting. Right click on the geohost name and select “Add Target” from the menu:

howto.georouting.7

The target edit panel required configuration of at least the target’s IP Address (or FQDN) and checks to determine whether the target is working as expected or if it’s down/unavailable. After setting paramters, click on save.

howto.georouting.8

The newly added target is then displayed in the main zones tree:

howto.georouting.9

Now repeat the steps to add a new target, in order to enter 2.2.2.2 and 3.3.3.3. When both are added, the main zones tree displays them with the relevant country flags showing their geographical location.

howto.georouting.10

Georouting rules can be configured now. Left click on the geohost name and then click the “Setup Georouting” button on the right.

howto.georouting.11

This opens the georouting configuration dashboard. The dashboard provides full control on rules based on client country, ASN and ISP.

By clicking on “Add country-based rule” we create the first rule we need:

screenshot9a

We need to type the rule descriptive name:

By clicking on “Create” the rule configuration panel is displayed.

The lower section of the dashboard is the rule panel: each rule can be customized by enabling/disabling it and four sections allow full configuration of the rule behaviour.

The “selected countries” section lists the countries that match this rule. The rule itself will be used whenever a DNS request comes from a client located in one of the “selected countries”.

GSLB.me will then check the targets configured in the “Primary targets” list: if available primary targets are found, they are used to build the DNS response. If the “Primary targets” list contains more than one target, the “Primary algorithm” will be used to decide which target(s) to use for the DNS reply.

The “Fallback targets”, if configured, defines the list of one of more targets that are used in case all primary targets are unavailable/marked “down”. The “Fallback algorithm” will be used to determine which fallback targets to use to build the DNS response.

Back to the configuration, from the “available countries” list at the top of the dashboard, one or more countries can be selected and added to the “selected countries” list by clicking the “+” button:

Selected countries are then added to the list of “Selected countries”.

This rule is valid and will be used for all client DNS requests coming from the selected countries. Now its primary targets must be defined: from the “Available targets” list select the primary targets that will clients coming from the specified countries (3.3.3.3 in our example) and click the “+” button in the “primary targets” section:

 

The selected target is moved from the “available targets” list to “primary targets”:

So far, the rule replies to all DNS requests from the selected countries with 3.3.3.3 In case 3.3.3.3 is unavailable, we want to fallback by returning IP address 2.2.2.2, so it must be added to the “Fallback targets” list. To do so, select 2.2.2.2 from the “Available targets” list and click the “+” button in the “Fallback targets” section:

The selected target is then moved to the “Fallback targets” list. Rule configuration is completed:

The second rule must match requests for DNS clients that connect from Verizon UK. An ISP-based rule need to be added by clicking on the “Add ISP-based rule” button:

The rule name must be typed:

 

The new ISP-based rule is then added and its configuration panel is displayed:

Verizon UK must be selected: type a search string in the “ISP search” box (ie. “verizon”, search is case insensitive). The list of Found ISP is updated. You might need to type more characters in case nothing is displayed in the “Found ISPs” list, the maximum number of displayed ISPs is set to 500 to keep the user interface tidy and fast.

 

Select “Verizon UK Limited” from the list of found ISPs and then click the “+” button in the rule configuration panel, to add the selected ISP to the list of those who will match the ISP-based rule:

In our example we want all DNS requests coming from Verizon UK go to 3.3.3.3: we need to select the target from the list of available targets, and then click “+” to add it. The target is then moved to the “Primary targets” list.

ISP rule configuration is complete. The next rule we need is the one matching requests coming from the UK and the USA. Click on “Add country-based rule” to add the new rule:

Type the rule descriptive name and click “Create”:

The rule configuration panel is displayed: select the countries you need to match and click on the “+” button to add them to the rule:

Requests coming from the UK and the USA will be replied with 1.1.1.1 and 2.2.2.2 using a round robin algorithm: select the two targets from the list of available ones and click the “+” button to add them to the list of primary targets.

We need to set up 3.3.3.3 as the fallback target: in case both primary targets are down, it will be used to reply to UK and USA clients. Click on the 3.3.3.3 target and on the “+” button to add it to the fallback targets list.

The next rule to be configured is ASN-based. We need all clients sending DNS requests from AS23564 to get 1.1.1.1 as a DNS response. Click on “Add AS-based rule” to create the new rule:

 

Type the rule descriptive name:

The ASN-based rule configuration panel is displayed:

 

AS23564 must be selected: type a search string in the “ASN search” box (ie. “AS2356, search is case insensitive). The list of Found ASN is updated. You might need to type more characters in case nothing is displayed in the “Found ASNs” list, the maximum number of displayed ASNs is set to 500 to keep the user interface tidy and fast.

 

Primary targets that will be used to reply DNS queries need to be selected: click on 1.1.1.1 in the “Available targets” list and then click the “+” button under the “Primary targets” list, to move the target to the list itself.

 

The last rule to be configured is the default one: it will match all remaining countries in order to return a DNS reply for all clients not matched by the previous georouting rules. The country “– Unknown countries” matches all requests that should come from IP addresses that for some reasons can’t be mapped to a specific country (ie. satellite providers, etc).. Add a country-based rule by clicking on the “Add country-based rule” button:

Type the rule descriptive name:

From the “Available countries” list select all countries: these are those that are not matched by previously configured per-country rules. When done, click on the “+” button in the rule configuration panel to add all selected countries to the rule itself.

 

Select all the three targets and add them to the list of primary targets by clicking on the “+” button. Click on the “Primary algorithm” and select “Proximity”. This way, the “Fallback” rule will reply DNS clients with the geographically closest available target.

 

Once all georouting rules are configured, we need to make sure they will be evaluated in the desired order. Rules ordering can be set up and modified using the “Georouting rules sorter” at the top right side. The “up” and “down” arrows can be used to sort enabled rules.

When rules have been sorted according to your needs, “Save all rules” must be clicked in order to permanently save changes. This step is mandatory.

After saving all rules, modifications must be committed to make them active: this is done by clicking the “Commit” button at the top of the screen.

Georouting configuration is complete. Don’t forget to commit all changes to make them active, by clicking on the “Commit” button displayed at the top of the screen.

The last needed step is authoritative DNS reconfiguration for the “myowndomain.com” domain: authoritative DNS must be set to ns1.gslb.me and ns2.gslb.me. This is of course needed only when DNS resolution for the domain is handled by GSLB.me. Your mileage may vary: you could also create a geohost using georouting and belonging to one of our “public” zones: gslb.biz, gslb.eu, gslb.info, gslb.mobi, gslb.us and gslb.ws and then simply configure a CNAME record in your own authoritative DNS zone in order to have DNS resolution handled by GSLB.me.

Create an authoritative DNS zone

Scenario:

You want to use GSLB.me as the authoritative DNS for your domain “mydomain.com“. mydomain.com can be a new domain you’re about to register, or it can be an already existing domain.

What you get:

  • flexible IPv4 and IPv6 support
  • support for A, AAAA, ALIAS, CERT, CNAME, LOC, MX, NS, RP, SOA, SPF, SRV, TXT records
  • dynamic DNS support for as many FQDNs as you need
  • configurable TTL for all records (subscribers only)
  • support for wildcard records
  • works with all Internet top level domains
  • easy migration from your legacy DNS provider
  • fast and advanced web user interface
  • seamless configuration, no need to manage master and slave DNS servers
  • globally distributed with no single point of failure so that your domains are always accessibile
  • actively developed and supported
  • two access models: totally free or subscription-based for additional features and flexibility

The first domain you configure on GSLB.me for authoritative DNS purposes is totally free.

How to configure it:

Log on to GSLB.me using your credentials or register if you still don’t have an account

authoritative DNS - Logon screen

Create a new “customer zone”: this is the domain name you want to handle using GSLB.me as your authoritative DNS. You can create a customer zone for a domain name you already own (in this case you will ask your registrar to modify the authoritative DNS it relies on) or for a domain name you still have to register (in this case you will tell your registrar to use GSLB.me as your domain’s authoritative DNS servers). Creating a new zone can be done either by clicking on the button you can find on the main page immediately after logging on to GSLB.me…

authoritative DNS - Zone creation

…or by right clicking in the main panel on the “Customer zones” section.

authoritative DNS - Zone creation

The “Zone edit” page allows you to create your domain: here you have to specify the domain name and the e-mail address of the contact person. This e-mail address will be used as the postmaster in the SOA record for your zone.

authoritative DNS - SOA record definition

Once done, click on “Save” to create your zone. After saving, the left-hand side of the page will be updated showing your newly created zone:

authoritative DNS - created zone

The SOA and NS records for your zone have been automatically created. “2 rrsets” indicates that ns1.gslb.me and ns2.gslb.me have been defined as the “NS” records for your domain. You can check this using dig or similar tools:

authoritative DNS - dig testing

On the left-hand side of the screen click on the domain you just created: this brings you to the main domain configuration page.

authoritative DNS - Records editor

Here you can change the domain’s contact e-mail address and fully edit your domain records (also called rrsets). Records types A, AAAA, CNAME, LOC, MX, NS, RP, SOA, SPF, SRV, TXT are supported. In order to add a new record you simply have to type the record name, select the type from the dropdown menu and assign a value. TTL is set to 86400 seconds for free GSLB.me users. Subscribers can set it to anything in the 300-86400 seconds range.

In order to add a record for your zone you have to set the record name, select its type, define the value and set the TTL (free users can’t change TTL: it is set to 86400 seconds by default). When done, click “Add record” in order to save the new rrset.

authoritative DNS - adding record

After saving your record(s), it is displayed in the lower section of the page. In the example here the record name “www” is appended with the zone name: the actual record shown here is www.mydomain.com, and it points to IP address 1.2.3.4

authoritative DNS - saving record

It is required to click on “Save” when all records have been added to your zone. If you don’t do this, your records will be kept but they will not be active. Clicking the “Save” button applies changes and makes all records active and running.

You can now check to see if the newly configured record works fine:

authoritative DNS - resolution testing

After configuring all the records you need (free users are limited to 20 records, subscribers can use an unrestricted number of records per domain) you need to get back to your registrar and tell them that you want to use ns1.gslb.me and ns2.gslb.me as authoritative DNS for your domain (mydomain.com in this example).

Once this last step is completed you’re done! You domain is fully handled by GSLB.me and you can rely on all the features it provides.

When configuring a record you can use a FQDN (Fully Qualified Domain Name) as the record value: for instance record “@”, type “MX” can have a value of “10 myothermailserver.myotherdomain.com.”. If the record value ends with “.” it is used as it is. If it doesn’t end with “.” your zone name is added at the end of the specified record value. For instance record “@”, type “MX” can have a value of “10 mail”. This means that the Mail eXchanger for mydomain.com is mail.mydomain.com where “.mydomain.com” is added after “mail”.

One more last thing: in addition to using GSLB.me as your authoritative DNS of choice you can seamlessly mix static DNS resolution together with GSLB dynamic resolution to handle disaster recovery, business continuity, CDN offload, geographical balancing for one or more records in your domain (such “smart” records are referred to as “geohosts”). To achieve this, simply right click on your domain name and create your geohosts!

authoritative DNS - adding geohost

In order to discover the full power of geohosts you can read our other howtos.

Set up Dynamic DNS

Scenario:

You want to use GSLB.me as the authoritative DNS for your domain “mydomain.com“. mydomain.com can be a new domain you’re about to register, or it can be an already existing domain. Once done, you want to run “www.mydomain.com” from your webserver which sits on an Internet connection with a dynamic IP.

How to configure it:

Log on to GSLB.me using your credentials or register if you still don’t have an account

Screenshot-1

Create a new “customer zone”: this is the domain name you want to handle using GSLB.me as your authoritative DNS. You can create a customer zone for a domain name you already own (in this case you will ask your registrar to modify the authoritative DNS it relies on) or for a domain name you still have to register (in this case you will tell your registrar to use GSLB.me as your domain’s authoritative DNS servers). Creating a new zone can be done either by clicking on the button you can find on the main page immediately after logging on to GSLB.me…

Screenshot-2

…or by right clicking in the main panel on the “Customer zones” section.

Screenshot-3

The “Zone edit” page allows you to create your domain: here you have to specify the domain name and the e-mail address of the contact person. This e-mail address will be used as the postmaster in the SOA record for your zone.

Screenshot-4

Once done, click on “Save” to create your zone. After saving, the left-hand side of the page will be updated showing your newly created zone:

Screenshot-5

The SOA and NS records for your zone have been automatically created. “2 rrsets” indicates that ns1.gslb.me and ns2.gslb.me have been defined as the “NS” records for your domain. You can check this using dig or similar tools:

Screenshot-6

On the left-hand side of the screen click on the domain you just created: this brings you to the main domain configuration page.

Screenshot-8

Here you can change the domain’s contact e-mail address and fully edit your domain records (also called rrsets). Records types A, AAAA, CNAME, LOC, MX, NS, RP, SOA, SPF, SRV, TXT are supported. In order to add a new record you simply have to type the record name, select the type from the dropdown menu and assign a value. TTL is set to 86400 seconds for free GSLB.me users. Subscribers can set it to anything in the 300-86400 seconds range.

In order to add a record for your zone you have to set the record name, select its type, define the value and set the TTL (free users can’t change TTL: it is set to 86400 seconds by default). When done, click “Add record” in order to save the new rrset.

Screenshot-9

After saving your record(s), it is displayed in the lower section of the page. In the example here the record name “www” is appended with the zone name: the actual record shown here is www.mydomain.com, and it points to IP address 1.2.3.4

Screenshot-10

It is required to click on “Save” when all records have been added to your zone. If you don’t do this, your records will be kept but they will not be active. Clicking the “Save” button applies changes and makes all records active and running.

You can now check to see if the newly configured record works fine:

Screenshot-11

After configuring all the records you need (free users are limited to 20 records, subscribers can use an unrestricted number of records per domain) you need to get back to your registrar and tell them that you want to use ns1.gslb.me and ns2.gslb.me as authoritative DNS for your domain (mydomain.com in this example).

When configuring a record you can use a FQDN (Fully Qualified Domain Name) as the record value: for instance record “@”, type “MX” can have a value of “10 myothermailserver.myotherdomain.com.”. If the record value ends with “.” it is used as it is. If it doesn’t end with “.” your zone name is added at the end of the specified record value. For instance record “@”, type “MX” can have a value of “10 mail”. This means that the Mail eXchanger for mydomain.com is mail.mydomain.com where “.mydomain.com” is added after “mail”.

Once this last step is completed, your www.mydomain.com FQDN correctly responds to DNS queries.

 

How to update dynamic DNS records:

Dynamic DNS records can be updated in two ways:

  • Using GSLB.me REST APIs either directly or through GSLB.me update client
  • Using a standard update client such as ddclient: GSLB.me fully supports dyndns2 protocol

 

Updating dynamic DNS records via REST APIs:

You can install GSLB.me update client in order to tell GSLB.me to associate your dynamic IP address to your FQDN (www.mydomain.com in our example).

GSLB.me update client can be downloaded here (you need at least v1.1beta). It’s a Java client, hence it can be run virtually anywhere. It provides a number of parameters in order to correctly fetch your dynamic IP address. Once downloaded and unpacked you will find the startup script inside the “/sbin” directory. Some useful commandlines to run it are:

Updating a FQDN with the public (dynamic) IP of the specified interface without/with custom TTL:

	./sh.GSLB.ME-RestClient -u [username] -p [password] -dyn [fqdn] -iface [interface name]
	./sh.GSLB.ME-RestClient -u [username] -p [password] -dyn [fqdn] -iface [interface name] -ttl [seconds]

Updating a FQDN with the public (dynamic) IP using automatic IP detection without/with custom TTL:

	./sh.GSLB.ME-RestClient -u [username] -p [password] -dyn [fqdn]
	./sh.GSLB.ME-RestClient -u [username] -p [password] -dyn [fqdn] -ttl [seconds]

For correct operations running the update client should be done via crontab every 2 minutes or so, in order to keep your FQDN in sync with your dynamic IP.

Crontab job example:

*/2 * * * *    root     /home/mydir/GSLB.ME-RestClient/sbin/sh.GSLB.ME-RestClient -u username@domain.com -p myPassword -dyn www.mydomain.com -ttl 60 >/dev/null 2>/dev/null

Updating dynamic DNS records via dyndns2 protocol:

GSLB.me fully supports the dyndns2 protocol. It is then possible to use any DNS update client or device that can use the dyndns2 protocol to update your dynamic DNS records.

One of such update clients is ddclient (http://ddclient.sourceforge.net/) and a sample configuration you can use to make it work with GSLB.me is:

daemon=30                       # check every 30 seconds
syslog=yes                      # log update msgs to syslog
mail=YOUR_EMAIL_ADDRESS         # mail all msgs to your e-mail address
mail-failure=YOUR_EMAIL_ADDRESS # mail failed update msg to your e-mail address
pid=/var/run/ddclient.pid       # record PID in file.
use=if,if=ppp0                  # set dynamic IP address via interfaces

server=dynupdate.gslb.me        # GSLB.me update server
login=YOUR_GSLBME_USERNAME      # GSLB.me username
password=YOUR_GSLBME_PASSWORD   # GSLB.me password
protocol=dyndns2                # The dyndns2 protocol
YOUR_GSLBME_DYNAMIC_FQDN        # The dynamic DNS record to update (ie. www.mydomain.com)

 

Conclusion:

One more last thing: in addition to using GSLB.me as your authoritative DNS of choice you can seamlessly mix static DNS resolution together with GSLB dynamic resolution to handle disaster recovery, business continuity, CDN offload, geographical balancing for one or more records in your domain (such “smart” records are referred to as “geohosts”). To achieve this, simply right click on your domain name and create your geohosts!

Screenshot-12

In order to discover the full power of geohosts you can read our other howtos.

^