QA:Testcase OpenStack floating IPs

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
Line 2: Line 2:
 
|description=Set up Floating IPs with OpenStack
 
|description=Set up Floating IPs with OpenStack
 
|setup=
 
|setup=
# Follow [[QA:Testcase_launch_an_instance_on_OpenStack]]
+
Follow [[QA:Testcase_launch_an_instance_on_OpenStack]]
  
 
Make sure that nova is configured with the correct public network interface. The default is eth0, but you can change it in <code>/etc/nova/nova.conf</code>.
 
Make sure that nova is configured with the correct public network interface. The default is eth0, but you can change it in <code>/etc/nova/nova.conf</code>.
 
 
  $> sudo bash -c 'echo "--public_interface=em1" >> /etc/nova/nova.conf'
 
  $> sudo bash -c 'echo "--public_interface=em1" >> /etc/nova/nova.conf'
 
  $> sudo service openstack-nova-network restart
 
  $> sudo service openstack-nova-network restart
 +
 +
Ensure that ICMP (ping) and SSH are allowed to your instances.
 +
$> euca-authorize -P icmp -t -1:-1 default
 +
$> euca-authorize -P tcp -p 22 default
  
 
|actions=
 
|actions=
  
Carve out a block of addresses to use for instances:
+
If you've followed all of the test cases, the private network used for OpenStack instances is 10.0.0.0/24.  The purpose of this functionality is to be able to assign a pool of floating public IP addresses to instances, as well.
  
  $> sudo nova-manage floating create 10.0.0.224/28
+
The details of this test case are a bit specific to the environment you are using to test.  For this documentation, we're going to assume that the the OpenStack server's public interface is on the 192.168.122.0/24 subnet.  We are going to take an unused address from this subnet, 192.168.122.150, and define it as a floating IP address to be used by OpenStack.
 +
 
 +
  $> sudo nova-manage floating create 192.168.122.150/31
  
 
Allocate an address to use for an instance:
 
Allocate an address to use for an instance:
  
  $> euca-allocate-address  
+
  $> euca-allocate-address 192.168.122.150
  ADDRESS 10.0.0.224
+
  ADDRESS 192.168.122.150
 +
 
 +
{{admon/note|Note|You do not have to specify a specific address with <code>euca-allocate-address</code>.  If you do not specify an address, it will choose one for you out of the pool of available floating IP addresses.}}
  
 
Associate the allocated address with a running instance:
 
Associate the allocated address with a running instance:
  
  $> euca-associate-address -i i-00000006 10.0.0.224
+
  $> euca-associate-address -i i-00000006 192.168.122.150
  ADDRESS 10.0.0.224 i-00000006
+
  ADDRESS 192.168.122.150 i-00000006
  
 
|results=
 
|results=
 +
 +
Verify that the public IP address got assigned to your public network interface on the OpenStack server.
 +
 +
$> ip addr
 +
...
 +
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
 +
    link/ether 52:54:00:db:c8:51 brd ff:ff:ff:ff:ff:ff
 +
    inet 192.168.122.58/24 brd 192.168.122.255 scope global eth0
 +
    inet 192.168.122.150/32 scope global eth0
  
 
Verify that you can now ssh into the instance using the newly assigned address:
 
Verify that you can now ssh into the instance using the newly assigned address:
  
 
  $> cd ~/novacreds
 
  $> cd ~/novacreds
  $> ssh -i nova_key.priv root@10.0.0.224
+
  $> ssh -i nova_key.priv root@192.168.122.150
  
 
If you would like, you can now disassociate and release the address assigned for testing.
 
If you would like, you can now disassociate and release the address assigned for testing.
  
  $> euca-disassociate-address 10.0.0.224
+
  $> euca-disassociate-address 192.168.122.150
  ADDRESS 10.0.0.224
+
  ADDRESS 192.168.122.150
  $> euca-release-address 10.0.0.224
+
  $> euca-release-address 192.168.122.150
  ADDRESS 10.0.0.224
+
  ADDRESS 192.168.122.150
  
 
}}
 
}}

Revision as of 19:51, 18 October 2011

Contents

Description

Set up Floating IPs with OpenStack

Setup

Follow QA:Testcase_launch_an_instance_on_OpenStack

Make sure that nova is configured with the correct public network interface. The default is eth0, but you can change it in /etc/nova/nova.conf.

$> sudo bash -c 'echo "--public_interface=em1" >> /etc/nova/nova.conf'
$> sudo service openstack-nova-network restart

Ensure that ICMP (ping) and SSH are allowed to your instances.

$> euca-authorize -P icmp -t -1:-1 default 
$> euca-authorize -P tcp -p 22 default 

How to test

If you've followed all of the test cases, the private network used for OpenStack instances is 10.0.0.0/24. The purpose of this functionality is to be able to assign a pool of floating public IP addresses to instances, as well.

The details of this test case are a bit specific to the environment you are using to test. For this documentation, we're going to assume that the the OpenStack server's public interface is on the 192.168.122.0/24 subnet. We are going to take an unused address from this subnet, 192.168.122.150, and define it as a floating IP address to be used by OpenStack.

$> sudo nova-manage floating create 192.168.122.150/31

Allocate an address to use for an instance:

$> euca-allocate-address 192.168.122.150
ADDRESS	192.168.122.150
Note.png
Note
You do not have to specify a specific address with euca-allocate-address. If you do not specify an address, it will choose one for you out of the pool of available floating IP addresses.

Associate the allocated address with a running instance:

$> euca-associate-address -i i-00000006 192.168.122.150
ADDRESS	192.168.122.150	i-00000006

Expected Results

Verify that the public IP address got assigned to your public network interface on the OpenStack server.

$> ip addr
...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
   link/ether 52:54:00:db:c8:51 brd ff:ff:ff:ff:ff:ff
   inet 192.168.122.58/24 brd 192.168.122.255 scope global eth0
   inet 192.168.122.150/32 scope global eth0

Verify that you can now ssh into the instance using the newly assigned address:

$> cd ~/novacreds
$> ssh -i nova_key.priv root@192.168.122.150

If you would like, you can now disassociate and release the address assigned for testing.

$> euca-disassociate-address 192.168.122.150
ADDRESS	192.168.122.150
$> euca-release-address 192.168.122.150
ADDRESS	192.168.122.150