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

Configuring Neutron to use the Open vSwitch mechanism driver

The ML2 plugin can support many mechanisms to provide the core functionality. We will see how Open vSwitch can act as a mechanism driver for the ML2 plugin.

Getting ready

Using OVS as the mechanism driver requires changes to the ML2 plugin configuration file. We also have to configure OVS with a tenant network type and physical network alias.

How to do it…

The following steps will show you how to configure Open vSwitch 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 OVS as the mechanism driver:
    [ml2]
    ...
    mechanism_drivers = openvswitch
    
  4. In the [ovs] section of the file, configure OVS with the tenant network type and physical bridge mapping:
    [ovs]
    ...
    tenant_network_type = vlan
    bridge_mappings = physnet1:br-eth1
    
  5. In the previous step, br-eth1 represents the actual Open vSwitch instance that is bound to a physical interface and physnet1 represents the alias for the OVS instance.
  6. The OVS instance, br-eth1, can be created using the following steps (assuming that the eth1 interface is used for the data traffic):
    openstack@controller:~$ sudo ovs-vsctl add-br br-eth1
    openstack@controller:~$ sudo ovs-vsctl add-port br-eth1 eth1
    
  7. Restart the Neutron and Open vSwitch services on the Controller and Network nodes of our setup, using the following commands:
    openstack@controller:~$ sudo service neutron-server restart
    openstack@controller:~$ sudo service openvswitch-switch restart
    openstack@controller:~$ sudo service neutron-openvswitch-agent restart 
    
  8. Repeat these steps for the compute node in the setup.
  9. The next few steps will show you the changes that are needed on the Network node so that the Neutron agents can use the OVS-related drivers.
  10. Edit the [DEFAULT] section of the DHCP agent configuration file located at /etc/neutron/dhcp_agent.ini as follows:
    [DEFAULT]
    ...
    interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
    Edit the [DEFAULT] section of the L3 agent configuration file located at /etc/neutron/l3_agent.ini as follows:
    [DEFAULT]
    ...
    interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
    
  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.OVSHybridIptablesFirewallDriver
    
  12. Restart the Neutron-related services as mentioned in step 7.

How it works…

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