blob: 7f93bad4c5810682afe21db2307a736873c7df0d [file] [log] [blame]
Sean M. Collins34296012014-10-27 11:57:20 -04001======================================
Shilla Saebi2ed09d82015-04-21 15:02:13 -04002Using DevStack with neutron Networking
Sean M. Collins34296012014-10-27 11:57:20 -04003======================================
4
Shilla Saebi2ed09d82015-04-21 15:02:13 -04005This guide will walk you through using OpenStack neutron with the ML2
Sean M. Collins34296012014-10-27 11:57:20 -04006plugin and the Open vSwitch mechanism driver.
7
Sean M. Collins34296012014-10-27 11:57:20 -04008
Sean M. Collins02ae50d2015-03-20 09:58:55 -07009Using Neutron with a Single Interface
10=====================================
11
12In some instances, like on a developer laptop, there is only one
13network interface that is available. In this scenario, the physical
14interface is added to the Open vSwitch bridge, and the IP address of
15the laptop is migrated onto the bridge interface. That way, the
16physical interface can be used to transmit tenant network traffic,
17the OpenStack API traffic, and management traffic.
18
19
20Physical Network Setup
21----------------------
22
23In most cases where DevStack is being deployed with a single
24interface, there is a hardware router that is being used for external
25connectivity and DHCP. The developer machine is connected to this
Mike Spreitzer4baa4ce2016-01-26 14:06:17 -050026network and is on a shared subnet with other machines. The
27`local.conf` exhibited here assumes that 1500 is a reasonable MTU to
28use on that network.
Sean M. Collins02ae50d2015-03-20 09:58:55 -070029
30.. nwdiag::
31
32 nwdiag {
33 inet [ shape = cloud ];
34 router;
35 inet -- router;
36
37 network hardware_network {
38 address = "172.18.161.0/24"
39 router [ address = "172.18.161.1" ];
Sean M. Collins16501662015-10-12 11:01:44 -040040 devstack-1 [ address = "172.18.161.6" ];
Sean M. Collins02ae50d2015-03-20 09:58:55 -070041 }
42 }
43
44
45DevStack Configuration
46----------------------
47
Sean M. Collins16501662015-10-12 11:01:44 -040048The following is a complete `local.conf` for the host named
49`devstack-1`. It will run all the API and services, as well as
50serving as a hypervisor for guest instances.
Sean M. Collins02ae50d2015-03-20 09:58:55 -070051
52::
53
Sean M. Collins16501662015-10-12 11:01:44 -040054 [[local|localrc]]
Sean M. Collins02ae50d2015-03-20 09:58:55 -070055 HOST_IP=172.18.161.6
56 SERVICE_HOST=172.18.161.6
57 MYSQL_HOST=172.18.161.6
58 RABBIT_HOST=172.18.161.6
59 GLANCE_HOSTPORT=172.18.161.6:9292
60 ADMIN_PASSWORD=secrete
Swapnil (coolsvap) Kulkarnic988bf62015-10-08 13:10:43 +053061 DATABASE_PASSWORD=secrete
Sean M. Collins02ae50d2015-03-20 09:58:55 -070062 RABBIT_PASSWORD=secrete
63 SERVICE_PASSWORD=secrete
Sean M. Collins02ae50d2015-03-20 09:58:55 -070064
Sean M. Collins16501662015-10-12 11:01:44 -040065 # Do not use Nova-Network
66 disable_service n-net
67 # Enable Neutron
68 ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt,q-l3
69
70
Sean M. Collins02ae50d2015-03-20 09:58:55 -070071 ## Neutron options
72 Q_USE_SECGROUP=True
Christian Berendt1c394822015-09-10 12:15:16 +020073 FLOATING_RANGE="172.18.161.0/24"
Sean M. Collins02ae50d2015-03-20 09:58:55 -070074 FIXED_RANGE="10.0.0.0/24"
75 Q_FLOATING_ALLOCATION_POOL=start=172.18.161.250,end=172.18.161.254
76 PUBLIC_NETWORK_GATEWAY="172.18.161.1"
77 Q_L3_ENABLED=True
78 PUBLIC_INTERFACE=eth0
79 Q_USE_PROVIDERNET_FOR_PUBLIC=True
80 OVS_PHYSICAL_BRIDGE=br-ex
81 PUBLIC_BRIDGE=br-ex
82 OVS_BRIDGE_MAPPINGS=public:br-ex
83
84
Sean M. Collins16501662015-10-12 11:01:44 -040085Adding Additional Compute Nodes
86-------------------------------
87
88Let's suppose that after installing DevStack on the first host, you
89also want to do multinode testing and networking.
90
91Physical Network Setup
92~~~~~~~~~~~~~~~~~~~~~~
93
94.. nwdiag::
95
96 nwdiag {
97 inet [ shape = cloud ];
98 router;
99 inet -- router;
100
101 network hardware_network {
102 address = "172.18.161.0/24"
103 router [ address = "172.18.161.1" ];
104 devstack-1 [ address = "172.18.161.6" ];
105 devstack-2 [ address = "172.18.161.7" ];
106 }
107 }
108
109
110After DevStack installs and configures Neutron, traffic from guest VMs
111flows out of `devstack-2` (the compute node) and is encapsulated in a
112VXLAN tunnel back to `devstack-1` (the control node) where the L3
113agent is running.
114
115::
116
117 stack@devstack-2:~/devstack$ sudo ovs-vsctl show
118 8992d965-0ba0-42fd-90e9-20ecc528bc29
119 Bridge br-int
120 fail_mode: secure
121 Port br-int
122 Interface br-int
123 type: internal
124 Port patch-tun
125 Interface patch-tun
126 type: patch
127 options: {peer=patch-int}
128 Bridge br-tun
129 fail_mode: secure
130 Port "vxlan-c0a801f6"
131 Interface "vxlan-c0a801f6"
132 type: vxlan
133 options: {df_default="true", in_key=flow, local_ip="172.18.161.7", out_key=flow, remote_ip="172.18.161.6"}
134 Port patch-int
135 Interface patch-int
136 type: patch
137 options: {peer=patch-tun}
138 Port br-tun
139 Interface br-tun
140 type: internal
141 ovs_version: "2.0.2"
142
143Open vSwitch on the control node, where the L3 agent runs, is
144configured to de-encapsulate traffic from compute nodes, then forward
145it over the `br-ex` bridge, where `eth0` is attached.
146
147::
148
149 stack@devstack-1:~/devstack$ sudo ovs-vsctl show
150 422adeea-48d1-4a1f-98b1-8e7239077964
151 Bridge br-tun
152 fail_mode: secure
153 Port br-tun
154 Interface br-tun
155 type: internal
156 Port patch-int
157 Interface patch-int
158 type: patch
159 options: {peer=patch-tun}
160 Port "vxlan-c0a801d8"
161 Interface "vxlan-c0a801d8"
162 type: vxlan
163 options: {df_default="true", in_key=flow, local_ip="172.18.161.6", out_key=flow, remote_ip="172.18.161.7"}
164 Bridge br-ex
165 Port phy-br-ex
166 Interface phy-br-ex
167 type: patch
168 options: {peer=int-br-ex}
169 Port "eth0"
170 Interface "eth0"
171 Port br-ex
172 Interface br-ex
173 type: internal
174 Bridge br-int
175 fail_mode: secure
176 Port "tapce66332d-ea"
177 tag: 1
178 Interface "tapce66332d-ea"
179 type: internal
180 Port "qg-65e5a4b9-15"
181 tag: 2
182 Interface "qg-65e5a4b9-15"
183 type: internal
184 Port "qr-33e5e471-88"
185 tag: 1
186 Interface "qr-33e5e471-88"
187 type: internal
188 Port "qr-acbe9951-70"
189 tag: 1
190 Interface "qr-acbe9951-70"
191 type: internal
192 Port br-int
193 Interface br-int
194 type: internal
195 Port patch-tun
196 Interface patch-tun
197 type: patch
198 options: {peer=patch-int}
199 Port int-br-ex
200 Interface int-br-ex
201 type: patch
202 options: {peer=phy-br-ex}
203 ovs_version: "2.0.2"
204
205`br-int` is a bridge that the Open vSwitch mechanism driver creates,
206which is used as the "integration bridge" where ports are created, and
207plugged into the virtual switching fabric. `br-ex` is an OVS bridge
208that is used to connect physical ports (like `eth0`), so that floating
209IP traffic for tenants can be received from the physical network
210infrastructure (and the internet), and routed to tenant network ports.
211`br-tun` is a tunnel bridge that is used to connect OpenStack nodes
212(like `devstack-2`) together. This bridge is used so that tenant
213network traffic, using the VXLAN tunneling protocol, flows between
214each compute node where tenant instances run.
215
216
217
218DevStack Compute Configuration
219~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
220
221The host `devstack-2` has a very minimal `local.conf`.
222
223::
224
225 [[local|localrc]]
226 HOST_IP=172.18.161.7
227 SERVICE_HOST=172.18.161.6
228 MYSQL_HOST=172.18.161.6
229 RABBIT_HOST=172.18.161.6
230 GLANCE_HOSTPORT=172.18.161.6:9292
231 ADMIN_PASSWORD=secrete
232 MYSQL_PASSWORD=secrete
233 RABBIT_PASSWORD=secrete
234 SERVICE_PASSWORD=secrete
Sean M. Collins16501662015-10-12 11:01:44 -0400235
236 ## Neutron options
237 PUBLIC_INTERFACE=eth0
238 ENABLED_SERVICES=n-cpu,rabbit,q-agt
239
240Network traffic from `eth0` on the compute nodes is then NAT'd by the
241controller node that runs Neutron's `neutron-l3-agent` and provides L3
242connectivity.
243
Sean M. Collins02ae50d2015-03-20 09:58:55 -0700244
Sean M. Collins34296012014-10-27 11:57:20 -0400245Neutron Networking with Open vSwitch and Provider Networks
246==========================================================
247
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400248In some instances, it is desirable to use neutron's provider
Sean M. Collins34296012014-10-27 11:57:20 -0400249networking extension, so that networks that are configured on an
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400250external router can be utilized by neutron, and instances created via
Sean M. Collins34296012014-10-27 11:57:20 -0400251Nova can attach to the network managed by the external router.
252
253For example, in some lab environments, a hardware router has been
254pre-configured by another party, and an OpenStack developer has been
255given a VLAN tag and IP address range, so that instances created via
256DevStack will use the external router for L3 connectivity, as opposed
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400257to the neutron L3 service.
Sean M. Collins34296012014-10-27 11:57:20 -0400258
Sean M. Collins4696db92015-10-09 12:31:57 -0400259Physical Network Setup
260----------------------
261
262.. nwdiag::
263
264 nwdiag {
265 inet [ shape = cloud ];
266 router;
267 inet -- router;
268
269 network provider_net {
270 address = "203.0.113.0/24"
271 router [ address = "203.0.113.1" ];
272 controller;
273 compute1;
274 compute2;
275 }
276
277 network control_plane {
278 router [ address = "10.0.0.1" ]
279 address = "10.0.0.0/24"
280 controller [ address = "10.0.0.2" ]
281 compute1 [ address = "10.0.0.3" ]
282 compute2 [ address = "10.0.0.4" ]
283 }
284 }
285
286
Sean M. Collins887f1822015-10-12 10:36:34 -0400287On a compute node, the first interface, eth0 is used for the OpenStack
288management (API, message bus, etc) as well as for ssh for an
289administrator to access the machine.
290
291::
292
293 stack@compute:~$ ifconfig eth0
294 eth0 Link encap:Ethernet HWaddr bc:16:65:20:af:fc
295 inet addr:10.0.0.3
296
297eth1 is manually configured at boot to not have an IP address.
298Consult your operating system documentation for the appropriate
299technique. For Ubuntu, the contents of `/etc/network/interfaces`
300contains:
301
302::
303
304 auto eth1
305 iface eth1 inet manual
306 up ifconfig $IFACE 0.0.0.0 up
307 down ifconfig $IFACE 0.0.0.0 down
308
309The second physical interface, eth1 is added to a bridge (in this case
310named br-ex), which is used to forward network traffic from guest VMs.
311
312::
313
314 stack@compute:~$ sudo ovs-vsctl add-br br-ex
315 stack@compute:~$ sudo ovs-vsctl add-port br-ex eth1
316 stack@compute:~$ sudo ovs-vsctl show
317 9a25c837-32ab-45f6-b9f2-1dd888abcf0f
318 Bridge br-ex
319 Port br-ex
320 Interface br-ex
321 type: internal
322 Port phy-br-ex
323 Interface phy-br-ex
324 type: patch
325 options: {peer=int-br-ex}
326 Port "eth1"
327 Interface "eth1"
328
Sean M. Collins34296012014-10-27 11:57:20 -0400329
330Service Configuration
331---------------------
332
333**Control Node**
334
335In this example, the control node will run the majority of the
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400336OpenStack API and management services (keystone, glance,
337nova, neutron)
Sean M. Collins34296012014-10-27 11:57:20 -0400338
339
340**Compute Nodes**
341
342In this example, the nodes that will host guest instances will run
Markus Zoellerc30657d2015-11-02 11:27:46 +0100343the ``neutron-openvswitch-agent`` for network connectivity, as well as
344the compute service ``nova-compute``.
Sean M. Collins34296012014-10-27 11:57:20 -0400345
346DevStack Configuration
347----------------------
348
349The following is a snippet of the DevStack configuration on the
350controller node.
351
352::
353
Sean M. Collins611cab42015-10-09 12:54:32 -0400354 HOST_IP=10.0.0.2
355 SERVICE_HOST=10.0.0.2
356 MYSQL_HOST=10.0.0.2
Sean M. Collins611cab42015-10-09 12:54:32 -0400357 RABBIT_HOST=10.0.0.2
358 GLANCE_HOSTPORT=10.0.0.2:9292
Sean M. Collins34296012014-10-27 11:57:20 -0400359 PUBLIC_INTERFACE=eth1
360
Sean M. Collins611cab42015-10-09 12:54:32 -0400361 ADMIN_PASSWORD=secrete
362 MYSQL_PASSWORD=secrete
363 RABBIT_PASSWORD=secrete
364 SERVICE_PASSWORD=secrete
Sean M. Collins611cab42015-10-09 12:54:32 -0400365
Sean M. Collins34296012014-10-27 11:57:20 -0400366 ## Neutron options
367 Q_USE_SECGROUP=True
368 ENABLE_TENANT_VLANS=True
369 TENANT_VLAN_RANGE=3001:4000
370 PHYSICAL_NETWORK=default
371 OVS_PHYSICAL_BRIDGE=br-ex
372
373 Q_USE_PROVIDER_NETWORKING=True
374 Q_L3_ENABLED=False
375
376 # Do not use Nova-Network
377 disable_service n-net
378
379 # Neutron
380 ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt
381
382 ## Neutron Networking options used to create Neutron Subnets
383
Sean M. Collinsd72b8392015-06-18 12:40:09 -0400384 FIXED_RANGE="203.0.113.0/24"
syed ahsan shamim zaidi512be7d2015-10-20 21:20:27 +0000385 NETWORK_GATEWAY=203.0.113.1
Sean M. Collins34296012014-10-27 11:57:20 -0400386 PROVIDER_SUBNET_NAME="provider_net"
387 PROVIDER_NETWORK_TYPE="vlan"
388 SEGMENTATION_ID=2010
389
390In this configuration we are defining FIXED_RANGE to be a
Sean M. Collinsd72b8392015-06-18 12:40:09 -0400391publicly routed IPv4 subnet. In this specific instance we are using
392the special TEST-NET-3 subnet defined in `RFC 5737 <http://tools.ietf.org/html/rfc5737>`_,
393which is used for documentation. In your DevStack setup, FIXED_RANGE
394would be a public IP address range that you or your organization has
395allocated to you, so that you could access your instances from the
396public internet.
Sean M. Collins34296012014-10-27 11:57:20 -0400397
John Kasperskibdc0fa82015-11-23 11:56:33 -0600398The following is the DevStack configuration on
Sean M. Collins611cab42015-10-09 12:54:32 -0400399compute node 1.
Sean M. Collins34296012014-10-27 11:57:20 -0400400
401::
402
Sean M. Collins611cab42015-10-09 12:54:32 -0400403 HOST_IP=10.0.0.3
404 SERVICE_HOST=10.0.0.2
405 MYSQL_HOST=10.0.0.2
Sean M. Collins611cab42015-10-09 12:54:32 -0400406 RABBIT_HOST=10.0.0.2
407 GLANCE_HOSTPORT=10.0.0.2:9292
408 ADMIN_PASSWORD=secrete
409 MYSQL_PASSWORD=secrete
410 RABBIT_PASSWORD=secrete
411 SERVICE_PASSWORD=secrete
Sean M. Collins611cab42015-10-09 12:54:32 -0400412
Sean M. Collins34296012014-10-27 11:57:20 -0400413 # Services that a compute node runs
414 ENABLED_SERVICES=n-cpu,rabbit,q-agt
415
416 ## Neutron options
Sean M. Collins34296012014-10-27 11:57:20 -0400417 PHYSICAL_NETWORK=default
418 OVS_PHYSICAL_BRIDGE=br-ex
419 PUBLIC_INTERFACE=eth1
420 Q_USE_PROVIDER_NETWORKING=True
421 Q_L3_ENABLED=False
422
Sean M. Collins611cab42015-10-09 12:54:32 -0400423Compute node 2's configuration will be exactly the same, except
Markus Zoellerc30657d2015-11-02 11:27:46 +0100424``HOST_IP`` will be ``10.0.0.4``
Sean M. Collins611cab42015-10-09 12:54:32 -0400425
Sean M. Collins34296012014-10-27 11:57:20 -0400426When DevStack is configured to use provider networking (via
Markus Zoellerc30657d2015-11-02 11:27:46 +0100427``Q_USE_PROVIDER_NETWORKING`` is True and ``Q_L3_ENABLED`` is False) -
Sean M. Collins34296012014-10-27 11:57:20 -0400428DevStack will automatically add the network interface defined in
Markus Zoellerc30657d2015-11-02 11:27:46 +0100429``PUBLIC_INTERFACE`` to the ``OVS_PHYSICAL_BRIDGE``
Sean M. Collins34296012014-10-27 11:57:20 -0400430
431For example, with the above configuration, a bridge is
Markus Zoellerc30657d2015-11-02 11:27:46 +0100432created, named ``br-ex`` which is managed by Open vSwitch, and the
433second interface on the compute node, ``eth1`` is attached to the
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400434bridge, to forward traffic sent by guest VMs.
Sean M. Collins872a2622015-10-06 12:45:06 -0400435
436Miscellaneous Tips
437==================
438
Mike Spreitzer4baa4ce2016-01-26 14:06:17 -0500439Non-Standard MTU on the Physical Network
440----------------------------------------
441
442DevStack defaults to assume that the MTU on the physical network
443is 1500. A different MTU can be specified by adding the following to
444the `localrc` part of `local.conf` on each machine.
445
446::
447 Q_ML2_PLUGIN_PATH_MTU=1500
448
Sean M. Collins872a2622015-10-06 12:45:06 -0400449
450Disabling Next Generation Firewall Tools
451----------------------------------------
452
453DevStack does not properly operate with modern firewall tools. Specifically
454it will appear as if the guest VM can access the external network via ICMP,
455but UDP and TCP packets will not be delivered to the guest VM. The root cause
456of the issue is that both ufw (Uncomplicated Firewall) and firewalld (Fedora's
457firewall manager) apply firewall rules to all interfaces in the system, rather
458then per-device. One solution to this problem is to revert to iptables
459functionality.
460
461To get a functional firewall configuration for Fedora do the following:
462
463::
464
465 sudo service iptables save
466 sudo systemctl disable firewalld
467 sudo systemctl enable iptables
468 sudo systemctl stop firewalld
469 sudo systemctl start iptables
470
471
472To get a functional firewall configuration for distributions containing ufw,
473disable ufw. Note ufw is generally not enabled by default in Ubuntu. To
474disable ufw if it was enabled, do the following:
475
476::
477
478 sudo service iptables save
479 sudo ufw disable
480
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400481Configuring Extension Drivers for the ML2 Plugin
482------------------------------------------------
Sean M. Collins872a2622015-10-06 12:45:06 -0400483
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400484Extension drivers for the ML2 plugin are set with the variable
Markus Zoellerc30657d2015-11-02 11:27:46 +0100485``Q_ML2_PLUGIN_EXT_DRIVERS``, and includes the 'port_security' extension
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400486by default. If you want to remove all the extension drivers (even
Markus Zoellerc30657d2015-11-02 11:27:46 +0100487'port_security'), set ``Q_ML2_PLUGIN_EXT_DRIVERS`` to blank.
Sean M. Collins872a2622015-10-06 12:45:06 -0400488