Tutorial: Configure a NIC with multiple public IPs


A few months ago, we showed you how to associate a single public IP to your instance. For most use cases, this functionality does everything that you need. However, one request we find ourselves seeing occasionally is the desire to allocate more than one IP address from the same subnet to an instance, with the driver being that it provides the ability to have multiple public IPs pointing at a particular NIC/port. Currently, this requires some more advanced command line work.

Step 1 – Installing the Command Line (CLI) Client

The OpenStack command line clients are the key to opening all of the advanced functionality of Cloud A. We provide you with a nice, easy-to-use Dashboard to accomplish the majority of tasks that people need to do without making things cluttered, or adding additional complexity where it isn’t needed. However, sometimes the CLI tools are the way to go for these more advanced operations.

To download and install these tools, you will need to have Python >=2.6,<3.0 and Python pip.

In a terminal window (OSX & Linux) or a command prompt (Windows), run the following:

pip install python-neutronclient

This should begin the install process and will let you know when it is complete. For more detailed instructions, check out the docs page on Installing the CLI Tools.

Step 2 – Setting your Authentication Details

Mac OSX & Linux

The OpenStack RC file tells your Neutron CLI client how to connect to Cloud A using your account. You can download it directly from your Dashboard in the menu under Username > API Access and click “Download OpenStack RC File”. Make sure to save the file somewhere that you will easily remember (typically in your user’s home directory).


The default OpenStack RC file is only built for UNIX-based systems, so it will not work on Windows. This means that we have to set our environment variables manually.

This can be accomplished by going into your Control Panel, scrolling to the System and Security section, and clicking on System. From that window, you will see an Advanced tab, wherein you can set your environment variables. Below is a list of variables and what their corresponding values should be:

  • OS_USERNAME – The user that you use to login to Cloud A (typically your email address)
  • OS_PASSWORD – Your Cloud A password
  • OS_TENANT_NAME – Typically the same as OS_USERNAME
  • OS_AUTH_URL – Set to http://api.cell01.clouda.ca:5000/v2.0/


Once you have set those values, click on the Ok button to save them.

Step 3 – Getting our Port UUID

Now that we can authenticate, we’ll need to find the unique identifier (UUID) of the port that we wish to work on. This can be done either via the CLI or the Dashboard. First, we’ll need to know the internal IP address of our instance so that we can find its port. This can be seen on the Instances screen in your Cloud-A Dashboard.

Once we have our internal IP address (typically 10.x.x.x or 192.168.x.x), let’s go find our port under Networking > Networks. Unless you have changed the default network configuration, you will want to click on Default Network here. Otherwise, click on the name of the network that your instance is attached to.

This next page displays a list of ports on your network. Scroll until you see your internal IP address, and click on the port name to view its details. At the top of the screen, we can see our port’s ID.

Step 4 – Network Configuration in your Instance

To prepare for our IP address change, we must first prepare the network configuration on our instance. Typically, instances use DHCP to acquire IP addresses automatically, however when configuring multiple addresses per port, DHCP will not know which one to allocate. This means that interfaces must be setup statically. The below configuration is an example of an Ubuntu 12.04 instance (/etc/network/instances):

auto eth0
iface eth0 inet static

auto eth0:1
iface eth0:1 inet static

Note: Don’t restart networking yet. It will cause you to lose access to your instance. We are going to be rebooting it later on in this post.

Step 5 – Changing IP Addresses

This step will require the use of the Neutron CLI client that we installed earlier. Linux and OSX users will have to “source” their RC file prior to continuing:


Now we should be able to properly authenticate. Let’s test by listing our ports:

$ neutron port-list 

| id                                   | name | mac_address       | fixed_ips                                                                         |
| 1ccdb458-abae-4937-b0c8-e062157bd855 |      | fa:16:3e:64:10:95 | {"subnet_id": "62fa387d-b3cd-4d2f-9a9f-5133e4574965", "ip_address": ""}  |
| 83b8ae68-deaf-4bec-af99-a15d6b4b959d |      | fa:16:3e:d0:bc:4d | {"subnet_id": "62fa387d-b3cd-4d2f-9a9f-5133e4574965", "ip_address": ""}   |
| bdaa4444-da72-4712-8862-d71df4f9b295 |      | fa:16:3e:c2:16:59 | {"subnet_id": "62fa387d-b3cd-4d2f-9a9f-5133e4574965", "ip_address": ""} |
|                                      |      |                   | {"subnet_id": "62fa387d-b3cd-4d2f-9a9f-5133e4574965", "ip_address": ""} |
| c872fb6f-cb98-458d-9ab8-56824df6ecef |      | fa:16:3e:cf:a3:90 | {"subnet_id": "62fa387d-b3cd-4d2f-9a9f-5133e4574965", "ip_address": ""}  |
| d9daf3c0-5b95-4529-8cd9-89125c00ffb7 |      | fa:16:3e:5b:df:ad | {"subnet_id": "62fa387d-b3cd-4d2f-9a9f-5133e4574965", "ip_address": ""}   |

That should return a list of ports that belong to your instances, as can be seen above. If you received an error, ensure that you have sourced the proper file if you are a Linux/OSX user, or that you have entered all environment variables correctly in Windows.

Now we’re going to replace the existing IP addresses on our port with new ones. Hint: you can add as many as you would like by repeating the ip_address option. Be sure to replace <PORT_UUID> with the port ID that we found in our dashboard, and the two IP addresses below with ones that are unused on your network (ie they shouldn’t be in the output from neutron port-list).

$ neutron port-update <PORT_UUID> --fixed-ips type=dict list=true ip_address='' ip_address=''

Updated port: bdaa4444-da72-4712-8862-d71df4f9b295

Step 6 – Rebooting your Instance

Once complete, you will have to reboot your instance. This can be done in your dashboard by clicking on the “More” button beside your instance, and clicking “Soft Reboot”. After rebooting, you will need to disassociate your existing public IP address from your instance. This can be accomplished by clicking on Disassociate Public IP under the More menu.

At the time of writing, there is a small bug in the Ubuntu cloud-init package which can cause instances to take longer to start when using a static IP configuration. If you see messages in the instance log stating that it is waiting for networking, don’t worry.

Step 7 – Assign Public IP Addresses

Now we can proceed to associate public IP addresses to each private IP on our instance. The process is the same as usual, except that you will see multiple private IPs for your instance in the dropdown menu.

You should now be able to access your instance using both Public IP addresses! To test, we can SSH into our public IPs:

$ ssh ubuntu@<Public IP 1>

Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-40-virtual x86_64)

  System information as of Wed May 28 00:08:25 UTC 2014

  System load:  0.0               Processes:             59
  Usage of /:   2.7% of 29.52GB   Users logged in:       0
  Memory usage: 3%                IP address for eth0:
  Swap usage:   0%                IP address for eth0:1:

Last login: Tue May 27 22:47:50 2014 from jacob-laptop

$ ssh ubuntu@<Public IP 2>

Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-40-virtual x86_64)

  System information as of Wed May 28 00:09:03 UTC 2014

  System load:  0.0               Processes:             59
  Usage of /:   2.7% of 29.52GB   Users logged in:       0
  Memory usage: 3%                IP address for eth0:
  Swap usage:   0%                IP address for eth0:1:

Last login: Tue May 28 00:08:25 2014 from jacob-laptop


Let us know if you require any additional help. We’re always here to lend a hand at support@clouda.ca!

Ready to give it a try?

Get started with a $10 credit

Create my account!