OpenStack Networking Cookbook
上QQ阅读APP看书,第一时间看更新

Configuring Neutron to use the Linux bridge mechanism driver

The ML2 plugin can support many mechanisms in order to provide the core functionality. We will see how a Linux bridge can act as a mechanism driver for the ML2 plugin. This recipe shows you how to configure an ML2 plugin with a Linux bridge as the mechanism driver.

Getting ready

Configuring ML2 to use a Linux bridge as the mechanism driver requires changes to the ML2 plugin configuration file. We will also have to configure the Linux bridge with a tenant network type and the alias for the Linux bridge that is bound to the physical network adapter of the node.

How to do it…

The following steps will show you how to configure Linux as the mechanism driver for the ML2 plugin:

  1. With the appropriate credentials, SSH into the node where the Neutron server is running. In our setup, it will be the Controller and Network node.
  2. Open the Neutron ML2 plugin configuration file using your desired editor. For example, the command for vi editor will be as follows:
    openstack@controller:~$ sudo vi /etc/neutron/plugins/ml2/ml2_conf.ini
    
  3. In the [ml2] section of the file, configure ML2 to use the Linux bridge as the mechanism driver:
    [ml2]
    . . .
    mechanism_drivers = linuxbridge
  4. In the [linux_bridge] section of the file, configure the Linux bridge with the tenant network type and physical interface mapping:
    [linux_bridge]
    tenant_network_type = vlan
    physical_interface_mappings = physnet1:eth1
  5. In the previous step, physnet1 represents the alias and eth1 represents the physical interface that is added to the Linux bridge instance.
  6. Restart the Neutron server and Linux bridge agent on Controller and Network node of our setup using the following commands:
    openstack@controller:~$ sudo service neutron-server restart
    openstack@controller:~$ sudo service neutron-plugin-linuxbridge-agent restart
  7. Steps 2 to 5 have to be repeated for the compute node in our setup. On the compute node only the Linux bridge agent needs to be restarted.
  8. On the Network node, a few changes are needed so that the Neutron agents can use Linux bridge-related drivers.
  9. Edit the [DEFAULT] section of the DHCP agent configuration file located at /etc/neutron/dhcp_agent.ini on the network node, as follows:
    [DEFAULT]
    …
    interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
  10. Edit the [DEFAULT] section of the L3 agent configuration file located at /etc/neutron/l3_agent.ini on the network node in the following way:
    [DEFAULT]
    …
    interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
  11. Edit the [securitygroup] section of the ML2 plugin configuration file located at /etc/neutron/plugins/ml2/ml2_conf.ini, as follows:
    [securitygroup]
    …
    firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
  12. Restart the Linux Bridge agent on the Network node by executing service neutron-plugin-linuxbridge-agent restart.

How it works…

At the start of the Neutron server, it will load the core plugin, which in our case is ML2. As the ML2 plugin allows you to implement physical networks in multiple ways, it uses the mechanism_drivers attribute to load the desired drivers. The preceding steps showed you how to configure a Linux bridge as the mechanism driver for ML2. The Linux bridge mechanism driver needs additional information such as the bridge name and physical interface mapping in order to provide network connectivity. Hence, these mappings are also a part of the mechanism driver configuration.