In this multi-part walkthrough series, I intend to dive into the various components of the OpenStack Neutron project, and to also provide working examples of multiple networking configurations for clouds built with Rackspace Private Cloud powered by OpenStack on Ubuntu 12.04 LTS. When possible, I’ll provide configuration file examples for those following along on an install from source.
In the previous installment, Neutron Networking: The Building Blocks of an OpenStack Cloud, I laid the foundation of the Neutron networking model that included terminology, concepts, and a brief description of services and capabilities. In this second installment, I’ll describe how to build a simple flat network consisting of a few servers and limited networking gear. Future installments will include VLAN-based provider and tenant networks, GRE-based tenant networks, Open vSwitch troubleshooting, and more.
New to OpenStack? Rackspace offers a complete open-source package, Rackspace Private Cloud Software, that you’re welcome to use at no cost. Download and follow along.
Getting Started / What is a flat network?
For those coming from previous Essex- or Folsom-based Rackspace Private Cloud installations, flat networking in Neutron resembles the Flat DHCP model in Nova networking. For those new to the game, a flat network is one in which all instances reside on the same network (which may also be shared by the hosts). No vlan tagging takes place, and Neutron handles the assignment of IPs to instances using DHCP. Therefore, it’s possible to use unmanaged SOHO network switches to build a simple Neutron-based cloud, since there’s no need to configure switchports.
The diagram above represents a simple Neutron networking configuration that utilizes a flat provider network for connectivity of instances to the Internet.
Networking / Layout
In the following diagram, a Cisco ASA 5510 is serving as the lead gateway device, with a Cisco 2960G access switch connecting the firewall and servers together via VLAN 1. 10.240.0.0/24 was chosen as the management network for hosts, but will also serve as a provider network for instances. We’ll be using a single interface on the servers for both management and provider network connectivity.
Networking / Configuration of Physical Devices
The Cisco ASA was chosen for this example as it’s readily available at my location. Any router or firewall should be sufficient as long as you’re able to disable DHCP on the inside interface (you don’t want it to conflict with Neutron, after all).
Interface e0/0 should be configured with your WAN IP. Interface e0/1 must be configured with an IP address that will serve as the gateway for hosts and instances:
1 2 3 4 5 6
Depending on the model of switch, your switchports may be unmanaged or in vlan 1 by default. With the flat networking model, your gateway and hosts must simply sit in the same vlan or broadcast domain; the vlan ID itself is irrelevant. There’s a good chance your servers have their IP configured directly on eth0. To utilize Neutron, the hosts must have a network bridge configured. This can be accomplished one of two ways:
- Configure a bridge containing eth0
- Configure a bridge containing another interface
The first option enables you to use a single interface on the nodes. However, there are plenty of cases where you may prefer to use other interfaces or configure multiple bridges. For this example, I’ll use a single interface and move the IP address from eth0 to the bridge.
Below is what a default eth0 configuration might look like:
1 2 3 4 5 6
In order to configure the bridge, eth0 must be modified and the bridge interface created:
1 2 3 4 5 6 7 8 9 10
TIP: Do not set br-eth0 to auto. Because of the order that processes are started at boot, the interface must be brought up using rc.local. Instead, edit the /etc/rc.local file of each machine and add the following line before the ‘exit’ statement:
Networking / Open vSwitch Configuration
Briefly mentioned in the previous installment, Neutron Networking: The Building Blocks of an OpenStack Cloud, was Open vSwitch – the virtual switching infrastructure utilized by Neutron. Creating the bridge in Open vSwitch is a requirement for proper management of traffic.
The following will create a bridge called ‘br-eth0’ and place physical interface eth0 inside:
The creation and configuration of the bridge enables the instances to communicate on the network.
Changes to Environment (RPC v4)
When using RPC v4, most configuration changes are handled via Chef. A few changes must be made to the environment file to utilize the bridge for Neutron networking.
Look for the section ‘quantum : ovs : provider_networks’
1 2 3
The bridge configuration should be modified to mirror the following example, if it doesn’t already exist:
1 2 3 4 5
Note: The vlan range above is not used in this example
The label ‘ph-eth0’ represents our provider interface, in this case the bridge ‘br-eth0’. It will be used during the creation of networks in Neutron.
The resulting file would look something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
Save the changes to the file and run chef-client on all the hosts to populate the changes.
Changes to Environment (Other)
When using something other than RPC v4 (such as the OpenStack source), configuration changes must be made to the appropriate configuration files and services restarted manually.
Within /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini, update the following values:
1 2 3 4 5 6 7 8
The label ‘ph-eth0’ represents our provider interface, in this case the bridge ‘br-eth0’. It will be used during the creation of networks in Neutron. It’s possible to have more than one provider bridge, especially when you have multiple switching infrastructures for various networks and services. Restart all Neutron and Open vSwitch services on all hosts for the changes to take effect.
Networking / OVS Confirmation
Remember the bridge (br-eth0) we created in OVS earlier? At a high level, it can be looked at as our bridge to the physical network infrastructure. Neutron requires an ‘Integration Bridge’ that serves as the bridge to our virtual instances. The integration bridge connects vNICs and Neutron DHCP and L3 agents with virtual networks. Overriding the default value of ‘br-int’ is not recommended, as the bridge must be named the same on each host (controller/compute). RPC v4 creates this bridge during the chef-client run.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
For those installing from source, the name of the bridge is defined in /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini:
The bridge will need to be created manually in OVS if you are not using Chef:
Networking / Building a flat provider network in Neutron
Now that the infrastructure is in place and the bridges are configured, it’s time to build a flat provider network in Neutron. Creating a flat provider network requires only two values: the name of the network and the provider bridge label. There are additional flags that can be specified, but these aren’t required for basic connectivity.
quantum net-create --provider:physical_network=<provider label> --provider:network_type=flat <network name>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
With the network created, it’s time to create the subnet. When allocating a range of addresses for the DHCP pool, be sure not to overlap with other machines on the network (including the controller/compute nodes).
1 2 3
It’s a good idea to provide values for the following options:
--no-gatewayInstructs Quantum not to provide a gateway IP.
--host-routeProvides route injection via DHCP.
--allocation-poolDefines the DHCP IP pool boundaries
--dns-nameserversDefines DNS servers
When a gateway is defined, Neutron assumes all metadata routes are handled by the specified gateway and will not inject the metadata route via DHCP to instances. By specifying the
--no_gateway flag and defining a default route manually, we’re able to provide instances with a default route as well as an automatic metadata route to the namespace IP.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Networking / Testing Connectivity
Now that the network has been built in Neutron, it’s time to test connectivity by spinning up an instance. Like the hosts, my instance is Ubuntu 12.04 LTS.
nova boot --image <image_uuid> --flavor <flavor_name> --key_name <keypair_name> --nic net-id=<network_id> <instance_name>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
Check the Nova console log to verify the instance received its IP, routes and metadata:
1 2 3 4 5 6 7 8 9 10 11 12 13
Once the instance is available, login using the keypair specified in the boot command:
Confirm the necessary routes are in place:
1 2 3 4 5 6
Pinging an external IP should reveal positive results as long as a static NAT or PAT exists on the external gateway device and the traffic is permitted:
1 2 3 4 5
With a limited amount of networking hardware one can create a functional private cloud based on Rackspace Private Cloud powered by OpenStack. While the flat network model provides basic connectivity, it is best used in cases where scalability is not a concern, or where switches may be unmanageable.
Have questions or comments? Feel free to contact or follow me on Twitter @jimmdenton