NewHalo Edge 3 is here: HTTP/3 everywhere and 42 edge locations.Learn more
Docs / Domains and DNS

Lower your TTL before a migration

Domains and DNS5 min readUbuntu 24.04 LTS

A TTL (time to live) tells DNS resolvers how long they may cache an answer. If your TTL is one day and you change a record, some visitors may keep using the old address for up to a day. Lowering the TTL ahead of a migration makes the switch take minutes instead.

Before you begin

  • Access to the Lantern DNS editor in your LightServe control panel.
  • The dig tool. Install it with sudo apt update and sudo apt install -y dnsutils.
  • A planned migration date, and a list of the records you will change, such as example.com and www.

Step 1: Check the current TTL

Ask DNS for the record and read the number in the second column of the answer. That number is the TTL in seconds. The +noall +answer options hide the extra output so only the answer is shown.

dig +noall +answer example.com A
example.com.   86400   IN   A   203.0.113.10

A TTL of 86400 seconds means one day. Repeat this for every record you plan to change.

Step 2: Plan the wait

The safe rule is to lower the TTL at least as long as the old TTL before you migrate. Resolvers that cached the old value will only refresh once their cached copy expires. If the old TTL is one day, lower it at least one day before the cutover. This calculation converts seconds to hours:

echo $((86400 / 3600)) hours
24 hours

Step 3: Lower the TTL in Lantern DNS

Open the Lantern DNS editor, select the record, and change its TTL to 300, which is five minutes. Save the change. Leave the IP address alone for now. You are only changing how long answers are cached.

Step 4: Confirm the new TTL is live

Query again after a few minutes. The TTL column should show the new value.

dig +noall +answer example.com A
example.com.   300   IN   A   203.0.113.10

Keep the old server running during the whole old-TTL window. Some visitors will still reach it until their cached answers expire.

Step 5: Migrate during the short TTL window

Change the A record to the new address, 203.0.113.20 in this example, and save. Then check the result. The first command lists the nameservers for your domain. The second asks one of them directly, which shows the new answer without waiting on caches elsewhere. Replace ns1.example.com with one of the names from the first command.

dig +short NS example.com
dig @ns1.example.com +short example.com A
203.0.113.20

Step 6: Raise the TTL back later

Once the new server has been stable for a day or two, raise the TTL to something like 3600 (one hour) or higher. A very low TTL means more DNS queries, which is unnecessary when nothing is changing.

Tip: Lower the TTL well before the change window, not during it. The short TTL only helps once the old long TTL has expired from caches.
Careful: Do not shut down the old server as soon as you change the record. Keep it serving until the old TTL has passed and your logs show traffic arriving at the new server.

Troubleshooting

  • Visitors still reach the old server. Their resolvers are still using a cached answer. Wait out the old TTL and keep the old server online until then.
  • The TTL did not change. Confirm that you saved the record in the editor, then query the nameserver directly with the dig @ command shown above.
  • You forgot to lower the TTL in advance. Keep the old server running for the full old TTL after the change. Do not rush the shutdown.
  • The answer is empty. Check the record type and the name. An A record and a CNAME for the same name cannot coexist.

Next steps

To check what the wider internet sees during the change, read Troubleshoot DNS with dig. For details on editing records, see Manage records in the Lantern DNS editor.

Something not working? Chat or email our support team and we will help you get unstuck.

Contact support