| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 1 | ====================================== | 
 | 2 | Using DevStack with Neutron Networking | 
 | 3 | ====================================== | 
 | 4 |  | 
 | 5 | This guide will walk you through using OpenStack Neutron with the ML2 | 
 | 6 | plugin and the Open vSwitch mechanism driver. | 
 | 7 |  | 
 | 8 | Network Interface Configuration | 
 | 9 | =============================== | 
 | 10 |  | 
 | 11 | To use Neutron, it is suggested that two network interfaces be present | 
 | 12 | in the host operating system. | 
 | 13 |  | 
 | 14 | The first interface, eth0 is used for the OpenStack management (API, | 
 | 15 | message bus, etc) as well as for ssh for an administrator to access | 
 | 16 | the machine. | 
 | 17 |  | 
 | 18 | :: | 
 | 19 |  | 
 | 20 |         stack@compute:~$ ifconfig eth0 | 
 | 21 |         eth0      Link encap:Ethernet  HWaddr bc:16:65:20:af:fc | 
 | 22 |                   inet addr:192.168.1.18 | 
 | 23 |  | 
 | 24 | eth1 is manually configured at boot to not have an IP address. | 
 | 25 | Consult your operating system documentation for the appropriate | 
| Juan Antonio Osorio Robles | b7c1ce4 | 2014-11-28 14:19:19 +0200 | [diff] [blame] | 26 | technique. For Ubuntu, the contents of `/etc/network/interfaces` | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 27 | contains: | 
 | 28 |  | 
 | 29 | :: | 
 | 30 |  | 
 | 31 |         auto eth1 | 
 | 32 |         iface eth1 inet manual | 
 | 33 |                 up ifconfig $IFACE 0.0.0.0 up | 
 | 34 |                 down ifconfig $IFACE 0.0.0.0 down | 
 | 35 |  | 
 | 36 | The second physical interface, eth1 is added to a bridge (in this case | 
 | 37 | named br-ex), which is used to forward network traffic from guest VMs. | 
 | 38 | Network traffic from eth1 on the compute nodes is then NAT'd by the | 
 | 39 | controller node that runs Neutron's `neutron-l3-agent` and provides L3 | 
 | 40 | connectivity. | 
 | 41 |  | 
 | 42 | :: | 
 | 43 |  | 
 | 44 |         stack@compute:~$ sudo ovs-vsctl add-br br-ex | 
 | 45 |         stack@compute:~$ sudo ovs-vsctl add-port br-ex eth1 | 
 | 46 |         stack@compute:~$ sudo ovs-vsctl show | 
 | 47 |         9a25c837-32ab-45f6-b9f2-1dd888abcf0f | 
 | 48 |             Bridge br-ex | 
 | 49 |                 Port br-ex | 
 | 50 |                     Interface br-ex | 
 | 51 |                         type: internal | 
 | 52 |                 Port phy-br-ex | 
 | 53 |                     Interface phy-br-ex | 
 | 54 |                         type: patch | 
 | 55 |                         options: {peer=int-br-ex} | 
 | 56 |                 Port "eth1" | 
 | 57 |                     Interface "eth1" | 
 | 58 |  | 
 | 59 |  | 
 | 60 |  | 
 | 61 |  | 
 | 62 | Neutron Networking with Open vSwitch | 
 | 63 | ==================================== | 
 | 64 |  | 
 | 65 | Configuring Neutron networking in DevStack is very similar to | 
 | 66 | configuring `nova-network` - many of the same configuration variables | 
 | 67 | (like `FIXED_RANGE` and `FLOATING_RANGE`) used by `nova-network` are | 
 | 68 | used by Neutron, which is intentional. | 
 | 69 |  | 
 | 70 | The only difference is the disabling of `nova-network` in your | 
 | 71 | local.conf, and the enabling of the Neutron components. | 
 | 72 |  | 
 | 73 |  | 
 | 74 | Configuration | 
 | 75 | ------------- | 
 | 76 |  | 
 | 77 | :: | 
 | 78 |  | 
 | 79 |         FIXED_RANGE=10.0.0.0/24 | 
 | 80 |         FLOATING_RANGE=192.168.27.0/24 | 
 | 81 |         PUBLIC_NETWORK_GATEWAY=192.168.27.2 | 
 | 82 |  | 
 | 83 |         disable_service n-net | 
 | 84 |         enable_service q-svc | 
 | 85 |         enable_service q-agt | 
 | 86 |         enable_service q-dhcp | 
 | 87 |         enable_service q-meta | 
 | 88 |         enable_service q-l3 | 
 | 89 |  | 
 | 90 |         Q_USE_SECGROUP=True | 
 | 91 |         ENABLE_TENANT_VLANS=True | 
 | 92 |         TENANT_VLAN_RANGE=1000:1999 | 
 | 93 |         PHYSICAL_NETWORK=default | 
 | 94 |         OVS_PHYSICAL_BRIDGE=br-ex | 
 | 95 |  | 
 | 96 | In this configuration we are defining FLOATING_RANGE to be a | 
 | 97 | subnet that exists in the private RFC1918 address space - however in | 
 | 98 | in a real setup FLOATING_RANGE would be a public IP address range. | 
 | 99 |  | 
 | 100 | Neutron Networking with Open vSwitch and Provider Networks | 
 | 101 | ========================================================== | 
 | 102 |  | 
 | 103 | In some instances, it is desirable to use Neutron's provider | 
 | 104 | networking extension, so that networks that are configured on an | 
 | 105 | external router can be utilized by Neutron, and instances created via | 
 | 106 | Nova can attach to the network managed by the external router. | 
 | 107 |  | 
 | 108 | For example, in some lab environments, a hardware router has been | 
 | 109 | pre-configured by another party, and an OpenStack developer has been | 
 | 110 | given a VLAN tag and IP address range, so that instances created via | 
 | 111 | DevStack will use the external router for L3 connectivity, as opposed | 
 | 112 | to the Neutron L3 service. | 
 | 113 |  | 
 | 114 |  | 
 | 115 | Service Configuration | 
 | 116 | --------------------- | 
 | 117 |  | 
 | 118 | **Control Node** | 
 | 119 |  | 
 | 120 | In this example, the control node will run the majority of the | 
 | 121 | OpenStack API and management services (Keystone, Glance, | 
 | 122 | Nova, Neutron, etc..) | 
 | 123 |  | 
 | 124 |  | 
 | 125 | **Compute Nodes** | 
 | 126 |  | 
 | 127 | In this example, the nodes that will host guest instances will run | 
 | 128 | the `neutron-openvswitch-agent` for network connectivity, as well as | 
 | 129 | the compute service `nova-compute`. | 
 | 130 |  | 
 | 131 | DevStack Configuration | 
 | 132 | ---------------------- | 
 | 133 |  | 
 | 134 | The following is a snippet of the DevStack configuration on the | 
 | 135 | controller node. | 
 | 136 |  | 
 | 137 | :: | 
 | 138 |  | 
 | 139 |         PUBLIC_INTERFACE=eth1 | 
 | 140 |  | 
 | 141 |         ## Neutron options | 
 | 142 |         Q_USE_SECGROUP=True | 
 | 143 |         ENABLE_TENANT_VLANS=True | 
 | 144 |         TENANT_VLAN_RANGE=3001:4000 | 
 | 145 |         PHYSICAL_NETWORK=default | 
 | 146 |         OVS_PHYSICAL_BRIDGE=br-ex | 
 | 147 |  | 
 | 148 |         Q_USE_PROVIDER_NETWORKING=True | 
 | 149 |         Q_L3_ENABLED=False | 
 | 150 |  | 
 | 151 |         # Do not use Nova-Network | 
 | 152 |         disable_service n-net | 
 | 153 |  | 
 | 154 |         # Neutron | 
 | 155 |         ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt | 
 | 156 |  | 
 | 157 |         ## Neutron Networking options used to create Neutron Subnets | 
 | 158 |  | 
 | 159 |         FIXED_RANGE="10.1.1.0/24" | 
 | 160 |         PROVIDER_SUBNET_NAME="provider_net" | 
 | 161 |         PROVIDER_NETWORK_TYPE="vlan" | 
 | 162 |         SEGMENTATION_ID=2010 | 
 | 163 |  | 
 | 164 | In this configuration we are defining FIXED_RANGE to be a | 
 | 165 | subnet that exists in the private RFC1918 address space - however in | 
 | 166 | in a real setup FIXED_RANGE would be a public IP address range, so | 
 | 167 | that you could access your instances from the public internet. | 
 | 168 |  | 
 | 169 | The following is a snippet of the DevStack configuration on the | 
 | 170 | compute node. | 
 | 171 |  | 
 | 172 | :: | 
 | 173 |  | 
 | 174 |         # Services that a compute node runs | 
 | 175 |         ENABLED_SERVICES=n-cpu,rabbit,q-agt | 
 | 176 |  | 
 | 177 |         ## Neutron options | 
 | 178 |         Q_USE_SECGROUP=True | 
 | 179 |         ENABLE_TENANT_VLANS=True | 
 | 180 |         TENANT_VLAN_RANGE=3001:4000 | 
 | 181 |         PHYSICAL_NETWORK=default | 
 | 182 |         OVS_PHYSICAL_BRIDGE=br-ex | 
 | 183 |         PUBLIC_INTERFACE=eth1 | 
 | 184 |         Q_USE_PROVIDER_NETWORKING=True | 
 | 185 |         Q_L3_ENABLED=False | 
 | 186 |  | 
 | 187 | When DevStack is configured to use provider networking (via | 
 | 188 | `Q_USE_PROVIDER_NETWORKING` is True and `Q_L3_ENABLED` is False) - | 
 | 189 | DevStack will automatically add the network interface defined in | 
 | 190 | `PUBLIC_INTERFACE` to the `OVS_PHYSICAL_BRIDGE` | 
 | 191 |  | 
 | 192 | For example, with the above  configuration, a bridge is | 
 | 193 | created, named `br-ex` which is managed by Open vSwitch, and the | 
 | 194 | second interface on the compute node, `eth1` is attached to the | 
 | 195 | bridge, to forward traffic sent by guest vms. |