blob: 84295a50cec9e9d40b24ab32b61cec9f355cbadb [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
Sean M. Collins02ae50d2015-03-20 09:58:55 -070062
Sean M. Collins16501662015-10-12 11:01:44 -040063 # Do not use Nova-Network
64 disable_service n-net
65 # Enable Neutron
66 ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt,q-l3
67
68
Sean M. Collins02ae50d2015-03-20 09:58:55 -070069 ## Neutron options
70 Q_USE_SECGROUP=True
Christian Berendt1c394822015-09-10 12:15:16 +020071 FLOATING_RANGE="172.18.161.0/24"
Sean M. Collins02ae50d2015-03-20 09:58:55 -070072 FIXED_RANGE="10.0.0.0/24"
73 Q_FLOATING_ALLOCATION_POOL=start=172.18.161.250,end=172.18.161.254
74 PUBLIC_NETWORK_GATEWAY="172.18.161.1"
75 Q_L3_ENABLED=True
76 PUBLIC_INTERFACE=eth0
77 Q_USE_PROVIDERNET_FOR_PUBLIC=True
78 OVS_PHYSICAL_BRIDGE=br-ex
79 PUBLIC_BRIDGE=br-ex
80 OVS_BRIDGE_MAPPINGS=public:br-ex
81
82
Sean M. Collins16501662015-10-12 11:01:44 -040083Adding Additional Compute Nodes
84-------------------------------
85
86Let's suppose that after installing DevStack on the first host, you
87also want to do multinode testing and networking.
88
89Physical Network Setup
90~~~~~~~~~~~~~~~~~~~~~~
91
92.. nwdiag::
93
94 nwdiag {
95 inet [ shape = cloud ];
96 router;
97 inet -- router;
98
99 network hardware_network {
100 address = "172.18.161.0/24"
101 router [ address = "172.18.161.1" ];
102 devstack-1 [ address = "172.18.161.6" ];
103 devstack-2 [ address = "172.18.161.7" ];
104 }
105 }
106
107
108After DevStack installs and configures Neutron, traffic from guest VMs
109flows out of `devstack-2` (the compute node) and is encapsulated in a
110VXLAN tunnel back to `devstack-1` (the control node) where the L3
111agent is running.
112
113::
114
115 stack@devstack-2:~/devstack$ sudo ovs-vsctl show
116 8992d965-0ba0-42fd-90e9-20ecc528bc29
117 Bridge br-int
118 fail_mode: secure
119 Port br-int
120 Interface br-int
121 type: internal
122 Port patch-tun
123 Interface patch-tun
124 type: patch
125 options: {peer=patch-int}
126 Bridge br-tun
127 fail_mode: secure
128 Port "vxlan-c0a801f6"
129 Interface "vxlan-c0a801f6"
130 type: vxlan
131 options: {df_default="true", in_key=flow, local_ip="172.18.161.7", out_key=flow, remote_ip="172.18.161.6"}
132 Port patch-int
133 Interface patch-int
134 type: patch
135 options: {peer=patch-tun}
136 Port br-tun
137 Interface br-tun
138 type: internal
139 ovs_version: "2.0.2"
140
141Open vSwitch on the control node, where the L3 agent runs, is
142configured to de-encapsulate traffic from compute nodes, then forward
143it over the `br-ex` bridge, where `eth0` is attached.
144
145::
146
147 stack@devstack-1:~/devstack$ sudo ovs-vsctl show
148 422adeea-48d1-4a1f-98b1-8e7239077964
149 Bridge br-tun
150 fail_mode: secure
151 Port br-tun
152 Interface br-tun
153 type: internal
154 Port patch-int
155 Interface patch-int
156 type: patch
157 options: {peer=patch-tun}
158 Port "vxlan-c0a801d8"
159 Interface "vxlan-c0a801d8"
160 type: vxlan
161 options: {df_default="true", in_key=flow, local_ip="172.18.161.6", out_key=flow, remote_ip="172.18.161.7"}
162 Bridge br-ex
163 Port phy-br-ex
164 Interface phy-br-ex
165 type: patch
166 options: {peer=int-br-ex}
167 Port "eth0"
168 Interface "eth0"
169 Port br-ex
170 Interface br-ex
171 type: internal
172 Bridge br-int
173 fail_mode: secure
174 Port "tapce66332d-ea"
175 tag: 1
176 Interface "tapce66332d-ea"
177 type: internal
178 Port "qg-65e5a4b9-15"
179 tag: 2
180 Interface "qg-65e5a4b9-15"
181 type: internal
182 Port "qr-33e5e471-88"
183 tag: 1
184 Interface "qr-33e5e471-88"
185 type: internal
186 Port "qr-acbe9951-70"
187 tag: 1
188 Interface "qr-acbe9951-70"
189 type: internal
190 Port br-int
191 Interface br-int
192 type: internal
193 Port patch-tun
194 Interface patch-tun
195 type: patch
196 options: {peer=patch-int}
197 Port int-br-ex
198 Interface int-br-ex
199 type: patch
200 options: {peer=phy-br-ex}
201 ovs_version: "2.0.2"
202
203`br-int` is a bridge that the Open vSwitch mechanism driver creates,
204which is used as the "integration bridge" where ports are created, and
205plugged into the virtual switching fabric. `br-ex` is an OVS bridge
206that is used to connect physical ports (like `eth0`), so that floating
207IP traffic for tenants can be received from the physical network
208infrastructure (and the internet), and routed to tenant network ports.
209`br-tun` is a tunnel bridge that is used to connect OpenStack nodes
210(like `devstack-2`) together. This bridge is used so that tenant
211network traffic, using the VXLAN tunneling protocol, flows between
212each compute node where tenant instances run.
213
214
215
216DevStack Compute Configuration
217~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
218
219The host `devstack-2` has a very minimal `local.conf`.
220
221::
222
223 [[local|localrc]]
224 HOST_IP=172.18.161.7
225 SERVICE_HOST=172.18.161.6
226 MYSQL_HOST=172.18.161.6
227 RABBIT_HOST=172.18.161.6
228 GLANCE_HOSTPORT=172.18.161.6:9292
229 ADMIN_PASSWORD=secrete
230 MYSQL_PASSWORD=secrete
231 RABBIT_PASSWORD=secrete
232 SERVICE_PASSWORD=secrete
Sean M. Collins16501662015-10-12 11:01:44 -0400233
234 ## Neutron options
235 PUBLIC_INTERFACE=eth0
236 ENABLED_SERVICES=n-cpu,rabbit,q-agt
237
238Network traffic from `eth0` on the compute nodes is then NAT'd by the
239controller node that runs Neutron's `neutron-l3-agent` and provides L3
240connectivity.
241
Sean M. Collins02ae50d2015-03-20 09:58:55 -0700242
Sean M. Collins34296012014-10-27 11:57:20 -0400243Neutron Networking with Open vSwitch and Provider Networks
244==========================================================
245
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400246In some instances, it is desirable to use neutron's provider
Sean M. Collins34296012014-10-27 11:57:20 -0400247networking extension, so that networks that are configured on an
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400248external router can be utilized by neutron, and instances created via
Sean M. Collins34296012014-10-27 11:57:20 -0400249Nova can attach to the network managed by the external router.
250
251For example, in some lab environments, a hardware router has been
252pre-configured by another party, and an OpenStack developer has been
253given a VLAN tag and IP address range, so that instances created via
254DevStack will use the external router for L3 connectivity, as opposed
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400255to the neutron L3 service.
Sean M. Collins34296012014-10-27 11:57:20 -0400256
Sean M. Collins4696db92015-10-09 12:31:57 -0400257Physical Network Setup
258----------------------
259
260.. nwdiag::
261
262 nwdiag {
263 inet [ shape = cloud ];
264 router;
265 inet -- router;
266
267 network provider_net {
268 address = "203.0.113.0/24"
269 router [ address = "203.0.113.1" ];
270 controller;
271 compute1;
272 compute2;
273 }
274
275 network control_plane {
276 router [ address = "10.0.0.1" ]
277 address = "10.0.0.0/24"
278 controller [ address = "10.0.0.2" ]
279 compute1 [ address = "10.0.0.3" ]
280 compute2 [ address = "10.0.0.4" ]
281 }
282 }
283
284
Sean M. Collins887f1822015-10-12 10:36:34 -0400285On a compute node, the first interface, eth0 is used for the OpenStack
286management (API, message bus, etc) as well as for ssh for an
287administrator to access the machine.
288
289::
290
291 stack@compute:~$ ifconfig eth0
292 eth0 Link encap:Ethernet HWaddr bc:16:65:20:af:fc
293 inet addr:10.0.0.3
294
295eth1 is manually configured at boot to not have an IP address.
296Consult your operating system documentation for the appropriate
297technique. For Ubuntu, the contents of `/etc/network/interfaces`
298contains:
299
300::
301
302 auto eth1
303 iface eth1 inet manual
304 up ifconfig $IFACE 0.0.0.0 up
305 down ifconfig $IFACE 0.0.0.0 down
306
307The second physical interface, eth1 is added to a bridge (in this case
308named br-ex), which is used to forward network traffic from guest VMs.
309
310::
311
312 stack@compute:~$ sudo ovs-vsctl add-br br-ex
313 stack@compute:~$ sudo ovs-vsctl add-port br-ex eth1
314 stack@compute:~$ sudo ovs-vsctl show
315 9a25c837-32ab-45f6-b9f2-1dd888abcf0f
316 Bridge br-ex
317 Port br-ex
318 Interface br-ex
319 type: internal
320 Port phy-br-ex
321 Interface phy-br-ex
322 type: patch
323 options: {peer=int-br-ex}
324 Port "eth1"
325 Interface "eth1"
326
Sean M. Collins34296012014-10-27 11:57:20 -0400327
328Service Configuration
329---------------------
330
331**Control Node**
332
333In this example, the control node will run the majority of the
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400334OpenStack API and management services (keystone, glance,
335nova, neutron)
Sean M. Collins34296012014-10-27 11:57:20 -0400336
337
338**Compute Nodes**
339
340In this example, the nodes that will host guest instances will run
Markus Zoellerc30657d2015-11-02 11:27:46 +0100341the ``neutron-openvswitch-agent`` for network connectivity, as well as
342the compute service ``nova-compute``.
Sean M. Collins34296012014-10-27 11:57:20 -0400343
344DevStack Configuration
345----------------------
346
347The following is a snippet of the DevStack configuration on the
348controller node.
349
350::
351
Sean M. Collins611cab42015-10-09 12:54:32 -0400352 HOST_IP=10.0.0.2
353 SERVICE_HOST=10.0.0.2
354 MYSQL_HOST=10.0.0.2
Sean M. Collins611cab42015-10-09 12:54:32 -0400355 RABBIT_HOST=10.0.0.2
356 GLANCE_HOSTPORT=10.0.0.2:9292
Sean M. Collins34296012014-10-27 11:57:20 -0400357 PUBLIC_INTERFACE=eth1
358
Sean M. Collins611cab42015-10-09 12:54:32 -0400359 ADMIN_PASSWORD=secrete
360 MYSQL_PASSWORD=secrete
361 RABBIT_PASSWORD=secrete
362 SERVICE_PASSWORD=secrete
Sean M. Collins611cab42015-10-09 12:54:32 -0400363
Sean M. Collins34296012014-10-27 11:57:20 -0400364 ## Neutron options
365 Q_USE_SECGROUP=True
366 ENABLE_TENANT_VLANS=True
367 TENANT_VLAN_RANGE=3001:4000
368 PHYSICAL_NETWORK=default
369 OVS_PHYSICAL_BRIDGE=br-ex
370
371 Q_USE_PROVIDER_NETWORKING=True
372 Q_L3_ENABLED=False
373
374 # Do not use Nova-Network
375 disable_service n-net
376
377 # Neutron
378 ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt
379
380 ## Neutron Networking options used to create Neutron Subnets
381
Sean M. Collinsd72b8392015-06-18 12:40:09 -0400382 FIXED_RANGE="203.0.113.0/24"
syed ahsan shamim zaidi512be7d2015-10-20 21:20:27 +0000383 NETWORK_GATEWAY=203.0.113.1
Sean M. Collins34296012014-10-27 11:57:20 -0400384 PROVIDER_SUBNET_NAME="provider_net"
385 PROVIDER_NETWORK_TYPE="vlan"
386 SEGMENTATION_ID=2010
387
388In this configuration we are defining FIXED_RANGE to be a
Sean M. Collinsd72b8392015-06-18 12:40:09 -0400389publicly routed IPv4 subnet. In this specific instance we are using
390the special TEST-NET-3 subnet defined in `RFC 5737 <http://tools.ietf.org/html/rfc5737>`_,
391which is used for documentation. In your DevStack setup, FIXED_RANGE
392would be a public IP address range that you or your organization has
393allocated to you, so that you could access your instances from the
394public internet.
Sean M. Collins34296012014-10-27 11:57:20 -0400395
John Kasperskibdc0fa82015-11-23 11:56:33 -0600396The following is the DevStack configuration on
Sean M. Collins611cab42015-10-09 12:54:32 -0400397compute node 1.
Sean M. Collins34296012014-10-27 11:57:20 -0400398
399::
400
Sean M. Collins611cab42015-10-09 12:54:32 -0400401 HOST_IP=10.0.0.3
402 SERVICE_HOST=10.0.0.2
403 MYSQL_HOST=10.0.0.2
Sean M. Collins611cab42015-10-09 12:54:32 -0400404 RABBIT_HOST=10.0.0.2
405 GLANCE_HOSTPORT=10.0.0.2:9292
406 ADMIN_PASSWORD=secrete
407 MYSQL_PASSWORD=secrete
408 RABBIT_PASSWORD=secrete
409 SERVICE_PASSWORD=secrete
Sean M. Collins611cab42015-10-09 12:54:32 -0400410
Sean M. Collins34296012014-10-27 11:57:20 -0400411 # Services that a compute node runs
412 ENABLED_SERVICES=n-cpu,rabbit,q-agt
413
414 ## Neutron options
Sean M. Collins34296012014-10-27 11:57:20 -0400415 PHYSICAL_NETWORK=default
416 OVS_PHYSICAL_BRIDGE=br-ex
417 PUBLIC_INTERFACE=eth1
418 Q_USE_PROVIDER_NETWORKING=True
419 Q_L3_ENABLED=False
420
Sean M. Collins611cab42015-10-09 12:54:32 -0400421Compute node 2's configuration will be exactly the same, except
Markus Zoellerc30657d2015-11-02 11:27:46 +0100422``HOST_IP`` will be ``10.0.0.4``
Sean M. Collins611cab42015-10-09 12:54:32 -0400423
Sean M. Collins34296012014-10-27 11:57:20 -0400424When DevStack is configured to use provider networking (via
Markus Zoellerc30657d2015-11-02 11:27:46 +0100425``Q_USE_PROVIDER_NETWORKING`` is True and ``Q_L3_ENABLED`` is False) -
Sean M. Collins34296012014-10-27 11:57:20 -0400426DevStack will automatically add the network interface defined in
Markus Zoellerc30657d2015-11-02 11:27:46 +0100427``PUBLIC_INTERFACE`` to the ``OVS_PHYSICAL_BRIDGE``
Sean M. Collins34296012014-10-27 11:57:20 -0400428
429For example, with the above configuration, a bridge is
Markus Zoellerc30657d2015-11-02 11:27:46 +0100430created, named ``br-ex`` which is managed by Open vSwitch, and the
431second interface on the compute node, ``eth1`` is attached to the
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400432bridge, to forward traffic sent by guest VMs.
Sean M. Collins872a2622015-10-06 12:45:06 -0400433
434Miscellaneous Tips
435==================
436
437
438Disabling Next Generation Firewall Tools
439----------------------------------------
440
441DevStack does not properly operate with modern firewall tools. Specifically
442it will appear as if the guest VM can access the external network via ICMP,
443but UDP and TCP packets will not be delivered to the guest VM. The root cause
444of the issue is that both ufw (Uncomplicated Firewall) and firewalld (Fedora's
445firewall manager) apply firewall rules to all interfaces in the system, rather
446then per-device. One solution to this problem is to revert to iptables
447functionality.
448
449To get a functional firewall configuration for Fedora do the following:
450
451::
452
453 sudo service iptables save
454 sudo systemctl disable firewalld
455 sudo systemctl enable iptables
456 sudo systemctl stop firewalld
457 sudo systemctl start iptables
458
459
460To get a functional firewall configuration for distributions containing ufw,
461disable ufw. Note ufw is generally not enabled by default in Ubuntu. To
462disable ufw if it was enabled, do the following:
463
464::
465
466 sudo service iptables save
467 sudo ufw disable
468
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400469Configuring Extension Drivers for the ML2 Plugin
470------------------------------------------------
Sean M. Collins872a2622015-10-06 12:45:06 -0400471
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400472Extension drivers for the ML2 plugin are set with the variable
Markus Zoellerc30657d2015-11-02 11:27:46 +0100473``Q_ML2_PLUGIN_EXT_DRIVERS``, and includes the 'port_security' extension
Sean M. Collinsd8aa10e2015-10-09 12:21:30 -0400474by default. If you want to remove all the extension drivers (even
Markus Zoellerc30657d2015-11-02 11:27:46 +0100475'port_security'), set ``Q_ML2_PLUGIN_EXT_DRIVERS`` to blank.
Sean M. Collins872a2622015-10-06 12:45:06 -0400476