We hope you find this tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more →

How To Set Up a Host Name with DigitalOcean

PostedAugust 28, 2012 1.7m views DNS DigitalOcean

DigitalOcean’s DNS allows you to easily set up your hostname from the DigitalOcean control panel.


Before you get started, you do need to have the following:

  • A Droplet (virtual private server) from DigitalOcean. If you don’t have one, you can register and set one up in under a minute
  • A Registered Domain Name. As of yet, you cannot register a domain through DigitalOcean.

Step One—Look Up Information with WHOIS

The first thing you need to do to set up your host name is to change your domain name server to point to the DigitalOcean name servers. You can do this through your domain registrar’s website. If you do not remember where you registered your name, you can look it up using “WHOIS”, a protocol that displays a site's identifying information, such as the IP address and registration details.

Open up the command line and type:

whois example.com

WHOIS will display all of the details associated with the site, includng the Technical Contact which includes your domain registrar.

Step Two—Change Your Domain Server

Access the control panel of your domain registrar and find the fields called “Domain Name Server.” The forms for my domain registrar looked like this

Point your name servers to DigitalOcean and fill in three Domain Name Server fields. Once done, save your changes and exit.

The DigitalOcean domain servers are

  • ns1.digitalocean.com
  • ns2.digitalocean.com
  • ns3.digitalocean.com

You can verify that the new name servers are registered by running WHOIS again; the output should include the updated information:

Domain Name: EXAMPLE.COM
   Registrar: ENOM, INC.
   Whois Server: whois.enom.com
   Referral URL: http://www.enom.com
   Status: ok

Although the name servers are visible through WHOIS, it may take an hour or two for the changes to be reflected on your site.

Step Three—Configure your Domain

Now we need move into the DigitalOcean control panel.

Within the Networking section, in the Add a domain section, fill in your domain name. Click on the Add Domain button to add the domain. Note: The domain name should not have a "www" at the beginning.

add a domain

You will reach a page where you can enter all of your site details. To make a new hostname, you only need to fill in the A record. If you are using an IPv6 address, you should enter it into the AAAA record.

A Records: Use this space to enter in an IP address of the server that you want to host your domain name on and the host name itself. The hostname will be prepended to your domain name. For example:


To accomplish this, create a new A record with the HOSTNAME set to the word "test". In the WILL DIRECT TO field, enter the IP address of the server you want associated with that name. Your screen should look like this:

Add an A record

Click the Create Record button to add the record.

You can also connect an IP to a domain name with nothing before it:


To accomplish this, create a new hostname with the symbol "@" in the HOSTNAME field. Your screen should look like this:

Add the root A record

Again, click the Create Record button to add the record.

AAAA Records: Use this space to enter in the IPv6 address of the server that you want to host your domain name on and the hostname itself, a name prepended to your domain name. You can also connect your IP to the base domain name with nothing before it. To accomplish this, create a new hostname with the symbol "@' in the hostname field. Your screen should look like this for example:

Add an AAAA record

When you are ready, click the Create Record button.

CNAME Records: The CNAME record works as an alias of the A Record, pointing a subdomain to an A record— if an A Record’s IP address changes, the CNAME will follow to the new address. To prepend www to your URL, click on the CNAME record type and fill out the two fields.

Your screen should look like this:

Add a CNAME record

You can also set up a catchall or wildcard CNAME record that will direct any subdomain to the designated A record (for example, if a visitor accidentally types in wwww instead of www). This can be accomplish with an asterisk in the CNAME HOSTNAME field.

Your screen should look like this:

catch all CNAME records

If you need to set up a mail server on your domain, you can do so in the MX Records.

MX Records: The MX Records fields include HOSTNAME, which determines which hosts the mail record should apply to, the MAIL PROVIDERS MAIL SERVER field, which points to the actual mail server, and the PRIORITY field, which designates the order in which the mail servers should contacted.

In most cases, the HOSTNAME field should be "@" to apply to the base domain. Records always end with a "."A generic MX record looks something like this: mail1.example.com.

Below is an example of MX records set up for a domain that uses google mail servers (note the period at the end of each record). These can be added automatically by clicking on the Add Gmail MX Records button:

Google MX records

Finish Up

Once you have filled in all of the required fields, your information will take a while to propagate, and the Name Server information will be automatically filled in. Your domain name name should be up and supported in a few hours.

You can confirm, after some time has passed, that the new host name has been registered by pinging it:

ping test.example.com

You should see something like:

# ping test.example.com
PING test.example.com ( 56(84) bytes of data.
64 bytes from icmp_req=1 ttl=63 time=1.47 ms
64 bytes from icmp_req=2 ttl=63 time=0.674 ms

You should also be able to access the site in the browser.

See More

If you have any issues or questions, feel free to reach to us on the Forum or by submitting a Support Ticket. Additionally, you can visit our DNS Tips and Tricks page for more information on the DNS capabilities.

By Etel Sverdlov


Creative Commons License