Using Dynamic DNS with Red Cloud

From CAC Documentation wiki
Jump to navigation Jump to search

Introduction

Virtual servers in Red Cloud are assigned random IP addresses every time they are created/booted. You can give your virtual server a domain name (e.g. mycloudserver.cac.cornell.edu) that is consistent regardless how many times you terminate (shut down) the virtual server and start it back up using the following procedures.

Please note: Cornell Center for Advanced Computing is not affiliated with Dynamic Network Services. We just know their services (including the free DynDNS Free) are very handy for locating your virtual server in the cloud. As we do not have control over their services, please contact them for support beyond our basic instructions outlined below if you have questions regarding to how DynDNS works.

Create a Dynamic DNS Host with dyndns.com

  • Log into DynDNS, or create an account if you don't already have one.
  • Click on "My Services" in the left pane. Then "Dynamic DNS Hosts." Click on the "Add New Host" button on the right pane.
  • Enter the dynamic DNS host name you wish to use (This name will not be visible to your users except for the more technical ones who like to snoop around. You will create the virtual server's domain name that will be used by your users later). Select "Host with IP address". Enter the current IP address of your virtual server into the "IP address" field. Click on the "Add to Cart" button and complete the checkout process.
  • Make sure the dynamic DNS host name is working like the example below. This should only take a few seconds:
-sh-3.2$ host <dyndns_host_name>.dyndns.org
<dyndns_host_name>.dyndns.org has address 128.84.8.104

Install Dynamic DNS Client (ddclient) on Virtual Server

You need to run a Dynamic DNS client on the virtual server that checks its own IP address and update its dynamic DNS host name record periodically.

  • Download the Linux client "ddclient" here to your virtual server.
  • On the virtual server, make sure perl-IO-Socket-SSL is installed:
-bash-3.2# yum install perl-IO-Socket-SSL
  • Copy ddclient-3.7.3/ddclient to /usr/sbin
  • Copy ddclient-3.7.3/sample-etc_rc.d_init.d_ddclient.redhat to /etc/init.d/ddclient
  • Set ddclient to auto-start after a reboot:
-bash-3.2# chkconfig ddclient on
-bash-3.2# chkconfig --list ddclient
ddclient       	0:off	1:off	2:on	3:on	4:on	5:on	6:off
  • Create the ddclient configuration file in /etc/ddclient/ddclient.conf. Here's a sample ddclient.conf file:
daemon=300                              # check every 300 seconds
syslog=yes                              # log update msgs to syslog
mail=root                               # mail all msgs to root
mail-failure=root                       # mail failed update msgs to root
pid=/var/run/ddclient.pid               # record PID in file.
ssl=yes                                 # use ssl-support.  Works with
                                        # ssl-library
use=if,                     if=eth0             # via interfaces

# Enter your DynDns.com credentials here
login=<dyndns_user_name>                         
password=<dyndns_passwd>
##
## dyndns.org dynamic addresses
##
## (supports variables: wildcard,mx,backupmx)
##
server=members.dyndns.org,              \
protocol=dyndns2                        \
<dyndns_host_name>.dyndns.org
  • Because your DynDns.com credentials are exposed in the configuration file, make sure it is only readable by root:
-bash-3.2# chmod 600 /etc/ddclient/ddclient.conf 
-bash-3.2# ls -l /etc/ddclient/ddclient.conf 
-rw------- 1 root root 5227 Nov  8 08:57 /etc/ddclient/ddclient.conf
  • Create the /var/cache/ddclient directory and start ddclient
-bash-3.2# mkdir /var/cache/ddclient
-bash-3.2# service ddclient start
Starting ddclient:                                         [  OK  ]
  • Verify ddclient successfully updated the virtual server's IP address:
-bash-3.2# tail /var/log/messages 
Nov  8 09:22:17 localhost ddclient[30000]: SUCCESS:  updating <dyndns_host_name>.dyndns.org: good: IP address set to 128.84.8.104

Create a Domain Name for Virtual Server

Now you are ready to create the domain name for your virtual server that will be used by your users! Simply create the server's domain name as an alias for the CNAME <dyndns_host_name>.dyndns.org. For example:

-bash-3.2# host <cloud_server_name>.cac.cornell.edu
<cloud_server_name>.cac.cornell.edu is an alias for <dyndns_host_name>.dyndns.org.
<dyndns_host_name>.dyndns.org has address 128.84.8.104

How to accomplish this depends on the domain name you wish to create:

CAC Domain Names (.cac.cornell.edu)

E-mail help@cac.cornell.edu with your request. Please include:

  • The .cac.cornell.edu domain name you wish to register for your server.
  • Dynamic DNS host name for your server.

Cornell Department Domain Names (<department>.cornell.edu)

You need to have the network administrator for your department to e-mail hostmaster@cornell.edu with the request.

Non-Cornell Domain Names

You will need to work with the DNS provider for your domain.