Add Cloud Networks to existing Cloud Server
Cloud Networks is a really cool up and coming feature in the Rackspace Cloud. It enables you to create private networks only accessible by your Cloud infrastructure. When first released, you could only attach a Cloud Server to Cloud Networks when creating a new Cloud Server or by taking an image and then creating a new Cloud Server based off of that image and attaching Cloud Networks at that time. Not the best situation if you already have a stable Cloud infrastructure. Luckily we can now attach Cloud Networks to an already running Cloud Server. Make sure the server is a NextGen Cloud Server based on OpenStack. This tutorial was run on Debian 6 Squeeze, but should be pretty much the same on other Linux distros. If you have any issues with a particular distro please let me know.
First we need to install a few packages. The easiest way is to use pip.
apt-get install python-pip pip install os_virtual_interfacesv2_python_novaclient_ext pip install rackspace-novaclient
Now we will create a file for our Rackspace credentials and enter your information in the < > parts of the file.
vim ~/.bash_profile export OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/ export OS_AUTH_SYSTEM=rackspace export OS_REGION_NAME=DFW export OS_USERNAME=<username> export OS_TENANT_NAME=<account_number> export NOVA_RAX_AUTH=1 export OS_PASSWORD=<api_key> export OS_PROJECT_ID=<account_number> export OS_NO_CACHE=1
chmod 600 ~/.bash_profile source ~/.bash_profile
We should be able to run some nova commands and receive the information we need to attach Cloud Networks.
nova credentials #note the token ID nova network-list #note the network ID for your Cloud Network nova virtual-interface-list e74780b5-d110-4faa-bfc4-87802b90aaf1 #this is the instance ID of the Cloud Server you want to attach Cloud Networks to, you should see a public and private interface.
Now we use nova to attach the Cloud Network to your existing Cloud Server.
usage: nova virtual-interface-create <network_id> <instance_id> nova virtual-interface-create 30712e92-40d3-4259-bd73-2ed8b09abcf5 e74780b5-d110-4faa-bfc4-87802b90aaf1
You should receive a response with the IP etc information for the new virtual interface.
When you run virtual-interface-command with your instance ID you should see the new interface. You should also see it in the control panel and with a command such as ip a on the actual server.
nova virtual-interface-list e74780b5-d110-4faa-bfc4-87802b90aaf1
You should now have your Cloud Network attached to your already running Cloud Server. There are a number of ways to do this, but I ran this on the actual Cloud Server. You could really run this wherever you can run rackspace-novaclient and install the Cloud Network plugin,
os__virtual_interfacesv2_python_novaclient_ext. If you have any questions or need any help with this, please leave a comment or shoot me an email and I will get back to you.
Here are some links that might further help with this task.