Skip to content

Instantly share code, notes, and snippets.

@raykao
Created October 13, 2013 03:56
Show Gist options
  • Save raykao/6958002 to your computer and use it in GitHub Desktop.
Save raykao/6958002 to your computer and use it in GitHub Desktop.

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