Skip to content
drugoi.dev
TwitterTelegramLinkedIn1on1

Fixing DNS on a DigitalOcean Droplet

digitalocean, dns, devops, troubleshooting

The post was originally written for the Telegram channel.

At the end of the weekend, for some reason, the default DNS from Digital Ocean for Kazakh domains broke down, which is why two of my bots that are associated with Kazakh sites (KazNic and the National Bank website) stopped reaching them and fell into the EAI_AGAIN error, which indicates that there was a timeout when requesting DNS records for the domain.

A quick fix was to put IP addresses in /etc/hosts, but I didn't like this solution.

After conducting several tests, I found out that the domains are only accessible from VPS on Digital Ocean and decided that I could try changing the DNS on the server itself.

If you have a standard droplet from Digital Ocean, then this is very easy to do: vi /etc/netplan/50-cloud-init.yaml

nameservers:
addresses:
- 1.1.1.1
- 1.0.0.1

We find the section with nameservers and change the addresses to the required ones (I chose DNS from Cloudflare).

Note: After rebooting the server, these settings will be reset, but who reboots their server anyway?

After changing the NS records, exit vi and apply the parameters: sudo netplan apply

Done, you can check the functionality, for example, through curl yourwebsite.kz

💚 Nikita Bayev Paper Company
Theme by LekoArts