Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 1 | ====================================== |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 2 | Using DevStack with neutron Networking |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 3 | ====================================== |
| 4 | |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 5 | This guide will walk you through using OpenStack neutron with the ML2 |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 6 | plugin and the Open vSwitch mechanism driver. |
| 7 | |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 8 | |
Sean M. Collins | 02ae50d | 2015-03-20 09:58:55 -0700 | [diff] [blame^] | 9 | Using Neutron with a Single Interface |
| 10 | ===================================== |
| 11 | |
| 12 | In some instances, like on a developer laptop, there is only one |
| 13 | network interface that is available. In this scenario, the physical |
| 14 | interface is added to the Open vSwitch bridge, and the IP address of |
| 15 | the laptop is migrated onto the bridge interface. That way, the |
| 16 | physical interface can be used to transmit tenant network traffic, |
| 17 | the OpenStack API traffic, and management traffic. |
| 18 | |
| 19 | |
| 20 | Physical Network Setup |
| 21 | ---------------------- |
| 22 | |
| 23 | In most cases where DevStack is being deployed with a single |
| 24 | interface, there is a hardware router that is being used for external |
| 25 | connectivity and DHCP. The developer machine is connected to this |
| 26 | network 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" ]; |
| 38 | devstack_laptop [ address = "172.18.161.6" ]; |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | |
| 43 | DevStack Configuration |
| 44 | ---------------------- |
| 45 | |
| 46 | |
| 47 | :: |
| 48 | |
| 49 | HOST_IP=172.18.161.6 |
| 50 | SERVICE_HOST=172.18.161.6 |
| 51 | MYSQL_HOST=172.18.161.6 |
| 52 | RABBIT_HOST=172.18.161.6 |
| 53 | GLANCE_HOSTPORT=172.18.161.6:9292 |
| 54 | ADMIN_PASSWORD=secrete |
| 55 | MYSQL_PASSWORD=secrete |
| 56 | RABBIT_PASSWORD=secrete |
| 57 | SERVICE_PASSWORD=secrete |
| 58 | SERVICE_TOKEN=secrete |
| 59 | |
| 60 | ## Neutron options |
| 61 | Q_USE_SECGROUP=True |
| 62 | FLOATING_RANGE="172.18.161.1/24" |
| 63 | FIXED_RANGE="10.0.0.0/24" |
| 64 | Q_FLOATING_ALLOCATION_POOL=start=172.18.161.250,end=172.18.161.254 |
| 65 | PUBLIC_NETWORK_GATEWAY="172.18.161.1" |
| 66 | Q_L3_ENABLED=True |
| 67 | PUBLIC_INTERFACE=eth0 |
| 68 | Q_USE_PROVIDERNET_FOR_PUBLIC=True |
| 69 | OVS_PHYSICAL_BRIDGE=br-ex |
| 70 | PUBLIC_BRIDGE=br-ex |
| 71 | OVS_BRIDGE_MAPPINGS=public:br-ex |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | Using Neutron with Multiple Interfaces |
| 78 | ====================================== |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 79 | |
| 80 | The first interface, eth0 is used for the OpenStack management (API, |
| 81 | message bus, etc) as well as for ssh for an administrator to access |
| 82 | the machine. |
| 83 | |
| 84 | :: |
| 85 | |
| 86 | stack@compute:~$ ifconfig eth0 |
| 87 | eth0 Link encap:Ethernet HWaddr bc:16:65:20:af:fc |
| 88 | inet addr:192.168.1.18 |
| 89 | |
| 90 | eth1 is manually configured at boot to not have an IP address. |
| 91 | Consult your operating system documentation for the appropriate |
Juan Antonio Osorio Robles | b7c1ce4 | 2014-11-28 14:19:19 +0200 | [diff] [blame] | 92 | technique. For Ubuntu, the contents of `/etc/network/interfaces` |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 93 | contains: |
| 94 | |
| 95 | :: |
| 96 | |
| 97 | auto eth1 |
| 98 | iface eth1 inet manual |
| 99 | up ifconfig $IFACE 0.0.0.0 up |
| 100 | down ifconfig $IFACE 0.0.0.0 down |
| 101 | |
| 102 | The second physical interface, eth1 is added to a bridge (in this case |
| 103 | named br-ex), which is used to forward network traffic from guest VMs. |
| 104 | Network traffic from eth1 on the compute nodes is then NAT'd by the |
| 105 | controller node that runs Neutron's `neutron-l3-agent` and provides L3 |
| 106 | connectivity. |
| 107 | |
| 108 | :: |
| 109 | |
| 110 | stack@compute:~$ sudo ovs-vsctl add-br br-ex |
| 111 | stack@compute:~$ sudo ovs-vsctl add-port br-ex eth1 |
| 112 | stack@compute:~$ sudo ovs-vsctl show |
| 113 | 9a25c837-32ab-45f6-b9f2-1dd888abcf0f |
| 114 | Bridge br-ex |
| 115 | Port br-ex |
| 116 | Interface br-ex |
| 117 | type: internal |
| 118 | Port phy-br-ex |
| 119 | Interface phy-br-ex |
| 120 | type: patch |
| 121 | options: {peer=int-br-ex} |
| 122 | Port "eth1" |
| 123 | Interface "eth1" |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
Steven Dake | 3a6b128 | 2014-12-31 14:27:22 -0700 | [diff] [blame] | 128 | Disabling Next Generation Firewall Tools |
| 129 | ======================================== |
| 130 | |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 131 | DevStack does not properly operate with modern firewall tools. Specifically |
Steven Dake | 3a6b128 | 2014-12-31 14:27:22 -0700 | [diff] [blame] | 132 | it will appear as if the guest VM can access the external network via ICMP, |
| 133 | but UDP and TCP packets will not be delivered to the guest VM. The root cause |
| 134 | of the issue is that both ufw (Uncomplicated Firewall) and firewalld (Fedora's |
| 135 | firewall manager) apply firewall rules to all interfaces in the system, rather |
| 136 | then per-device. One solution to this problem is to revert to iptables |
| 137 | functionality. |
| 138 | |
| 139 | To get a functional firewall configuration for Fedora do the following: |
| 140 | |
| 141 | :: |
| 142 | |
| 143 | sudo service iptables save |
| 144 | sudo systemctl disable firewalld |
| 145 | sudo systemctl enable iptables |
| 146 | sudo systemctl stop firewalld |
| 147 | sudo systemctl start iptables |
| 148 | |
| 149 | |
| 150 | To get a functional firewall configuration for distributions containing ufw, |
| 151 | disable ufw. Note ufw is generally not enabled by default in Ubuntu. To |
| 152 | disable ufw if it was enabled, do the following: |
| 153 | |
| 154 | :: |
| 155 | |
| 156 | sudo service iptables save |
| 157 | sudo ufw disable |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 162 | Neutron Networking with Open vSwitch |
| 163 | ==================================== |
| 164 | |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 165 | Configuring neutron, OpenStack Networking in DevStack is very similar to |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 166 | configuring `nova-network` - many of the same configuration variables |
| 167 | (like `FIXED_RANGE` and `FLOATING_RANGE`) used by `nova-network` are |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 168 | used by neutron, which is intentional. |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 169 | |
| 170 | The only difference is the disabling of `nova-network` in your |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 171 | local.conf, and the enabling of the neutron components. |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 172 | |
| 173 | |
| 174 | Configuration |
| 175 | ------------- |
| 176 | |
| 177 | :: |
| 178 | |
| 179 | FIXED_RANGE=10.0.0.0/24 |
| 180 | FLOATING_RANGE=192.168.27.0/24 |
| 181 | PUBLIC_NETWORK_GATEWAY=192.168.27.2 |
| 182 | |
| 183 | disable_service n-net |
| 184 | enable_service q-svc |
| 185 | enable_service q-agt |
| 186 | enable_service q-dhcp |
| 187 | enable_service q-meta |
| 188 | enable_service q-l3 |
| 189 | |
| 190 | Q_USE_SECGROUP=True |
| 191 | ENABLE_TENANT_VLANS=True |
| 192 | TENANT_VLAN_RANGE=1000:1999 |
| 193 | PHYSICAL_NETWORK=default |
| 194 | OVS_PHYSICAL_BRIDGE=br-ex |
| 195 | |
| 196 | In this configuration we are defining FLOATING_RANGE to be a |
| 197 | subnet that exists in the private RFC1918 address space - however in |
| 198 | in a real setup FLOATING_RANGE would be a public IP address range. |
| 199 | |
Yalei Wang | a48e5dc | 2015-03-06 17:05:11 +0800 | [diff] [blame] | 200 | Note that extension drivers for the ML2 plugin is set by |
| 201 | `Q_ML2_PLUGIN_EXT_DRIVERS`, and it includes 'port_security' by default. If you |
| 202 | want to remove all the extension drivers (even 'port_security'), set |
| 203 | `Q_ML2_PLUGIN_EXT_DRIVERS` to blank. |
| 204 | |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 205 | Neutron Networking with Open vSwitch and Provider Networks |
| 206 | ========================================================== |
| 207 | |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 208 | In some instances, it is desirable to use neutron's provider |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 209 | networking extension, so that networks that are configured on an |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 210 | external router can be utilized by neutron, and instances created via |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 211 | Nova can attach to the network managed by the external router. |
| 212 | |
| 213 | For example, in some lab environments, a hardware router has been |
| 214 | pre-configured by another party, and an OpenStack developer has been |
| 215 | given a VLAN tag and IP address range, so that instances created via |
| 216 | DevStack will use the external router for L3 connectivity, as opposed |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 217 | to the neutron L3 service. |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 218 | |
| 219 | |
| 220 | Service Configuration |
| 221 | --------------------- |
| 222 | |
| 223 | **Control Node** |
| 224 | |
| 225 | In this example, the control node will run the majority of the |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 226 | OpenStack API and management services (keystone, glance, |
| 227 | nova, neutron) |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 228 | |
| 229 | |
| 230 | **Compute Nodes** |
| 231 | |
| 232 | In this example, the nodes that will host guest instances will run |
| 233 | the `neutron-openvswitch-agent` for network connectivity, as well as |
| 234 | the compute service `nova-compute`. |
| 235 | |
| 236 | DevStack Configuration |
| 237 | ---------------------- |
| 238 | |
| 239 | The following is a snippet of the DevStack configuration on the |
| 240 | controller node. |
| 241 | |
| 242 | :: |
| 243 | |
| 244 | PUBLIC_INTERFACE=eth1 |
| 245 | |
| 246 | ## Neutron options |
| 247 | Q_USE_SECGROUP=True |
| 248 | ENABLE_TENANT_VLANS=True |
| 249 | TENANT_VLAN_RANGE=3001:4000 |
| 250 | PHYSICAL_NETWORK=default |
| 251 | OVS_PHYSICAL_BRIDGE=br-ex |
| 252 | |
| 253 | Q_USE_PROVIDER_NETWORKING=True |
| 254 | Q_L3_ENABLED=False |
| 255 | |
| 256 | # Do not use Nova-Network |
| 257 | disable_service n-net |
| 258 | |
| 259 | # Neutron |
| 260 | ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt |
| 261 | |
| 262 | ## Neutron Networking options used to create Neutron Subnets |
| 263 | |
| 264 | FIXED_RANGE="10.1.1.0/24" |
| 265 | PROVIDER_SUBNET_NAME="provider_net" |
| 266 | PROVIDER_NETWORK_TYPE="vlan" |
| 267 | SEGMENTATION_ID=2010 |
| 268 | |
| 269 | In this configuration we are defining FIXED_RANGE to be a |
Kennan | 3566310 | 2015-01-20 16:19:49 +0800 | [diff] [blame] | 270 | subnet that exists in the private RFC1918 address space - however |
Sean M. Collins | 3429601 | 2014-10-27 11:57:20 -0400 | [diff] [blame] | 271 | in a real setup FIXED_RANGE would be a public IP address range, so |
| 272 | that you could access your instances from the public internet. |
| 273 | |
| 274 | The following is a snippet of the DevStack configuration on the |
| 275 | compute node. |
| 276 | |
| 277 | :: |
| 278 | |
| 279 | # Services that a compute node runs |
| 280 | ENABLED_SERVICES=n-cpu,rabbit,q-agt |
| 281 | |
| 282 | ## Neutron options |
| 283 | Q_USE_SECGROUP=True |
| 284 | ENABLE_TENANT_VLANS=True |
| 285 | TENANT_VLAN_RANGE=3001:4000 |
| 286 | PHYSICAL_NETWORK=default |
| 287 | OVS_PHYSICAL_BRIDGE=br-ex |
| 288 | PUBLIC_INTERFACE=eth1 |
| 289 | Q_USE_PROVIDER_NETWORKING=True |
| 290 | Q_L3_ENABLED=False |
| 291 | |
| 292 | When DevStack is configured to use provider networking (via |
| 293 | `Q_USE_PROVIDER_NETWORKING` is True and `Q_L3_ENABLED` is False) - |
| 294 | DevStack will automatically add the network interface defined in |
| 295 | `PUBLIC_INTERFACE` to the `OVS_PHYSICAL_BRIDGE` |
| 296 | |
| 297 | For example, with the above configuration, a bridge is |
| 298 | created, named `br-ex` which is managed by Open vSwitch, and the |
| 299 | second interface on the compute node, `eth1` is attached to the |
Shilla Saebi | 2ed09d8 | 2015-04-21 15:02:13 -0400 | [diff] [blame] | 300 | bridge, to forward traffic sent by guest VMs. |