| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 1 | ====================================== | 
| Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 2 | Using DevStack with neutron Networking | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 3 | ====================================== | 
|  | 4 |  | 
| Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 5 | This guide will walk you through using OpenStack neutron with the ML2 | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 6 | plugin and the Open vSwitch mechanism driver. | 
|  | 7 |  | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 8 |  | 
| Sean M. Collins | 02ae50d | 2015-03-20 09:58:55 -0700 | [diff] [blame] | 9 | Using Neutron with a Single Interface | 
|  | 10 | ===================================== | 
|  | 11 |  | 
|  | 12 | In some instances, like on a developer laptop, there is only one | 
|  | 13 | network interface that is available. In this scenario, the physical | 
|  | 14 | interface is added to the Open vSwitch bridge, and the IP address of | 
|  | 15 | the laptop is migrated onto the bridge interface. That way, the | 
|  | 16 | physical interface can be used to transmit tenant network traffic, | 
|  | 17 | the OpenStack API traffic, and management traffic. | 
|  | 18 |  | 
|  | 19 |  | 
|  | 20 | Physical Network Setup | 
|  | 21 | ---------------------- | 
|  | 22 |  | 
|  | 23 | In most cases where DevStack is being deployed with a single | 
|  | 24 | interface, there is a hardware router that is being used for external | 
|  | 25 | connectivity and DHCP. The developer machine is connected to this | 
|  | 26 | network and is on a shared subnet with other machines. | 
|  | 27 |  | 
|  | 28 | .. nwdiag:: | 
|  | 29 |  | 
|  | 30 | nwdiag { | 
|  | 31 | inet [ shape = cloud ]; | 
|  | 32 | router; | 
|  | 33 | inet -- router; | 
|  | 34 |  | 
|  | 35 | network hardware_network { | 
|  | 36 | address = "172.18.161.0/24" | 
|  | 37 | router [ address = "172.18.161.1" ]; | 
|  | 38 | devstack_laptop [ address = "172.18.161.6" ]; | 
|  | 39 | } | 
|  | 40 | } | 
|  | 41 |  | 
|  | 42 |  | 
|  | 43 | DevStack Configuration | 
|  | 44 | ---------------------- | 
|  | 45 |  | 
|  | 46 |  | 
|  | 47 | :: | 
|  | 48 |  | 
|  | 49 | HOST_IP=172.18.161.6 | 
|  | 50 | SERVICE_HOST=172.18.161.6 | 
|  | 51 | MYSQL_HOST=172.18.161.6 | 
|  | 52 | RABBIT_HOST=172.18.161.6 | 
|  | 53 | GLANCE_HOSTPORT=172.18.161.6:9292 | 
|  | 54 | ADMIN_PASSWORD=secrete | 
| Swapnil (coolsvap) Kulkarni | c988bf6 | 2015-10-08 13:10:43 +0530 | [diff] [blame] | 55 | DATABASE_PASSWORD=secrete | 
| Sean M. Collins | 02ae50d | 2015-03-20 09:58:55 -0700 | [diff] [blame] | 56 | RABBIT_PASSWORD=secrete | 
|  | 57 | SERVICE_PASSWORD=secrete | 
|  | 58 | SERVICE_TOKEN=secrete | 
|  | 59 |  | 
|  | 60 | ## Neutron options | 
|  | 61 | Q_USE_SECGROUP=True | 
| Christian Berendt | 1c39482 | 2015-09-10 12:15:16 +0200 | [diff] [blame] | 62 | FLOATING_RANGE="172.18.161.0/24" | 
| Sean M. Collins | 02ae50d | 2015-03-20 09:58:55 -0700 | [diff] [blame] | 63 | FIXED_RANGE="10.0.0.0/24" | 
|  | 64 | Q_FLOATING_ALLOCATION_POOL=start=172.18.161.250,end=172.18.161.254 | 
|  | 65 | PUBLIC_NETWORK_GATEWAY="172.18.161.1" | 
|  | 66 | Q_L3_ENABLED=True | 
|  | 67 | PUBLIC_INTERFACE=eth0 | 
|  | 68 | Q_USE_PROVIDERNET_FOR_PUBLIC=True | 
|  | 69 | OVS_PHYSICAL_BRIDGE=br-ex | 
|  | 70 | PUBLIC_BRIDGE=br-ex | 
|  | 71 | OVS_BRIDGE_MAPPINGS=public:br-ex | 
|  | 72 |  | 
|  | 73 |  | 
|  | 74 |  | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 75 | Neutron Networking with Open vSwitch and Provider Networks | 
|  | 76 | ========================================================== | 
|  | 77 |  | 
| Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 78 | In some instances, it is desirable to use neutron's provider | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 79 | networking extension, so that networks that are configured on an | 
| Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 80 | external router can be utilized by neutron, and instances created via | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 81 | Nova can attach to the network managed by the external router. | 
|  | 82 |  | 
|  | 83 | For example, in some lab environments, a hardware router has been | 
|  | 84 | pre-configured by another party, and an OpenStack developer has been | 
|  | 85 | given a VLAN tag and IP address range, so that instances created via | 
|  | 86 | DevStack will use the external router for L3 connectivity, as opposed | 
| Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 87 | to the neutron L3 service. | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 88 |  | 
| Sean M. Collins | 4696db9 | 2015-10-09 12:31:57 -0400 | [diff] [blame] | 89 | Physical Network Setup | 
|  | 90 | ---------------------- | 
|  | 91 |  | 
|  | 92 | .. nwdiag:: | 
|  | 93 |  | 
|  | 94 | nwdiag { | 
|  | 95 | inet [ shape = cloud ]; | 
|  | 96 | router; | 
|  | 97 | inet -- router; | 
|  | 98 |  | 
|  | 99 | network provider_net { | 
|  | 100 | address = "203.0.113.0/24" | 
|  | 101 | router [ address = "203.0.113.1" ]; | 
|  | 102 | controller; | 
|  | 103 | compute1; | 
|  | 104 | compute2; | 
|  | 105 | } | 
|  | 106 |  | 
|  | 107 | network control_plane { | 
|  | 108 | router [ address = "10.0.0.1" ] | 
|  | 109 | address = "10.0.0.0/24" | 
|  | 110 | controller [ address = "10.0.0.2" ] | 
|  | 111 | compute1 [ address = "10.0.0.3" ] | 
|  | 112 | compute2 [ address = "10.0.0.4" ] | 
|  | 113 | } | 
|  | 114 | } | 
|  | 115 |  | 
|  | 116 |  | 
| Sean M. Collins | 887f182 | 2015-10-12 10:36:34 -0400 | [diff] [blame] | 117 | On a compute node, the first interface, eth0 is used for the OpenStack | 
|  | 118 | management (API, message bus, etc) as well as for ssh for an | 
|  | 119 | administrator to access the machine. | 
|  | 120 |  | 
|  | 121 | :: | 
|  | 122 |  | 
|  | 123 | stack@compute:~$ ifconfig eth0 | 
|  | 124 | eth0      Link encap:Ethernet  HWaddr bc:16:65:20:af:fc | 
|  | 125 | inet addr:10.0.0.3 | 
|  | 126 |  | 
|  | 127 | eth1 is manually configured at boot to not have an IP address. | 
|  | 128 | Consult your operating system documentation for the appropriate | 
|  | 129 | technique. For Ubuntu, the contents of `/etc/network/interfaces` | 
|  | 130 | contains: | 
|  | 131 |  | 
|  | 132 | :: | 
|  | 133 |  | 
|  | 134 | auto eth1 | 
|  | 135 | iface eth1 inet manual | 
|  | 136 | up ifconfig $IFACE 0.0.0.0 up | 
|  | 137 | down ifconfig $IFACE 0.0.0.0 down | 
|  | 138 |  | 
|  | 139 | The second physical interface, eth1 is added to a bridge (in this case | 
|  | 140 | named br-ex), which is used to forward network traffic from guest VMs. | 
|  | 141 |  | 
|  | 142 | :: | 
|  | 143 |  | 
|  | 144 | stack@compute:~$ sudo ovs-vsctl add-br br-ex | 
|  | 145 | stack@compute:~$ sudo ovs-vsctl add-port br-ex eth1 | 
|  | 146 | stack@compute:~$ sudo ovs-vsctl show | 
|  | 147 | 9a25c837-32ab-45f6-b9f2-1dd888abcf0f | 
|  | 148 | Bridge br-ex | 
|  | 149 | Port br-ex | 
|  | 150 | Interface br-ex | 
|  | 151 | type: internal | 
|  | 152 | Port phy-br-ex | 
|  | 153 | Interface phy-br-ex | 
|  | 154 | type: patch | 
|  | 155 | options: {peer=int-br-ex} | 
|  | 156 | Port "eth1" | 
|  | 157 | Interface "eth1" | 
|  | 158 |  | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 159 |  | 
|  | 160 | Service Configuration | 
|  | 161 | --------------------- | 
|  | 162 |  | 
|  | 163 | **Control Node** | 
|  | 164 |  | 
|  | 165 | In this example, the control node will run the majority of the | 
| Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 166 | OpenStack API and management services (keystone, glance, | 
|  | 167 | nova, neutron) | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 168 |  | 
|  | 169 |  | 
|  | 170 | **Compute Nodes** | 
|  | 171 |  | 
|  | 172 | In this example, the nodes that will host guest instances will run | 
|  | 173 | the `neutron-openvswitch-agent` for network connectivity, as well as | 
|  | 174 | the compute service `nova-compute`. | 
|  | 175 |  | 
|  | 176 | DevStack Configuration | 
|  | 177 | ---------------------- | 
|  | 178 |  | 
|  | 179 | The following is a snippet of the DevStack configuration on the | 
|  | 180 | controller node. | 
|  | 181 |  | 
|  | 182 | :: | 
|  | 183 |  | 
| Sean M. Collins | 611cab4 | 2015-10-09 12:54:32 -0400 | [diff] [blame] | 184 | HOST_IP=10.0.0.2 | 
|  | 185 | SERVICE_HOST=10.0.0.2 | 
|  | 186 | MYSQL_HOST=10.0.0.2 | 
|  | 187 | SERVICE_HOST=10.0.0.2 | 
|  | 188 | MYSQL_HOST=10.0.0.2 | 
|  | 189 | RABBIT_HOST=10.0.0.2 | 
|  | 190 | GLANCE_HOSTPORT=10.0.0.2:9292 | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 191 | PUBLIC_INTERFACE=eth1 | 
|  | 192 |  | 
| Sean M. Collins | 611cab4 | 2015-10-09 12:54:32 -0400 | [diff] [blame] | 193 | ADMIN_PASSWORD=secrete | 
|  | 194 | MYSQL_PASSWORD=secrete | 
|  | 195 | RABBIT_PASSWORD=secrete | 
|  | 196 | SERVICE_PASSWORD=secrete | 
|  | 197 | SERVICE_TOKEN=secrete | 
|  | 198 |  | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 199 | ## Neutron options | 
|  | 200 | Q_USE_SECGROUP=True | 
|  | 201 | ENABLE_TENANT_VLANS=True | 
|  | 202 | TENANT_VLAN_RANGE=3001:4000 | 
|  | 203 | PHYSICAL_NETWORK=default | 
|  | 204 | OVS_PHYSICAL_BRIDGE=br-ex | 
|  | 205 |  | 
|  | 206 | Q_USE_PROVIDER_NETWORKING=True | 
|  | 207 | Q_L3_ENABLED=False | 
|  | 208 |  | 
|  | 209 | # Do not use Nova-Network | 
|  | 210 | disable_service n-net | 
|  | 211 |  | 
|  | 212 | # Neutron | 
|  | 213 | ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt | 
|  | 214 |  | 
|  | 215 | ## Neutron Networking options used to create Neutron Subnets | 
|  | 216 |  | 
| Sean M. Collins | d72b839 | 2015-06-18 12:40:09 -0400 | [diff] [blame] | 217 | FIXED_RANGE="203.0.113.0/24" | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 218 | PROVIDER_SUBNET_NAME="provider_net" | 
|  | 219 | PROVIDER_NETWORK_TYPE="vlan" | 
|  | 220 | SEGMENTATION_ID=2010 | 
|  | 221 |  | 
|  | 222 | In this configuration we are defining FIXED_RANGE to be a | 
| Sean M. Collins | d72b839 | 2015-06-18 12:40:09 -0400 | [diff] [blame] | 223 | publicly routed IPv4 subnet. In this specific instance we are using | 
|  | 224 | the special TEST-NET-3 subnet defined in `RFC 5737 <http://tools.ietf.org/html/rfc5737>`_, | 
|  | 225 | which is used for documentation.  In your DevStack setup, FIXED_RANGE | 
|  | 226 | would be a public IP address range that you or your organization has | 
|  | 227 | allocated to you, so that you could access your instances from the | 
|  | 228 | public internet. | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 229 |  | 
| Sean M. Collins | 611cab4 | 2015-10-09 12:54:32 -0400 | [diff] [blame] | 230 | The following is the DevStack configuration on | 
|  | 231 | compute node 1. | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 232 |  | 
|  | 233 | :: | 
|  | 234 |  | 
| Sean M. Collins | 611cab4 | 2015-10-09 12:54:32 -0400 | [diff] [blame] | 235 | HOST_IP=10.0.0.3 | 
|  | 236 | SERVICE_HOST=10.0.0.2 | 
|  | 237 | MYSQL_HOST=10.0.0.2 | 
|  | 238 | SERVICE_HOST=10.0.0.2 | 
|  | 239 | MYSQL_HOST=10.0.0.2 | 
|  | 240 | RABBIT_HOST=10.0.0.2 | 
|  | 241 | GLANCE_HOSTPORT=10.0.0.2:9292 | 
|  | 242 | ADMIN_PASSWORD=secrete | 
|  | 243 | MYSQL_PASSWORD=secrete | 
|  | 244 | RABBIT_PASSWORD=secrete | 
|  | 245 | SERVICE_PASSWORD=secrete | 
|  | 246 | SERVICE_TOKEN=secrete | 
|  | 247 |  | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 248 | # Services that a compute node runs | 
|  | 249 | ENABLED_SERVICES=n-cpu,rabbit,q-agt | 
|  | 250 |  | 
|  | 251 | ## Neutron options | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 252 | PHYSICAL_NETWORK=default | 
|  | 253 | OVS_PHYSICAL_BRIDGE=br-ex | 
|  | 254 | PUBLIC_INTERFACE=eth1 | 
|  | 255 | Q_USE_PROVIDER_NETWORKING=True | 
|  | 256 | Q_L3_ENABLED=False | 
|  | 257 |  | 
| Sean M. Collins | 611cab4 | 2015-10-09 12:54:32 -0400 | [diff] [blame] | 258 | Compute node 2's configuration will be exactly the same, except | 
|  | 259 | `HOST_IP` will be `10.0.0.4` | 
|  | 260 |  | 
| Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 261 | When DevStack is configured to use provider networking (via | 
|  | 262 | `Q_USE_PROVIDER_NETWORKING` is True and `Q_L3_ENABLED` is False) - | 
|  | 263 | DevStack will automatically add the network interface defined in | 
|  | 264 | `PUBLIC_INTERFACE` to the `OVS_PHYSICAL_BRIDGE` | 
|  | 265 |  | 
|  | 266 | For example, with the above  configuration, a bridge is | 
|  | 267 | created, named `br-ex` which is managed by Open vSwitch, and the | 
|  | 268 | second interface on the compute node, `eth1` is attached to the | 
| Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 269 | bridge, to forward traffic sent by guest VMs. | 
| Sean M. Collins | 872a262 | 2015-10-06 12:45:06 -0400 | [diff] [blame] | 270 |  | 
|  | 271 | Miscellaneous Tips | 
|  | 272 | ================== | 
|  | 273 |  | 
|  | 274 |  | 
|  | 275 | Disabling Next Generation Firewall Tools | 
|  | 276 | ---------------------------------------- | 
|  | 277 |  | 
|  | 278 | DevStack does not properly operate with modern firewall tools.  Specifically | 
|  | 279 | it will appear as if the guest VM can access the external network via ICMP, | 
|  | 280 | but UDP and TCP packets will not be delivered to the guest VM.  The root cause | 
|  | 281 | of the issue is that both ufw (Uncomplicated Firewall) and firewalld (Fedora's | 
|  | 282 | firewall manager) apply firewall rules to all interfaces in the system, rather | 
|  | 283 | then per-device.  One solution to this problem is to revert to iptables | 
|  | 284 | functionality. | 
|  | 285 |  | 
|  | 286 | To get a functional firewall configuration for Fedora do the following: | 
|  | 287 |  | 
|  | 288 | :: | 
|  | 289 |  | 
|  | 290 | sudo service iptables save | 
|  | 291 | sudo systemctl disable firewalld | 
|  | 292 | sudo systemctl enable iptables | 
|  | 293 | sudo systemctl stop firewalld | 
|  | 294 | sudo systemctl start iptables | 
|  | 295 |  | 
|  | 296 |  | 
|  | 297 | To get a functional firewall configuration for distributions containing ufw, | 
|  | 298 | disable ufw.  Note ufw is generally not enabled by default in Ubuntu.  To | 
|  | 299 | disable ufw if it was enabled, do the following: | 
|  | 300 |  | 
|  | 301 | :: | 
|  | 302 |  | 
|  | 303 | sudo service iptables save | 
|  | 304 | sudo ufw disable | 
|  | 305 |  | 
| Sean M. Collins | d8aa10e | 2015-10-09 12:21:30 -0400 | [diff] [blame] | 306 | Configuring Extension Drivers for the ML2 Plugin | 
|  | 307 | ------------------------------------------------ | 
| Sean M. Collins | 872a262 | 2015-10-06 12:45:06 -0400 | [diff] [blame] | 308 |  | 
| Sean M. Collins | d8aa10e | 2015-10-09 12:21:30 -0400 | [diff] [blame] | 309 | Extension drivers for the ML2 plugin are set with the variable | 
|  | 310 | `Q_ML2_PLUGIN_EXT_DRIVERS`, and includes the 'port_security' extension | 
|  | 311 | by default. If you want to remove all the extension drivers (even | 
|  | 312 | 'port_security'), set `Q_ML2_PLUGIN_EXT_DRIVERS` to blank. | 
| Sean M. Collins | 872a262 | 2015-10-06 12:45:06 -0400 | [diff] [blame] | 313 |  |