Difference: InstallingAndConfiguringNova (12 vs. 13)

Revision 132012-09-25 - PaoloVeronesi

Line: 1 to 1
 
META TOPICPARENT name="GestioneOpenstack"

Installing and Configuring the Compute service (NOVA)

Line: 177 to 177
 
Added:
>
>

Configuring Public (Floating) IP Addresses

Private and Public IP Addresses

Every virtual instance is automatically assigned a private IP address. You may optionally assign public IP addresses to instances. OpenStack uses the term floating IP to refer to an IP address (typically public) that can be dynamically added to a running virtual instance. OpenStack Compute uses Network Address Translation (NAT) to assign floating IPs to virtual instances.

If you plan to use this feature, you must add the following to your nova.conf file to specify which interface the nova-network service will bind public IP addresses to:

public_interface=eth0
Restart the nova-network service if you change nova.conf while the service is running.

Enabling IP forwarding

By default, the IP forwarding is disabled on most of Linux distributions. The floating IP feature requires the IP forwarding enabled in order to work, you can check if the forwarding is enabled by running the following command:
# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0
In this example, the IP forwarding is disabled. You can enable it on the fly by running the following command:
$ sysctl -w net.ipv4.ip_forward=1
In order to make the changes permanent, edit the /etc/sysctl.conf and update the IP forwarding setting : /verbatim> net.ipv4.ip_forward = 1

Creating a List of Available Floating IP Addresses

Nova maintains a list of floating IP addresses that are available for assigning to instances. Use the nova-manage floating create command to add entries to this list, as root. For example:

nova-manage floating create 131.154.101.220 The following nova-manage commands apply to floating IPs.

  • nova-manage floating list: List the floating IP addresses in the pool.
  • nova-manage floating create [cidr]: Create specific floating IPs for either a single address or a subnet.
  • nova-manage floating delete [cidr]: Remove floating IP addresses using the same parameters as the create command.

Adding a Floating IP to an Instance

Adding a floating IP to an instance is a two step process:
  1. nova floating-ip-create: Allocate a floating IP address from the list of available addresses.
  2. nova add-floating-ip: Add an allocated floating IP address to a running instance.

Here's an example of how to add a floating IP to a running instance with an ID of 63c5b9ba-3308-43ce-af61-d7b5dbc08c15

#  nova floating-ip-create
+-----------------+-------------+----------+------+
|        Ip       | Instance Id | Fixed Ip | Pool |
+-----------------+-------------+----------+------+
| 131.154.101.220 | None        | None     | nova |
+-----------------+-------------+----------+------+

# nova add-floating-ip 63c5b9ba-3308-43ce-af61-d7b5dbc08c15 131.154.101.220

# nova-manage floating list
c10d9c9f296b47f8a1212dd7a98357e0        131.154.101.220 63c5b9ba-3308-43ce-af61-d7b5dbc08c15    nova    eth0

If the instance no longer needs a public address, remove the floating IP address from the instance and de-allocate the address:

# nova remove-floating-ip 63c5b9ba-3308-43ce-af61-d7b5dbc08c15 131.154.101.220
# nova floating-ip-delete 131.154.101.220

Automatically adding floating IPs

The nova-network service can be configured to automatically allocate and assign a floating IP address to virtual instances when they are launched. Add the following line to nova.conf and restart the nova-network service
auto_assign_floating_ip=True

Note that if this option is enabled and all of the floating IP addresses have already been allocated, the nova boot command will fail with an error.

 -- PaoloVeronesi - 2012-08-30
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback