blob: cac7bb01522dc24e5bef2528aab32333dcc3e3d3 [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. Collins2977b302016-01-25 09:10:52 -05009.. _single-interface-ovs:
10
Sean M. Collins02ae50d2015-03-20 09:58:55 -070011Using Neutron with a Single Interface
12=====================================
13
14In some instances, like on a developer laptop, there is only one
15network interface that is available. In this scenario, the physical
16interface is added to the Open vSwitch bridge, and the IP address of
17the laptop is migrated onto the bridge interface. That way, the
18physical interface can be used to transmit tenant network traffic,
19the OpenStack API traffic, and management traffic.
20
21
22Physical Network Setup
23----------------------
24
25In most cases where DevStack is being deployed with a single
26interface, there is a hardware router that is being used for external
27connectivity and DHCP. The developer machine is connected to this
Mike Spreitzer4baa4ce2016-01-26 14:06:17 -050028network and is on a shared subnet with other machines. The
29`local.conf` exhibited here assumes that 1500 is a reasonable MTU to
30use on that network.
Sean M. Collins02ae50d2015-03-20 09:58:55 -070031
32.. nwdiag::
33
34 nwdiag {
35 inet [ shape = cloud ];
36 router;
37 inet -- router;
38
39 network hardware_network {
40 address = "172.18.161.0/24"
41 router [ address = "172.18.161.1" ];
Sean M. Collins16501662015-10-12 11:01:44 -040042 devstack-1 [ address = "172.18.161.6" ];
Sean M. Collins02ae50d2015-03-20 09:58:55 -070043 }
44 }
45
46
47DevStack Configuration
48----------------------
49
Sean M. Collins16501662015-10-12 11:01:44 -040050The following is a complete `local.conf` for the host named
51`devstack-1`. It will run all the API and services, as well as
52serving as a hypervisor for guest instances.
Sean M. Collins02ae50d2015-03-20 09:58:55 -070053
54::
55
Sean M. Collins16501662015-10-12 11:01:44 -040056 [[local|localrc]]
Sean M. Collins02ae50d2015-03-20 09:58:55 -070057 HOST_IP=172.18.161.6
58 SERVICE_HOST=172.18.161.6
59 MYSQL_HOST=172.18.161.6
60 RABBIT_HOST=172.18.161.6
61 GLANCE_HOSTPORT=172.18.161.6:9292
62 ADMIN_PASSWORD=secrete
Swapnil (coolsvap) Kulkarnic988bf62015-10-08 13:10:43 +053063 DATABASE_PASSWORD=secrete
Sean M. Collins02ae50d2015-03-20 09:58:55 -070064 RABBIT_PASSWORD=secrete
65 SERVICE_PASSWORD=secrete
Sean M. Collins02ae50d2015-03-20 09:58:55 -070066
Sean M. Collins16501662015-10-12 11:01:44 -040067 # Do not use Nova-Network
68 disable_service n-net
69 # Enable Neutron
70 ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt,q-l3
71
72
Sean M. Collins02ae50d2015-03-20 09:58:55 -070073 ## Neutron options
74 Q_USE_SECGROUP=True
Christian Berendt1c394822015-09-10 12:15:16 +020075 FLOATING_RANGE="172.18.161.0/24"
Sean M. Collins02ae50d2015-03-20 09:58:55 -070076 FIXED_RANGE="10.0.0.0/24"
77 Q_FLOATING_ALLOCATION_POOL=start=172.18.161.250,end=172.18.161.254
78 PUBLIC_NETWORK_GATEWAY="172.18.161.1"
79 Q_L3_ENABLED=True
80 PUBLIC_INTERFACE=eth0
Sean M. Collins2977b302016-01-25 09:10:52 -050081
82 # Open vSwitch provider networking configuration
Sean M. Collins02ae50d2015-03-20 09:58:55 -070083 Q_USE_PROVIDERNET_FOR_PUBLIC=True
84 OVS_PHYSICAL_BRIDGE=br-ex
85 PUBLIC_BRIDGE=br-ex
86 OVS_BRIDGE_MAPPINGS=public:br-ex
87
88
Sean M. Collins16501662015-10-12 11:01:44 -040089Adding Additional Compute Nodes
90-------------------------------
91
92Let's suppose that after installing DevStack on the first host, you
93also want to do multinode testing and networking.
94
95Physical Network Setup
96~~~~~~~~~~~~~~~~~~~~~~
97
98.. nwdiag::
99
100 nwdiag {
101 inet [ shape = cloud ];
102 router;
103 inet -- router;
104
105 network hardware_network {
106 address = "172.18.161.0/24"
107 router [ address = "172.18.161.1" ];
108 devstack-1 [ address = "172.18.161.6" ];
109 devstack-2 [ address = "172.18.161.7" ];
110 }
111 }
112
113
114After DevStack installs and configures Neutron, traffic from guest VMs
115flows out of `devstack-2` (the compute node) and is encapsulated in a
116VXLAN tunnel back to `devstack-1` (the control node) where the L3
117agent is running.
118
119::
120
121 stack@devstack-2:~/devstack$ sudo ovs-vsctl show
122 8992d965-0ba0-42fd-90e9-20ecc528bc29
123 Bridge br-int
124 fail_mode: secure
125 Port br-int
126 Interface br-int
127 type: internal
128 Port patch-tun
129 Interface patch-tun
130 type: patch
131 options: {peer=patch-int}
132 Bridge br-tun
133 fail_mode: secure
134 Port "vxlan-c0a801f6"
135 Interface "vxlan-c0a801f6"
136 type: vxlan
137 options: {df_default="true", in_key=flow, local_ip="172.18.161.7", out_key=flow, remote_ip="172.18.161.6"}
138 Port patch-int
139 Interface patch-int
140 type: patch
141 options: {peer=patch-tun}
142 Port br-tun
143 Interface br-tun
144 type: internal
145 ovs_version: "2.0.2"
146
147Open vSwitch on the control node, where the L3 agent runs, is
148configured to de-encapsulate traffic from compute nodes, then forward
149it over the `br-ex` bridge, where `eth0` is attached.
150
151::
152
153 stack@devstack-1:~/devstack$ sudo ovs-vsctl show
154 422adeea-48d1-4a1f-98b1-8e7239077964
155 Bridge br-tun
156 fail_mode: secure
157 Port br-tun
158 Interface br-tun
159 type: internal
160 Port patch-int
161 Interface patch-int
162 type: patch
163 options: {peer=patch-tun}
164 Port "vxlan-c0a801d8"
165 Interface "vxlan-c0a801d8"
166 type: vxlan
167 options: {df_default="true", in_key=flow, local_ip="172.18.161.6", out_key=flow, remote_ip="172.18.161.7"}
168 Bridge br-ex
169 Port phy-br-ex
170 Interface phy-br-ex
171 type: patch
172 options: {peer=int-br-ex}
173 Port "eth0"
174 Interface "eth0"
175 Port br-ex
176 Interface br-ex
177 type: internal
178 Bridge br-int
179 fail_mode: secure
180 Port "tapce66332d-ea"
181 tag: 1
182 Interface "tapce66332d-ea"
183 type: internal
184 Port "qg-65e5a4b9-15"
185 tag: 2
186 Interface "qg-65e5a4b9-15"
187 type: internal
188 Port "qr-33e5e471-88"
189 tag: 1
190 Interface "qr-33e5e471-88"
191 type: internal
192 Port "qr-acbe9951-70"
193 tag: 1
194 Interface "qr-acbe9951-70"
195 type: internal
196 Port br-int
197 Interface br-int
198 type: internal
199 Port patch-tun
200 Interface patch-tun
201 type: patch
202 options: {peer=patch-int}
203 Port int-br-ex
204 Interface int-br-ex
205 type: patch
206 options: {peer=phy-br-ex}
207 ovs_version: "2.0.2"
208
209`br-int` is a bridge that the Open vSwitch mechanism driver creates,
210which is used as the "integration bridge" where ports are created, and
211plugged into the virtual switching fabric. `br-ex` is an OVS bridge
212that is used to connect physical ports (like `eth0`), so that floating
213IP traffic for tenants can be received from the physical network
214infrastructure (and the internet), and routed to tenant network ports.
215`br-tun` is a tunnel bridge that is used to connect OpenStack nodes
216(like `devstack-2`) together. This bridge is used so that tenant
217network traffic, using the VXLAN tunneling protocol, flows between
218each compute node where tenant instances run.
219
220
221
222DevStack Compute Configuration
223~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224
225The host `devstack-2` has a very minimal `local.conf`.
226
227::
228
229 [[local|localrc]]
230 HOST_IP=172.18.161.7
231 SERVICE_HOST=172.18.161.6
232 MYSQL_HOST=172.18.161.6
233 RABBIT_HOST=172.18.161.6
234 GLANCE_HOSTPORT=172.18.161.6:9292
235 ADMIN_PASSWORD=secrete
236 MYSQL_PASSWORD=secrete
237 RABBIT_PASSWORD=secrete
238 SERVICE_PASSWORD=secrete
Sean M. Collins16501662015-10-12 11:01:44 -0400239
240 ## Neutron options
241 PUBLIC_INTERFACE=eth0
242 ENABLED_SERVICES=n-cpu,rabbit,q-agt
243
244Network traffic from `eth0` on the compute nodes is then NAT'd by the
245controller node that runs Neutron's `neutron-l3-agent` and provides L3
246connectivity.
247
Sean M. Collins02ae50d2015-03-20 09:58:55 -0700248
Sean M. Collins34296012014-10-27 11:57:20 -0400249Neutron Networking with Open vSwitch and Provider Networks
250==========================================================
251
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400252In some instances, it is desirable to use neutron's provider
Sean M. Collins34296012014-10-27 11:57:20 -0400253networking extension, so that networks that are configured on an
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400254external router can be utilized by neutron, and instances created via
Sean M. Collins34296012014-10-27 11:57:20 -0400255Nova can attach to the network managed by the external router.
256
257For example, in some lab environments, a hardware router has been
258pre-configured by another party, and an OpenStack developer has been
259given a VLAN tag and IP address range, so that instances created via
260DevStack will use the external router for L3 connectivity, as opposed
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400261to the neutron L3 service.
Sean M. Collins34296012014-10-27 11:57:20 -0400262
Sean M. Collins4696db92015-10-09 12:31:57 -0400263Physical Network Setup
264----------------------
265
266.. nwdiag::
267
268 nwdiag {
269 inet [ shape = cloud ];
270 router;
271 inet -- router;
272
273 network provider_net {
274 address = "203.0.113.0/24"
275 router [ address = "203.0.113.1" ];
276 controller;
277 compute1;
278 compute2;
279 }
280
281 network control_plane {
282 router [ address = "10.0.0.1" ]
283 address = "10.0.0.0/24"
284 controller [ address = "10.0.0.2" ]
285 compute1 [ address = "10.0.0.3" ]
286 compute2 [ address = "10.0.0.4" ]
287 }
288 }
289
290
Sean M. Collins887f1822015-10-12 10:36:34 -0400291On a compute node, the first interface, eth0 is used for the OpenStack
292management (API, message bus, etc) as well as for ssh for an
293administrator to access the machine.
294
295::
296
297 stack@compute:~$ ifconfig eth0
298 eth0 Link encap:Ethernet HWaddr bc:16:65:20:af:fc
299 inet addr:10.0.0.3
300
301eth1 is manually configured at boot to not have an IP address.
302Consult your operating system documentation for the appropriate
303technique. For Ubuntu, the contents of `/etc/network/interfaces`
304contains:
305
306::
307
308 auto eth1
309 iface eth1 inet manual
310 up ifconfig $IFACE 0.0.0.0 up
311 down ifconfig $IFACE 0.0.0.0 down
312
313The second physical interface, eth1 is added to a bridge (in this case
314named br-ex), which is used to forward network traffic from guest VMs.
315
316::
317
318 stack@compute:~$ sudo ovs-vsctl add-br br-ex
319 stack@compute:~$ sudo ovs-vsctl add-port br-ex eth1
320 stack@compute:~$ sudo ovs-vsctl show
321 9a25c837-32ab-45f6-b9f2-1dd888abcf0f
322 Bridge br-ex
323 Port br-ex
324 Interface br-ex
325 type: internal
326 Port phy-br-ex
327 Interface phy-br-ex
328 type: patch
329 options: {peer=int-br-ex}
330 Port "eth1"
331 Interface "eth1"
332
Sean M. Collins34296012014-10-27 11:57:20 -0400333
334Service Configuration
335---------------------
336
337**Control Node**
338
339In this example, the control node will run the majority of the
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400340OpenStack API and management services (keystone, glance,
341nova, neutron)
Sean M. Collins34296012014-10-27 11:57:20 -0400342
343
344**Compute Nodes**
345
346In this example, the nodes that will host guest instances will run
Markus Zoellerc30657d2015-11-02 11:27:46 +0100347the ``neutron-openvswitch-agent`` for network connectivity, as well as
348the compute service ``nova-compute``.
Sean M. Collins34296012014-10-27 11:57:20 -0400349
350DevStack Configuration
351----------------------
352
353The following is a snippet of the DevStack configuration on the
354controller node.
355
356::
357
Sean M. Collins611cab42015-10-09 12:54:32 -0400358 HOST_IP=10.0.0.2
359 SERVICE_HOST=10.0.0.2
360 MYSQL_HOST=10.0.0.2
Sean M. Collins611cab42015-10-09 12:54:32 -0400361 RABBIT_HOST=10.0.0.2
362 GLANCE_HOSTPORT=10.0.0.2:9292
Sean M. Collins34296012014-10-27 11:57:20 -0400363 PUBLIC_INTERFACE=eth1
364
Sean M. Collins611cab42015-10-09 12:54:32 -0400365 ADMIN_PASSWORD=secrete
366 MYSQL_PASSWORD=secrete
367 RABBIT_PASSWORD=secrete
368 SERVICE_PASSWORD=secrete
Sean M. Collins611cab42015-10-09 12:54:32 -0400369
Sean M. Collins34296012014-10-27 11:57:20 -0400370 ## Neutron options
371 Q_USE_SECGROUP=True
372 ENABLE_TENANT_VLANS=True
373 TENANT_VLAN_RANGE=3001:4000
374 PHYSICAL_NETWORK=default
375 OVS_PHYSICAL_BRIDGE=br-ex
376
377 Q_USE_PROVIDER_NETWORKING=True
378 Q_L3_ENABLED=False
379
380 # Do not use Nova-Network
381 disable_service n-net
382
383 # Neutron
384 ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt
385
386 ## Neutron Networking options used to create Neutron Subnets
387
Sean M. Collinsd72b8392015-06-18 12:40:09 -0400388 FIXED_RANGE="203.0.113.0/24"
syed ahsan shamim zaidi512be7d2015-10-20 21:20:27 +0000389 NETWORK_GATEWAY=203.0.113.1
Sean M. Collins34296012014-10-27 11:57:20 -0400390 PROVIDER_SUBNET_NAME="provider_net"
391 PROVIDER_NETWORK_TYPE="vlan"
392 SEGMENTATION_ID=2010
393
394In this configuration we are defining FIXED_RANGE to be a
Sean M. Collinsd72b8392015-06-18 12:40:09 -0400395publicly routed IPv4 subnet. In this specific instance we are using
396the special TEST-NET-3 subnet defined in `RFC 5737 <http://tools.ietf.org/html/rfc5737>`_,
397which is used for documentation. In your DevStack setup, FIXED_RANGE
398would be a public IP address range that you or your organization has
399allocated to you, so that you could access your instances from the
400public internet.
Sean M. Collins34296012014-10-27 11:57:20 -0400401
John Kasperskibdc0fa82015-11-23 11:56:33 -0600402The following is the DevStack configuration on
Sean M. Collins611cab42015-10-09 12:54:32 -0400403compute node 1.
Sean M. Collins34296012014-10-27 11:57:20 -0400404
405::
406
Sean M. Collins611cab42015-10-09 12:54:32 -0400407 HOST_IP=10.0.0.3
408 SERVICE_HOST=10.0.0.2
409 MYSQL_HOST=10.0.0.2
Sean M. Collins611cab42015-10-09 12:54:32 -0400410 RABBIT_HOST=10.0.0.2
411 GLANCE_HOSTPORT=10.0.0.2:9292
412 ADMIN_PASSWORD=secrete
413 MYSQL_PASSWORD=secrete
414 RABBIT_PASSWORD=secrete
415 SERVICE_PASSWORD=secrete
Sean M. Collins611cab42015-10-09 12:54:32 -0400416
Sean M. Collins34296012014-10-27 11:57:20 -0400417 # Services that a compute node runs
418 ENABLED_SERVICES=n-cpu,rabbit,q-agt
419
Sean M. Collins2977b302016-01-25 09:10:52 -0500420 ## Open vSwitch provider networking options
Sean M. Collins34296012014-10-27 11:57:20 -0400421 PHYSICAL_NETWORK=default
422 OVS_PHYSICAL_BRIDGE=br-ex
423 PUBLIC_INTERFACE=eth1
424 Q_USE_PROVIDER_NETWORKING=True
425 Q_L3_ENABLED=False
426
Sean M. Collins611cab42015-10-09 12:54:32 -0400427Compute node 2's configuration will be exactly the same, except
Markus Zoellerc30657d2015-11-02 11:27:46 +0100428``HOST_IP`` will be ``10.0.0.4``
Sean M. Collins611cab42015-10-09 12:54:32 -0400429
Sean M. Collins34296012014-10-27 11:57:20 -0400430When DevStack is configured to use provider networking (via
Markus Zoellerc30657d2015-11-02 11:27:46 +0100431``Q_USE_PROVIDER_NETWORKING`` is True and ``Q_L3_ENABLED`` is False) -
Sean M. Collins34296012014-10-27 11:57:20 -0400432DevStack will automatically add the network interface defined in
Markus Zoellerc30657d2015-11-02 11:27:46 +0100433``PUBLIC_INTERFACE`` to the ``OVS_PHYSICAL_BRIDGE``
Sean M. Collins34296012014-10-27 11:57:20 -0400434
435For example, with the above configuration, a bridge is
Markus Zoellerc30657d2015-11-02 11:27:46 +0100436created, named ``br-ex`` which is managed by Open vSwitch, and the
437second interface on the compute node, ``eth1`` is attached to the
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400438bridge, to forward traffic sent by guest VMs.
Sean M. Collins872a2622015-10-06 12:45:06 -0400439
440Miscellaneous Tips
441==================
442
Mike Spreitzer4baa4ce2016-01-26 14:06:17 -0500443Non-Standard MTU on the Physical Network
444----------------------------------------
445
446DevStack defaults to assume that the MTU on the physical network
447is 1500. A different MTU can be specified by adding the following to
448the `localrc` part of `local.conf` on each machine.
449
450::
Sean M. Collinsf81ae882016-02-01 14:00:20 -0500451
Mike Spreitzer4baa4ce2016-01-26 14:06:17 -0500452 Q_ML2_PLUGIN_PATH_MTU=1500
453
Sean M. Collins872a2622015-10-06 12:45:06 -0400454
455Disabling Next Generation Firewall Tools
456----------------------------------------
457
458DevStack does not properly operate with modern firewall tools. Specifically
459it will appear as if the guest VM can access the external network via ICMP,
460but UDP and TCP packets will not be delivered to the guest VM. The root cause
461of the issue is that both ufw (Uncomplicated Firewall) and firewalld (Fedora's
462firewall manager) apply firewall rules to all interfaces in the system, rather
463then per-device. One solution to this problem is to revert to iptables
464functionality.
465
466To get a functional firewall configuration for Fedora do the following:
467
468::
469
470 sudo service iptables save
471 sudo systemctl disable firewalld
472 sudo systemctl enable iptables
473 sudo systemctl stop firewalld
474 sudo systemctl start iptables
475
476
477To get a functional firewall configuration for distributions containing ufw,
478disable ufw. Note ufw is generally not enabled by default in Ubuntu. To
479disable ufw if it was enabled, do the following:
480
481::
482
483 sudo service iptables save
484 sudo ufw disable
485
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400486Configuring Extension Drivers for the ML2 Plugin
487------------------------------------------------
Sean M. Collins872a2622015-10-06 12:45:06 -0400488
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400489Extension drivers for the ML2 plugin are set with the variable
Markus Zoellerc30657d2015-11-02 11:27:46 +0100490``Q_ML2_PLUGIN_EXT_DRIVERS``, and includes the 'port_security' extension
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400491by default. If you want to remove all the extension drivers (even
Markus Zoellerc30657d2015-11-02 11:27:46 +0100492'port_security'), set ``Q_ML2_PLUGIN_EXT_DRIVERS`` to blank.
Sean M. Collins872a2622015-10-06 12:45:06 -0400493
Sean M. Collins2977b302016-01-25 09:10:52 -0500494
495Using Linux Bridge instead of Open vSwitch
496------------------------------------------
497
498The configuration for using the Linux Bridge ML2 driver is fairly
499straight forward. The Linux Bridge configuration for DevStack is similar
500to the :ref:`Open vSwitch based single interface <single-interface-ovs>`
501setup, with small modifications for the interface mappings.
502
503
504::
505
506 [[local|localrc]]
507 HOST_IP=172.18.161.6
508 SERVICE_HOST=172.18.161.6
509 MYSQL_HOST=172.18.161.6
510 RABBIT_HOST=172.18.161.6
511 GLANCE_HOSTPORT=172.18.161.6:9292
512 ADMIN_PASSWORD=secrete
513 DATABASE_PASSWORD=secrete
514 RABBIT_PASSWORD=secrete
515 SERVICE_PASSWORD=secrete
516
517 # Do not use Nova-Network
518 disable_service n-net
519 # Enable Neutron
520 ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt,q-l3
521
522
523 ## Neutron options
524 Q_USE_SECGROUP=True
525 FLOATING_RANGE="172.18.161.0/24"
526 FIXED_RANGE="10.0.0.0/24"
527 Q_FLOATING_ALLOCATION_POOL=start=172.18.161.250,end=172.18.161.254
528 PUBLIC_NETWORK_GATEWAY="172.18.161.1"
529 Q_L3_ENABLED=True
530 PUBLIC_INTERFACE=eth0
531
532 Q_USE_PROVIDERNET_FOR_PUBLIC=True
533
534 # Linuxbridge Settings
535 Q_AGENT=linuxbridge
536 LB_PHYSICAL_INTERFACE=eth0
537 PUBLIC_PHYSICAL_NETWORK=default
538 LB_INTERFACE_MAPPINGS=default:eth0
Igor Duarte Cardoso3095ff52016-01-19 18:07:47 +0000539
540Creating specific OVS bridges for physical networks
541---------------------------------------------------
542
543When using the Open vSwitch ML2 mechanism driver, it is possible to
544have multiple Open vSwitch bridges meant for physical networking be
545automatically created by setting the ``OVS_BRIDGE_MAPPINGS`` to a list of
546physical network to bridge name associations with the following syntax:
547
548::
Sean M. Collinsf0e5d232016-03-09 13:02:25 -0500549
Igor Duarte Cardoso3095ff52016-01-19 18:07:47 +0000550 OVS_BRIDGE_MAPPINGS=net1name:bridge1name,net2name:bridge2name,<...>
551
552Also, ``OVS_BRIDGE_MAPPINGS`` has precedence over ``PHYSICAL_NETWORK`` and
553``OVS_PHYSICAL_BRIDGE``, meaning that if the former is set, the latter
554ones will be ignored. When ``OVS_BRIDGE_MAPPINGS`` is not set, the other
555variables will still be evaluated.