DNS load balancing with dynamic IP adresses


I have a dynamic ip address setup with ddclient as suggested in this page:

So I have pc1.domain.com and I’m thinking of expanding with pc2.domain.com, The very next page is the dns load balancing one:
It says that I can have multiple A or AAAA records for the same zone but my question here is how can I incorporate this with the dynamic ip setup?

I thought I could try to have the two A records and then have two matching root CNAME records but apparently this is not allowed, is there some other record type or something I can use to do load balancing with DNS?

Or is there a way I can reference each individual root A record in ddclient with some kind of id or with a Comment added through Record Attributes?

Sorry if I’m not in the right place, maybe this is a question more specific to ddclient or DNS-O-Matic :sweat_smile:

I will migrate to AWS

I didn’t migrate to AWS, this is possible to do with the API after adding comments to the records

The following python script will look through a specific zone and find a DNS record matching a specific comment and update it with the current ip, it can be ran every 30 minutes or whenever using crontab

# python3 update_ip.py (zone_id) (comment)

import sys
import urllib.request
import CloudFlare

def getIP():
  return urllib.request.urlopen('http://ip1.dynupdate.no-ip.com/').read().decode('utf-8')

def getRecordIdentifier(zone_id, comment):
  cf = CloudFlare.CloudFlare()
  record_id = cf.zones.dns_records.get(zone_id, params={'comment': comment})
  record_id = record_id[0]['id']

  return record_id

def updateRecord(zone_id, record_id, ip):
  cf = CloudFlare.CloudFlare()
  cf.zones.dns_records.patch(zone_id, record_id, data={'content': ip})

if __name__ == '__main__':
  updateRecord(sys.argv[1], getRecordIdentifier(sys.argv[1], sys.argv[2]), getIP())



This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.