blob: 996c7d1f594a73e3d73d60f01e100252c9e641f3 [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
26network 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" ];
Sean M. Collins16501662015-10-12 11:01:44 -040038 devstack-1 [ address = "172.18.161.6" ];
Sean M. Collins02ae50d2015-03-20 09:58:55 -070039 }
40 }
41
42
43DevStack Configuration
44----------------------
45
Sean M. Collins16501662015-10-12 11:01:44 -040046The following is a complete `local.conf` for the host named
47`devstack-1`. It will run all the API and services, as well as
48serving as a hypervisor for guest instances.
Sean M. Collins02ae50d2015-03-20 09:58:55 -070049
50::
51
Sean M. Collins16501662015-10-12 11:01:44 -040052 [[local|localrc]]
Sean M. Collins02ae50d2015-03-20 09:58:55 -070053 HOST_IP=172.18.161.6
54 SERVICE_HOST=172.18.161.6
55 MYSQL_HOST=172.18.161.6
56 RABBIT_HOST=172.18.161.6
57 GLANCE_HOSTPORT=172.18.161.6:9292
58 ADMIN_PASSWORD=secrete
Swapnil (coolsvap) Kulkarnic988bf62015-10-08 13:10:43 +053059 DATABASE_PASSWORD=secrete
Sean M. Collins02ae50d2015-03-20 09:58:55 -070060 RABBIT_PASSWORD=secrete
61 SERVICE_PASSWORD=secrete
62 SERVICE_TOKEN=secrete
63
Sean M. Collins16501662015-10-12 11:01:44 -040064 # Do not use Nova-Network
65 disable_service n-net
66 # Enable Neutron
67 ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt,q-l3
68
69
Sean M. Collins02ae50d2015-03-20 09:58:55 -070070 ## Neutron options
71 Q_USE_SECGROUP=True
Christian Berendt1c394822015-09-10 12:15:16 +020072 FLOATING_RANGE="172.18.161.0/24"
Sean M. Collins02ae50d2015-03-20 09:58:55 -070073 FIXED_RANGE="10.0.0.0/24"
74 Q_FLOATING_ALLOCATION_POOL=start=172.18.161.250,end=172.18.161.254
75 PUBLIC_NETWORK_GATEWAY="172.18.161.1"
76 Q_L3_ENABLED=True
77 PUBLIC_INTERFACE=eth0
78 Q_USE_PROVIDERNET_FOR_PUBLIC=True
79 OVS_PHYSICAL_BRIDGE=br-ex
80 PUBLIC_BRIDGE=br-ex
81 OVS_BRIDGE_MAPPINGS=public:br-ex
82
83
Sean M. Collins16501662015-10-12 11:01:44 -040084Adding Additional Compute Nodes
85-------------------------------
86
87Let's suppose that after installing DevStack on the first host, you
88also want to do multinode testing and networking.
89
90Physical Network Setup
91~~~~~~~~~~~~~~~~~~~~~~
92
93.. nwdiag::
94
95 nwdiag {
96 inet [ shape = cloud ];
97 router;
98 inet -- router;
99
100 network hardware_network {
101 address = "172.18.161.0/24"
102 router [ address = "172.18.161.1" ];
103 devstack-1 [ address = "172.18.161.6" ];
104 devstack-2 [ address = "172.18.161.7" ];
105 }
106 }
107
108
109After DevStack installs and configures Neutron, traffic from guest VMs
110flows out of `devstack-2` (the compute node) and is encapsulated in a
111VXLAN tunnel back to `devstack-1` (the control node) where the L3
112agent is running.
113
114::
115
116 stack@devstack-2:~/devstack$ sudo ovs-vsctl show
117 8992d965-0ba0-42fd-90e9-20ecc528bc29
118 Bridge br-int
119 fail_mode: secure
120 Port br-int
121 Interface br-int
122 type: internal
123 Port patch-tun
124 Interface patch-tun
125 type: patch
126 options: {peer=patch-int}
127 Bridge br-tun
128 fail_mode: secure
129 Port "vxlan-c0a801f6"
130 Interface "vxlan-c0a801f6"
131 type: vxlan
132 options: {df_default="true", in_key=flow, local_ip="172.18.161.7", out_key=flow, remote_ip="172.18.161.6"}
133 Port patch-int
134 Interface patch-int
135 type: patch
136 options: {peer=patch-tun}
137 Port br-tun
138 Interface br-tun
139 type: internal
140 ovs_version: "2.0.2"
141
142Open vSwitch on the control node, where the L3 agent runs, is
143configured to de-encapsulate traffic from compute nodes, then forward
144it over the `br-ex` bridge, where `eth0` is attached.
145
146::
147
148 stack@devstack-1:~/devstack$ sudo ovs-vsctl show
149 422adeea-48d1-4a1f-98b1-8e7239077964
150 Bridge br-tun
151 fail_mode: secure
152 Port br-tun
153 Interface br-tun
154 type: internal
155 Port patch-int
156 Interface patch-int
157 type: patch
158 options: {peer=patch-tun}
159 Port "vxlan-c0a801d8"
160 Interface "vxlan-c0a801d8"
161 type: vxlan
162 options: {df_default="true", in_key=flow, local_ip="172.18.161.6", out_key=flow, remote_ip="172.18.161.7"}
163 Bridge br-ex
164 Port phy-br-ex
165 Interface phy-br-ex
166 type: patch
167 options: {peer=int-br-ex}
168 Port "eth0"
169 Interface "eth0"
170 Port br-ex
171 Interface br-ex
172 type: internal
173 Bridge br-int
174 fail_mode: secure
175 Port "tapce66332d-ea"
176 tag: 1
177 Interface "tapce66332d-ea"
178 type: internal
179 Port "qg-65e5a4b9-15"
180 tag: 2
181 Interface "qg-65e5a4b9-15"
182 type: internal
183 Port "qr-33e5e471-88"
184 tag: 1
185 Interface "qr-33e5e471-88"
186 type: internal
187 Port "qr-acbe9951-70"
188 tag: 1
189 Interface "qr-acbe9951-70"
190 type: internal
191 Port br-int
192 Interface br-int
193 type: internal
194 Port patch-tun
195 Interface patch-tun
196 type: patch
197 options: {peer=patch-int}
198 Port int-br-ex
199 Interface int-br-ex
200 type: patch
201 options: {peer=phy-br-ex}
202 ovs_version: "2.0.2"
203
204`br-int` is a bridge that the Open vSwitch mechanism driver creates,
205which is used as the "integration bridge" where ports are created, and
206plugged into the virtual switching fabric. `br-ex` is an OVS bridge
207that is used to connect physical ports (like `eth0`), so that floating
208IP traffic for tenants can be received from the physical network
209infrastructure (and the internet), and routed to tenant network ports.
210`br-tun` is a tunnel bridge that is used to connect OpenStack nodes
211(like `devstack-2`) together. This bridge is used so that tenant
212network traffic, using the VXLAN tunneling protocol, flows between
213each compute node where tenant instances run.
214
215
216
217DevStack Compute Configuration
218~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
219
220The host `devstack-2` has a very minimal `local.conf`.
221
222::
223
224 [[local|localrc]]
225 HOST_IP=172.18.161.7
226 SERVICE_HOST=172.18.161.6
227 MYSQL_HOST=172.18.161.6
228 RABBIT_HOST=172.18.161.6
229 GLANCE_HOSTPORT=172.18.161.6:9292
230 ADMIN_PASSWORD=secrete
231 MYSQL_PASSWORD=secrete
232 RABBIT_PASSWORD=secrete
233 SERVICE_PASSWORD=secrete
234 SERVICE_TOKEN=secrete
235
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
357 SERVICE_HOST=10.0.0.2
358 MYSQL_HOST=10.0.0.2
359 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
367 SERVICE_TOKEN=secrete
368
Sean M. Collins34296012014-10-27 11:57:20 -0400369 ## Neutron options
370 Q_USE_SECGROUP=True
371 ENABLE_TENANT_VLANS=True
372 TENANT_VLAN_RANGE=3001:4000
373 PHYSICAL_NETWORK=default
374 OVS_PHYSICAL_BRIDGE=br-ex
375
376 Q_USE_PROVIDER_NETWORKING=True
377 Q_L3_ENABLED=False
378
379 # Do not use Nova-Network
380 disable_service n-net
381
382 # Neutron
383 ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt
384
385 ## Neutron Networking options used to create Neutron Subnets
386
Sean M. Collinsd72b8392015-06-18 12:40:09 -0400387 FIXED_RANGE="203.0.113.0/24"
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
Sean M. Collins611cab42015-10-09 12:54:32 -0400400The following is the DevStack configuration on
401compute 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
408 SERVICE_HOST=10.0.0.2
409 MYSQL_HOST=10.0.0.2
410 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
416 SERVICE_TOKEN=secrete
417
Sean M. Collins34296012014-10-27 11:57:20 -0400418 # Services that a compute node runs
419 ENABLED_SERVICES=n-cpu,rabbit,q-agt
420
421 ## Neutron options
Sean M. Collins34296012014-10-27 11:57:20 -0400422 PHYSICAL_NETWORK=default
423 OVS_PHYSICAL_BRIDGE=br-ex
424 PUBLIC_INTERFACE=eth1
425 Q_USE_PROVIDER_NETWORKING=True
426 Q_L3_ENABLED=False
427
Sean M. Collins611cab42015-10-09 12:54:32 -0400428Compute node 2's configuration will be exactly the same, except
Markus Zoellerc30657d2015-11-02 11:27:46 +0100429``HOST_IP`` will be ``10.0.0.4``
Sean M. Collins611cab42015-10-09 12:54:32 -0400430
Sean M. Collins34296012014-10-27 11:57:20 -0400431When DevStack is configured to use provider networking (via
Markus Zoellerc30657d2015-11-02 11:27:46 +0100432``Q_USE_PROVIDER_NETWORKING`` is True and ``Q_L3_ENABLED`` is False) -
Sean M. Collins34296012014-10-27 11:57:20 -0400433DevStack will automatically add the network interface defined in
Markus Zoellerc30657d2015-11-02 11:27:46 +0100434``PUBLIC_INTERFACE`` to the ``OVS_PHYSICAL_BRIDGE``
Sean M. Collins34296012014-10-27 11:57:20 -0400435
436For example, with the above configuration, a bridge is
Markus Zoellerc30657d2015-11-02 11:27:46 +0100437created, named ``br-ex`` which is managed by Open vSwitch, and the
438second interface on the compute node, ``eth1`` is attached to the
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400439bridge, to forward traffic sent by guest VMs.
Sean M. Collins872a2622015-10-06 12:45:06 -0400440
441Miscellaneous Tips
442==================
443
444
445Disabling Next Generation Firewall Tools
446----------------------------------------
447
448DevStack does not properly operate with modern firewall tools. Specifically
449it will appear as if the guest VM can access the external network via ICMP,
450but UDP and TCP packets will not be delivered to the guest VM. The root cause
451of the issue is that both ufw (Uncomplicated Firewall) and firewalld (Fedora's
452firewall manager) apply firewall rules to all interfaces in the system, rather
453then per-device. One solution to this problem is to revert to iptables
454functionality.
455
456To get a functional firewall configuration for Fedora do the following:
457
458::
459
460 sudo service iptables save
461 sudo systemctl disable firewalld
462 sudo systemctl enable iptables
463 sudo systemctl stop firewalld
464 sudo systemctl start iptables
465
466
467To get a functional firewall configuration for distributions containing ufw,
468disable ufw. Note ufw is generally not enabled by default in Ubuntu. To
469disable ufw if it was enabled, do the following:
470
471::
472
473 sudo service iptables save
474 sudo ufw disable
475
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400476Configuring Extension Drivers for the ML2 Plugin
477------------------------------------------------
Sean M. Collins872a2622015-10-06 12:45:06 -0400478
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400479Extension drivers for the ML2 plugin are set with the variable
Markus Zoellerc30657d2015-11-02 11:27:46 +0100480``Q_ML2_PLUGIN_EXT_DRIVERS``, and includes the 'port_security' extension
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400481by default. If you want to remove all the extension drivers (even
Markus Zoellerc30657d2015-11-02 11:27:46 +0100482'port_security'), set ``Q_ML2_PLUGIN_EXT_DRIVERS`` to blank.
Sean M. Collins872a2622015-10-06 12:45:06 -0400483