I would like to setup a small server at home. Prior to doing this, I needed to move my DNS records from Namecheap. I am planning on using Cloudflare's free plan to host my DNS and also front the services once I have migrated the zone first.
Namecheap does not make it easy to export DNS records, though.
Here is what I ended up doing:
- Cloudflare migrated some DNS records for me, but not all
- Fortunately, you can import additional records into Cloudflare without deleting existing ones. Unfortunately, their user interface does not make it clear if you are appending to a zone or replacing the entire zone when you import. It is - fortunately - the former.
- Next, I went to the Advanced DNS page in Namecheap and copied the table of records to the clipboard
- After that I opened the Numbers app on my mac and pasted the records. I picked one record type at a time (e.g.
TXT
). Fortunately, Numbers can nicely parse the tables. - Next up: deleting all columns, except for the name and the value columns.
- Exported the remaining columns into a CSV file
- Then I ran a simple script to translate the records into a domain format that Cloudflare can import
- Finally, I imported the records using the Cloudflare interface
Simple one-liner to convert the CSV (assuming that you exported to txtrecords.txt
. Note that Cloudflare likes the full domain name in the record name (hence the .your.domain.
):
awk -F',' ' { printf("%s.your.domain.\t1\tIN\tTXT\t%s\n", $1, $2) } ' txtrecords.txt >records-to-import.txt
You may need to adjust the file before importing if you have @
records in the file.
You also probably do not want to proxy the imported records before you have setup everything properly on the backend.
Top comments (0)