blob: 81f737ff41474b8a888e9d0a2e93248819ecebf3 [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
28network and is on a shared subnet with other machines.
29
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
Sean M. Collins2977b302016-01-25 09:10:52 -050079
80 # Open vSwitch provider networking configuration
Sean M. Collins02ae50d2015-03-20 09:58:55 -070081 Q_USE_PROVIDERNET_FOR_PUBLIC=True
82 OVS_PHYSICAL_BRIDGE=br-ex
83 PUBLIC_BRIDGE=br-ex
84 OVS_BRIDGE_MAPPINGS=public:br-ex
85
86
Sean M. Collins16501662015-10-12 11:01:44 -040087Adding Additional Compute Nodes
88-------------------------------
89
90Let's suppose that after installing DevStack on the first host, you
91also want to do multinode testing and networking.
92
93Physical Network Setup
94~~~~~~~~~~~~~~~~~~~~~~
95
96.. nwdiag::
97
98 nwdiag {
99 inet [ shape = cloud ];
100 router;
101 inet -- router;
102
103 network hardware_network {
104 address = "172.18.161.0/24"
105 router [ address = "172.18.161.1" ];
106 devstack-1 [ address = "172.18.161.6" ];
107 devstack-2 [ address = "172.18.161.7" ];
108 }
109 }
110
111
112After DevStack installs and configures Neutron, traffic from guest VMs
113flows out of `devstack-2` (the compute node) and is encapsulated in a
114VXLAN tunnel back to `devstack-1` (the control node) where the L3
115agent is running.
116
117::
118
119 stack@devstack-2:~/devstack$ sudo ovs-vsctl show
120 8992d965-0ba0-42fd-90e9-20ecc528bc29
121 Bridge br-int
122 fail_mode: secure
123 Port br-int
124 Interface br-int
125 type: internal
126 Port patch-tun
127 Interface patch-tun
128 type: patch
129 options: {peer=patch-int}
130 Bridge br-tun
131 fail_mode: secure
132 Port "vxlan-c0a801f6"
133 Interface "vxlan-c0a801f6"
134 type: vxlan
135 options: {df_default="true", in_key=flow, local_ip="172.18.161.7", out_key=flow, remote_ip="172.18.161.6"}
136 Port patch-int
137 Interface patch-int
138 type: patch
139 options: {peer=patch-tun}
140 Port br-tun
141 Interface br-tun
142 type: internal
143 ovs_version: "2.0.2"
144
145Open vSwitch on the control node, where the L3 agent runs, is
146configured to de-encapsulate traffic from compute nodes, then forward
147it over the `br-ex` bridge, where `eth0` is attached.
148
149::
150
151 stack@devstack-1:~/devstack$ sudo ovs-vsctl show
152 422adeea-48d1-4a1f-98b1-8e7239077964
153 Bridge br-tun
154 fail_mode: secure
155 Port br-tun
156 Interface br-tun
157 type: internal
158 Port patch-int
159 Interface patch-int
160 type: patch
161 options: {peer=patch-tun}
162 Port "vxlan-c0a801d8"
163 Interface "vxlan-c0a801d8"
164 type: vxlan
165 options: {df_default="true", in_key=flow, local_ip="172.18.161.6", out_key=flow, remote_ip="172.18.161.7"}
166 Bridge br-ex
167 Port phy-br-ex
168 Interface phy-br-ex
169 type: patch
170 options: {peer=int-br-ex}
171 Port "eth0"
172 Interface "eth0"
173 Port br-ex
174 Interface br-ex
175 type: internal
176 Bridge br-int
177 fail_mode: secure
178 Port "tapce66332d-ea"
179 tag: 1
180 Interface "tapce66332d-ea"
181 type: internal
182 Port "qg-65e5a4b9-15"
183 tag: 2
184 Interface "qg-65e5a4b9-15"
185 type: internal
186 Port "qr-33e5e471-88"
187 tag: 1
188 Interface "qr-33e5e471-88"
189 type: internal
190 Port "qr-acbe9951-70"
191 tag: 1
192 Interface "qr-acbe9951-70"
193 type: internal
194 Port br-int
195 Interface br-int
196 type: internal
197 Port patch-tun
198 Interface patch-tun
199 type: patch
200 options: {peer=patch-int}
201 Port int-br-ex
202 Interface int-br-ex
203 type: patch
204 options: {peer=phy-br-ex}
205 ovs_version: "2.0.2"
206
207`br-int` is a bridge that the Open vSwitch mechanism driver creates,
208which is used as the "integration bridge" where ports are created, and
209plugged into the virtual switching fabric. `br-ex` is an OVS bridge
210that is used to connect physical ports (like `eth0`), so that floating
211IP traffic for tenants can be received from the physical network
212infrastructure (and the internet), and routed to tenant network ports.
213`br-tun` is a tunnel bridge that is used to connect OpenStack nodes
214(like `devstack-2`) together. This bridge is used so that tenant
215network traffic, using the VXLAN tunneling protocol, flows between
216each compute node where tenant instances run.
217
218
219
220DevStack Compute Configuration
221~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
222
223The host `devstack-2` has a very minimal `local.conf`.
224
225::
226
227 [[local|localrc]]
228 HOST_IP=172.18.161.7
229 SERVICE_HOST=172.18.161.6
230 MYSQL_HOST=172.18.161.6
231 RABBIT_HOST=172.18.161.6
232 GLANCE_HOSTPORT=172.18.161.6:9292
233 ADMIN_PASSWORD=secrete
234 MYSQL_PASSWORD=secrete
235 RABBIT_PASSWORD=secrete
236 SERVICE_PASSWORD=secrete
Sean M. Collins16501662015-10-12 11:01:44 -0400237
238 ## Neutron options
239 PUBLIC_INTERFACE=eth0
240 ENABLED_SERVICES=n-cpu,rabbit,q-agt
241
242Network traffic from `eth0` on the compute nodes is then NAT'd by the
243controller node that runs Neutron's `neutron-l3-agent` and provides L3
244connectivity.
245
Sean M. Collins02ae50d2015-03-20 09:58:55 -0700246
Sean M. Collins34296012014-10-27 11:57:20 -0400247Neutron Networking with Open vSwitch and Provider Networks
248==========================================================
249
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400250In some instances, it is desirable to use neutron's provider
Sean M. Collins34296012014-10-27 11:57:20 -0400251networking extension, so that networks that are configured on an
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400252external router can be utilized by neutron, and instances created via
Sean M. Collins34296012014-10-27 11:57:20 -0400253Nova can attach to the network managed by the external router.
254
255For example, in some lab environments, a hardware router has been
256pre-configured by another party, and an OpenStack developer has been
257given a VLAN tag and IP address range, so that instances created via
258DevStack will use the external router for L3 connectivity, as opposed
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400259to the neutron L3 service.
Sean M. Collins34296012014-10-27 11:57:20 -0400260
Sean M. Collins4696db92015-10-09 12:31:57 -0400261Physical Network Setup
262----------------------
263
264.. nwdiag::
265
266 nwdiag {
267 inet [ shape = cloud ];
268 router;
269 inet -- router;
270
271 network provider_net {
272 address = "203.0.113.0/24"
273 router [ address = "203.0.113.1" ];
274 controller;
275 compute1;
276 compute2;
277 }
278
279 network control_plane {
280 router [ address = "10.0.0.1" ]
281 address = "10.0.0.0/24"
282 controller [ address = "10.0.0.2" ]
283 compute1 [ address = "10.0.0.3" ]
284 compute2 [ address = "10.0.0.4" ]
285 }
286 }
287
288
Sean M. Collins887f1822015-10-12 10:36:34 -0400289On a compute node, the first interface, eth0 is used for the OpenStack
290management (API, message bus, etc) as well as for ssh for an
291administrator to access the machine.
292
293::
294
295 stack@compute:~$ ifconfig eth0
296 eth0 Link encap:Ethernet HWaddr bc:16:65:20:af:fc
297 inet addr:10.0.0.3
298
299eth1 is manually configured at boot to not have an IP address.
300Consult your operating system documentation for the appropriate
301technique. For Ubuntu, the contents of `/etc/network/interfaces`
302contains:
303
304::
305
306 auto eth1
307 iface eth1 inet manual
308 up ifconfig $IFACE 0.0.0.0 up
309 down ifconfig $IFACE 0.0.0.0 down
310
311The second physical interface, eth1 is added to a bridge (in this case
312named br-ex), which is used to forward network traffic from guest VMs.
313
314::
315
316 stack@compute:~$ sudo ovs-vsctl add-br br-ex
317 stack@compute:~$ sudo ovs-vsctl add-port br-ex eth1
318 stack@compute:~$ sudo ovs-vsctl show
319 9a25c837-32ab-45f6-b9f2-1dd888abcf0f
320 Bridge br-ex
321 Port br-ex
322 Interface br-ex
323 type: internal
324 Port phy-br-ex
325 Interface phy-br-ex
326 type: patch
327 options: {peer=int-br-ex}
328 Port "eth1"
329 Interface "eth1"
330
Sean M. Collins34296012014-10-27 11:57:20 -0400331
332Service Configuration
333---------------------
334
335**Control Node**
336
337In this example, the control node will run the majority of the
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400338OpenStack API and management services (keystone, glance,
339nova, neutron)
Sean M. Collins34296012014-10-27 11:57:20 -0400340
341
342**Compute Nodes**
343
344In this example, the nodes that will host guest instances will run
Markus Zoellerc30657d2015-11-02 11:27:46 +0100345the ``neutron-openvswitch-agent`` for network connectivity, as well as
346the compute service ``nova-compute``.
Sean M. Collins34296012014-10-27 11:57:20 -0400347
348DevStack Configuration
349----------------------
350
351The following is a snippet of the DevStack configuration on the
352controller node.
353
354::
355
Sean M. Collins611cab42015-10-09 12:54:32 -0400356 HOST_IP=10.0.0.2
357 SERVICE_HOST=10.0.0.2
358 MYSQL_HOST=10.0.0.2
Sean M. Collins611cab42015-10-09 12:54:32 -0400359 RABBIT_HOST=10.0.0.2
360 GLANCE_HOSTPORT=10.0.0.2:9292
Sean M. Collins34296012014-10-27 11:57:20 -0400361 PUBLIC_INTERFACE=eth1
362
Sean M. Collins611cab42015-10-09 12:54:32 -0400363 ADMIN_PASSWORD=secrete
364 MYSQL_PASSWORD=secrete
365 RABBIT_PASSWORD=secrete
366 SERVICE_PASSWORD=secrete
Sean M. Collins611cab42015-10-09 12:54:32 -0400367
Sean M. Collins34296012014-10-27 11:57:20 -0400368 ## Neutron options
369 Q_USE_SECGROUP=True
370 ENABLE_TENANT_VLANS=True
371 TENANT_VLAN_RANGE=3001:4000
372 PHYSICAL_NETWORK=default
373 OVS_PHYSICAL_BRIDGE=br-ex
374
375 Q_USE_PROVIDER_NETWORKING=True
376 Q_L3_ENABLED=False
377
378 # Do not use Nova-Network
379 disable_service n-net
380
381 # Neutron
382 ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt
383
384 ## Neutron Networking options used to create Neutron Subnets
385
Sean M. Collinsd72b8392015-06-18 12:40:09 -0400386 FIXED_RANGE="203.0.113.0/24"
syed ahsan shamim zaidi512be7d2015-10-20 21:20:27 +0000387 NETWORK_GATEWAY=203.0.113.1
Sean M. Collins34296012014-10-27 11:57:20 -0400388 PROVIDER_SUBNET_NAME="provider_net"
389 PROVIDER_NETWORK_TYPE="vlan"
390 SEGMENTATION_ID=2010
391
392In this configuration we are defining FIXED_RANGE to be a
Sean M. Collinsd72b8392015-06-18 12:40:09 -0400393publicly routed IPv4 subnet. In this specific instance we are using
394the special TEST-NET-3 subnet defined in `RFC 5737 <http://tools.ietf.org/html/rfc5737>`_,
395which is used for documentation. In your DevStack setup, FIXED_RANGE
396would be a public IP address range that you or your organization has
397allocated to you, so that you could access your instances from the
398public internet.
Sean M. Collins34296012014-10-27 11:57:20 -0400399
John Kasperskibdc0fa82015-11-23 11:56:33 -0600400The following is the DevStack configuration on
Sean M. Collins611cab42015-10-09 12:54:32 -0400401compute node 1.
Sean M. Collins34296012014-10-27 11:57:20 -0400402
403::
404
Sean M. Collins611cab42015-10-09 12:54:32 -0400405 HOST_IP=10.0.0.3
406 SERVICE_HOST=10.0.0.2
407 MYSQL_HOST=10.0.0.2
Sean M. Collins611cab42015-10-09 12:54:32 -0400408 RABBIT_HOST=10.0.0.2
409 GLANCE_HOSTPORT=10.0.0.2:9292
410 ADMIN_PASSWORD=secrete
411 MYSQL_PASSWORD=secrete
412 RABBIT_PASSWORD=secrete
413 SERVICE_PASSWORD=secrete
Sean M. Collins611cab42015-10-09 12:54:32 -0400414
Sean M. Collins34296012014-10-27 11:57:20 -0400415 # Services that a compute node runs
416 ENABLED_SERVICES=n-cpu,rabbit,q-agt
417
Sean M. Collins2977b302016-01-25 09:10:52 -0500418 ## Open vSwitch provider networking options
Sean M. Collins34296012014-10-27 11:57:20 -0400419 PHYSICAL_NETWORK=default
420 OVS_PHYSICAL_BRIDGE=br-ex
421 PUBLIC_INTERFACE=eth1
422 Q_USE_PROVIDER_NETWORKING=True
423 Q_L3_ENABLED=False
424
Sean M. Collins611cab42015-10-09 12:54:32 -0400425Compute node 2's configuration will be exactly the same, except
Markus Zoellerc30657d2015-11-02 11:27:46 +0100426``HOST_IP`` will be ``10.0.0.4``
Sean M. Collins611cab42015-10-09 12:54:32 -0400427
Sean M. Collins34296012014-10-27 11:57:20 -0400428When DevStack is configured to use provider networking (via
Markus Zoellerc30657d2015-11-02 11:27:46 +0100429``Q_USE_PROVIDER_NETWORKING`` is True and ``Q_L3_ENABLED`` is False) -
Sean M. Collins34296012014-10-27 11:57:20 -0400430DevStack will automatically add the network interface defined in
Markus Zoellerc30657d2015-11-02 11:27:46 +0100431``PUBLIC_INTERFACE`` to the ``OVS_PHYSICAL_BRIDGE``
Sean M. Collins34296012014-10-27 11:57:20 -0400432
433For example, with the above configuration, a bridge is
Markus Zoellerc30657d2015-11-02 11:27:46 +0100434created, named ``br-ex`` which is managed by Open vSwitch, and the
435second interface on the compute node, ``eth1`` is attached to the
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400436bridge, to forward traffic sent by guest VMs.
Sean M. Collins872a2622015-10-06 12:45:06 -0400437
438Miscellaneous Tips
439==================
440
441
442Disabling Next Generation Firewall Tools
443----------------------------------------
444
445DevStack does not properly operate with modern firewall tools. Specifically
446it will appear as if the guest VM can access the external network via ICMP,
447but UDP and TCP packets will not be delivered to the guest VM. The root cause
448of the issue is that both ufw (Uncomplicated Firewall) and firewalld (Fedora's
449firewall manager) apply firewall rules to all interfaces in the system, rather
450then per-device. One solution to this problem is to revert to iptables
451functionality.
452
453To get a functional firewall configuration for Fedora do the following:
454
455::
456
457 sudo service iptables save
458 sudo systemctl disable firewalld
459 sudo systemctl enable iptables
460 sudo systemctl stop firewalld
461 sudo systemctl start iptables
462
463
464To get a functional firewall configuration for distributions containing ufw,
465disable ufw. Note ufw is generally not enabled by default in Ubuntu. To
466disable ufw if it was enabled, do the following:
467
468::
469
470 sudo service iptables save
471 sudo ufw disable
472
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400473Configuring Extension Drivers for the ML2 Plugin
474------------------------------------------------
Sean M. Collins872a2622015-10-06 12:45:06 -0400475
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400476Extension drivers for the ML2 plugin are set with the variable
Markus Zoellerc30657d2015-11-02 11:27:46 +0100477``Q_ML2_PLUGIN_EXT_DRIVERS``, and includes the 'port_security' extension
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400478by default. If you want to remove all the extension drivers (even
Markus Zoellerc30657d2015-11-02 11:27:46 +0100479'port_security'), set ``Q_ML2_PLUGIN_EXT_DRIVERS`` to blank.
Sean M. Collins872a2622015-10-06 12:45:06 -0400480
Sean M. Collins2977b302016-01-25 09:10:52 -0500481
482Using Linux Bridge instead of Open vSwitch
483------------------------------------------
484
485The configuration for using the Linux Bridge ML2 driver is fairly
486straight forward. The Linux Bridge configuration for DevStack is similar
487to the :ref:`Open vSwitch based single interface <single-interface-ovs>`
488setup, with small modifications for the interface mappings.
489
490
491::
492
493 [[local|localrc]]
494 HOST_IP=172.18.161.6
495 SERVICE_HOST=172.18.161.6
496 MYSQL_HOST=172.18.161.6
497 RABBIT_HOST=172.18.161.6
498 GLANCE_HOSTPORT=172.18.161.6:9292
499 ADMIN_PASSWORD=secrete
500 DATABASE_PASSWORD=secrete
501 RABBIT_PASSWORD=secrete
502 SERVICE_PASSWORD=secrete
503
504 # Do not use Nova-Network
505 disable_service n-net
506 # Enable Neutron
507 ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt,q-l3
508
509
510 ## Neutron options
511 Q_USE_SECGROUP=True
512 FLOATING_RANGE="172.18.161.0/24"
513 FIXED_RANGE="10.0.0.0/24"
514 Q_FLOATING_ALLOCATION_POOL=start=172.18.161.250,end=172.18.161.254
515 PUBLIC_NETWORK_GATEWAY="172.18.161.1"
516 Q_L3_ENABLED=True
517 PUBLIC_INTERFACE=eth0
518
519 Q_USE_PROVIDERNET_FOR_PUBLIC=True
520
521 # Linuxbridge Settings
522 Q_AGENT=linuxbridge
523 LB_PHYSICAL_INTERFACE=eth0
524 PUBLIC_PHYSICAL_NETWORK=default
525 LB_INTERFACE_MAPPINGS=default:eth0