Skip to content

Instantly share code, notes, and snippets.

@taqtiqa-mark
Created January 29, 2020 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taqtiqa-mark/7d301f7ab6fcef1987dd6b34f8803819 to your computer and use it in GitHub Desktop.
Save taqtiqa-mark/7d301f7ab6fcef1987dd6b34f8803819 to your computer and use it in GitHub Desktop.
droplet discovery over digitalocean private networks

Digital Ocean recently released private networking support in their NYC2 Data center.

They also published a blog post on how to setup a new droplet with private networking. But one thing the post doesn't do is tell you how to scale your private network for many boxes. One approach is obviously to edit /etc/hosts (but this gets annoying when you add a new box). A better way is to create an internal DNS zone (via the digital ocean web interface) and have your droplets use it:

Steps

setup the internal DNS zone file

  1. Login to digital ocean
  2. Click "DNS" on the right hand menu
  3. Click "Add Domain"
  4. Name it "in.example.com" (obviously use whatever TLD you want).
  5. Click "Create Domain"
  6. For each droplet you want resolved by name, add an A record with the droplet hostname and private IP.

configure droplets

On each Droplet you create, edit the /etc/resolv.conf file to contain the following

search in.example.com
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 198.199.120.125
nameserver 141.0.170.89
nameserver 198.199.95.114

Done!

Now all of your droplets can ping one another by hostname over the private network. And when you add a new droplet, just add it to the internal DNS zone and it will be visible by other droplets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment