Installing, Configuring, and Verifying Neutron
Neutron provides networking as a service for other service components, such as Nova. It also provides APIs to users. It supports equipment and technologies from different network vendors.
OpenStack supports several networking modes. This section uses provider networks as an example. Select either of the Linux Bridge and OVS deployment types.
Creating the Neutron Database
Perform the following operations on controller nodes.
- Connect to the MySQL database as user root.
1mysql -u root -p
- Create a database for Neutron.
1CREATE DATABASE neutron;
- Grant proper access to the database, and set the PASSWORD for accessing the database.
1 2 3 4
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \ IDENTIFIED BY '<PASSWORD>'; GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \ IDENTIFIED BY '<PASSWORD>';
Set PASSWORD to the password for accessing the Neutron database.
- Exit the database.
1exit
Creating Service Credentials
Perform the following operations on controller nodes.
- Log in to the OpenStack CLI as the admin user.
1source /etc/keystone/admin-openrc
- Create a neutron user.
1openstack user create --domain default --password-prompt neutron
- Add the admin role to the neutron user.
1openstack role add --project service --user neutron admin
- Create a neutron service entity.
1openstack service create --name neutron --description "OpenStack Networking" network
- Create API endpoints of the network servers.
1 2 3
openstack endpoint create --region RegionOne network public http://controller:9696 openstack endpoint create --region RegionOne network internal http://controller:9696 openstack endpoint create --region RegionOne network admin http://controller:9696
Installing and Configuring Neutron (Provider-LinuxBridge-Controller Node)
Perform the following operations on Provider-LinuxBridge-controller nodes.
- Install components.
1yum -y install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables
- Edit the /etc/neutron/neutron.conf file.
- Configure database access.
1 2
[database] connection = mysql+pymysql://neutron:<PASSWORD>@controller/neutron
- Modify the content in the [DEFAULT] section.
1 2 3 4 5 6 7
[DEFAULT] core_plugin = ml2 service_plugins = transport_url = rabbit://openstack:<PASSWORD>@controller auth_strategy = keystone notify_nova_on_port_status_changes = true notify_nova_on_port_data_changes = true
Leave service_plugins blank and set <PASSWORD> to the password of the rabbit OpenStack user.
- Configure Identity service access.
1 2 3 4 5 6 7 8 9 10
[keystone_authtoken] www_authenticate_uri = http://controller:5000 auth_url = http://controller:5000 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = <PASSWORD>
- Configure parameters in the [nova] section.
By default, the configuration file does not contain this section. You need to add it.
1 2 3 4 5 6 7 8 9
[nova] auth_url = http://controller:5000 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = nova password = <PASSWORD>
- Configure the lock path.
1 2
[oslo_concurrency] lock_path = /var/lib/neutron/tmp
- Configure database access.
- Edit the ML2 plugin /etc/neutron/plugins/ml2/ml2_conf.ini.
- Enable the flat and VLAN networks.
You need to add [ml2], [ml2_type_flat], and [securitygroup].
1 2 3 4 5
[ml2] type_drivers = flat,vlan tenant_network_types = mechanism_drivers = linuxbridge extension_drivers = port_security
Leave tenant_network_types unspecified.
- Set the flat network type to provider.
1 2
[ml2_type_flat] flat_networks = provider
- Configure the VLAN as a flat network.
1 2
[ml2_type_vlan] network_vlan_ranges = provider
- Enable ipset to improve security.
1 2
[securitygroup] enable_ipset = true
- Enable the flat and VLAN networks.
- Configure the Linux bridge agent and edit the /etc/neutron/plugins/ml2/linuxbridge_agent.ini file.
- Map the provider virtual network to the physical network.
1 2
[linux_bridge] physical_interface_mappings = provider:enp3s0
In this example, the provider network uses the enp3s0 network port. Set the network port based on actual requirements. The physical network adapter is configured for the service network, not for the management network. For details, see Networking.
- Disable the VXLAN network.
1 2
[vxlan] enable_vxlan = false
- Enable the security group, configure the iptables firewall driver for the Linux bridge, save the configuration, and exit.
1 2 3
[securitygroup] enable_security_group = true firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
- Check that the Linux operating system kernel supports bridge filters.
Add the following to the /etc/sysctl.conf file, save the file, and exit:
1 2
net.bridge.bridge-nf-call-iptables = 1 net.bridge.bridge-nf-call-ip6tables = 1

- Add the network bridge filter.
1 2 3
modprobe br_netfilter sysctl -p sed -i '$amodprobe br_netfilter' /etc/rc.local
- Map the provider virtual network to the physical network.
- Configure the DHCP agent.
Add the following to the /etc/neutron/dhcp_agent.ini file, save the file, and exit:
1 2 3 4
[DEFAULT] interface_driver = linuxbridge dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = true
- Configure the metadata agent.
1vim /etc/neutron/metadata_agent.iniConfigure the metadata host and shared key.
1 2 3
[DEFAULT] nova_metadata_host = controller metadata_proxy_shared_secret = <PASSWORD>
- Configure the Computer service to use the Networking service.
1vim /etc/nova/nova.confSet access parameters, enable the metadata agent, and set the password.
1 2 3 4 5 6 7 8 9 10 11 12 13
[neutron] # ... url = http://controller:9696 auth_url = http://controller:5000 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = neutron password = <PASSWORD> service_metadata_proxy = true metadata_proxy_shared_secret = <PASSWORD>
Before performing this operation, ensure that Nova has been installed.
- Perform network initialization.
1ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
- Populate the databases.
1su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
- Enable the network service and configure it to start as the system boots.
1 2 3
systemctl enable openstack-neutron-server.service openstack-neutron-linuxbridge-agent.service openstack-neutron-dhcp-agent.service openstack-neutron-metadata-agent.service systemctl start openstack-neutron-server.service openstack-neutron-linuxbridge-agent.service openstack-neutron-dhcp-agent.service \ openstack-neutron-metadata-agent.service
Installing and Configuring Neutron (Provider-LinuxBridge-Compute Node)
Perform the following operations on Provider-LinuxBridge-compute nodes.
- Install components.
1yum -y install openstack-neutron-linuxbridge ebtables ipset
- Edit the /etc/neutron/neutron.conf file to configure public components.
- In the [database] section, comment out all connection options (commented by default), because the compute node does not directly access the database.
- Configure RabbitMQ message queue access.
1 2
[DEFAULT] transport_url = rabbit://openstack:<PASSWORD>@controller
- Configure Identity service access.
1 2 3 4 5 6 7 8 9 10 11 12
[DEFAULT] auth_strategy = keystone [keystone_authtoken] www_authenticate_uri = http://controller:5000 auth_url = http://controller:5000 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = <PASSWORD>
- Configure the lock path.
1 2
[oslo_concurrency] lock_path = /var/lib/neutron/tmp
- Add the following to the /etc/neutron/plugins/ml2/linuxbridge_agent.ini file to configure the Linux bridge agent:
- Map the provider virtual network to the provider physical network port.
1 2
[linux_bridge] physical_interface_mappings = provider:enp3s0
In this example, the provider network uses the enp3s0 network port. Set the network port based on actual requirements. The physical network adapter is configured for the service network, not for the management network. For details, see Networking.
- Disable the VXLAN network.
1 2
[vxlan] enable_vxlan = false
- Enable the security group and configure the iptables firewall driver for the Linux bridge.
1 2 3
[securitygroup] enable_security_group = true firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
- Map the provider virtual network to the provider physical network port.
- Check that the Linux operating system kernel supports bridge filters.
Add the following to the /etc/sysctl.conf file:
1 2
net.bridge.bridge-nf-call-iptables = 1 net.bridge.bridge-nf-call-ip6tables = 1
: - Add the network bridge filter.
1 2 3
modprobe br_netfilter sysctl -p sed -i '$amodprobe br_netfilter' /etc/rc.local
- Enable the Linux bridge agent and configure it to start as the system boots.
1 2
systemctl enable openstack-neutron-linuxbridge-agent.service systemctl start openstack-neutron-linuxbridge-agent.service
Installing and Configuring Neutron (Provider-OVS-Controller Node)
Perform the following operations on Provider-OVS-controller nodes.
- Install components.
1yum -y install openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch-agent openstack-neutron-dhcp-agent openstack-neutron-metadata-agent ebtables
- Modify the /etc/sysctl.conf file.
- Add the following content to the file:
1 2 3
net.ipv4.ip_forward=1 net.ipv4.conf.all.rp_filter=0 net.ipv4.conf.default.rp_filter=0
- Make the configuration take effect.
1sysctl -p
- Add the following content to the file:
- Edit the /etc/neutron/neutron.conf file.
- Configure database access.
1 2
[database] connection = mysql+pymysql://neutron:<PASSWORD>@controller/neutron
- Enable the ML2 plugin and disable other plugins.
1 2 3 4 5 6 7
[DEFAULT] core_plugin = ml2 service_plugins = transport_url = rabbit://openstack:<PASSWORD>@controller auth_strategy = keystone notify_nova_on_port_status_changes = true notify_nova_on_port_data_changes = true
- Configure Identity service access.
1 2 3 4 5 6 7 8 9 10
[keystone_authtoken] www_authenticate_uri = http://controller:5000 auth_url = http://controller:5000 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = <PASSWORD>
- Configure Nova parameters.
1 2 3 4 5 6 7 8 9
[nova] auth_url = http://controller:5000 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = nova password = <PASSWORD>
- Configure the lock path.
1 2
[oslo_concurrency] lock_path = /var/lib/neutron/tmp
- Configure database access.
- Edit the ML2 plugin /etc/neutron/plugins/ml2/ml2_conf.ini.
- Enable the flat and VLAN networks.
You need to add [ml2], [ml2_type_flat], [ml2_type_vlan], and [securitygroup].
1 2 3 4 5 6 7 8 9 10 11
[ml2] type_drivers = flat,vlan tenant_network_types = mechanism_drivers = openvswitch extension_drivers = port_security [ml2_type_flat] flat_networks = provider [ml2_type_vlan] network_vlan_ranges = provider [securitygroup] enable_ipset = true
- Enable the flat and VLAN networks.
- Configures the DHCP agent.
Edit the /etc/neutron/dhcp_agent.ini file.
1 2 3 4 5
[DEFAULT] dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = true interface_driver = openvswitch force_metadata = true
- Configure the metadata agent.
Edit the /etc/neutron/metadata_agent.ini file.
Configure the metadata host and shared key.
1 2 3
[DEFAULT] nova_metadata_host = controller metadata_proxy_shared_secret = <PASSWORD>
PASSWORD is the password for accessing the Neutron database.
- Perform network initialization.
1ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
- Populate the databases.
1 2
su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \ --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
- Enable the network service and configure it to start as the system boots.
1 2 3 4 5 6
systemctl enable openstack-neutron-server.service \ openstack-neutron-openvswitch-agent.service openstack-neutron-dhcp-agent.service \ openstack-neutron-metadata-agent.service systemctl start openstack-neutron-server.service \ openstack-neutron-openvswitch-agent.service openstack-neutron-dhcp-agent.service \ openstack-neutron-metadata-agent.service
Installing and Configuring Neutron (Provider-OVS-Compute Node)
Perform the following operations on Provider-OVS-compute nodes.
- Install components.
1yum -y install openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch-agent openstack-neutron-dhcp-agent openstack-neutron-metadata-agent ebtables ipset
- Modify the /etc/sysctl.conf file.
- Add the following content to the file:
1 2 3
net.ipv4.ip_forward=1 net.ipv4.conf.all.rp_filter=0 net.ipv4.conf.default.rp_filter=0
- Make the configuration take effect.
1sysctl -p
- Add the following content to the file:
- Edit the /etc/neutron/neutron.conf file to configure public components.
- Configure RabbitMQ message queue access.
1 2
[DEFAULT] transport_url = rabbit://openstack:<PASSWORD>@controller
PASSWORD indicates the password set by the RabbitMQ service for the openstack user.
- Configure Identity service access.
1 2 3 4 5 6 7 8 9 10 11 12
[DEFAULT] auth_strategy = keystone [keystone_authtoken] www_authenticate_uri = http://controller:5000 auth_url = http://controller:5000 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = <PASSWORD>
PASSWORD is the password for accessing the Neutron database.
- Configure the lock path.
1 2
[oslo_concurrency] lock_path = /var/lib/neutron/tmp
- Configure RabbitMQ message queue access.
- In the /etc/neutron/plugins/ml2/openvswitch_agent.ini file, add [linux_openvswitch], [vxlan], [ovs], and [securitygroup] to configure the OpenStack agent.
1 2 3 4 5 6 7 8 9
[linux_openvswitch] physical_interface_mappings = provider:enp3s0 [vxlan] enable_vxlan = false [ovs] bridge_mappings = provider:br-provider [securitygroup] enable_security_group=true firewall_driver = iptables_hybrid
- Edit the /etc/neutron/dhcp_agent.ini file to configure the DHCP agent.
1 2 3 4
[DEFAULT] interface_driver = openvswitch enable_isolated_metadata = true force_metadata = true
- In the /etc/neutron/metadata_agent.ini file, configure the metadata agent.
1 2 3
[DEFAULT] nova_metadata_host = controller metadata_proxy_shared_secret = <PASSWORD>
PASSWORD is the password for accessing the Neutron database.
- Enable the OVS agent and configure it to start as the system boots.
1 2 3 4
systemctl enable openstack-neutron-openvswitch-agent.service openstack-neutron-dhcp-agent.service \ openstack-neutron-metadata-agent.service systemctl start openstack-neutron-openvswitch-agent.service openstack-neutron-dhcp-agent.service \ openstack-neutron-metadata-agent.service
- Create an OVS provider.
1 2
ovs-vsctl add-br br-provider ovs-vsctl add-port br-provider enp3s0
If openvswitch-agent cannot obtain the root permission, the openvswitch service fails to be started. In this case, you need to upgrade the sudo software package.
yum update sudo
Verifying Neutron
Perform the following operation on controller nodes.
- List the Neutron agents that are successfully started.
1openstack network agent list

Command |
Description |
|---|---|
openstack network create --share --external \ --provider-physical-network provider \ --provider-network-type flat enp3s0 |
Creates a shared virtual network. |
openstack subnet create --network provider \ --allocation-pool start=172.168.204.50,end=172.168.204.100 \ --dns-nameserver 8.8.8.8 --gateway 172.168.204.1 \ --subnet-range 172.168.204.0/24 subnet1 |
Creates a subnet.
NOTE:
In this command, the network name is subnet1, DHCP range is 172.168.204.50 to 172.168.204.100, DNS IP address is 8.8.8.8, gateway IP address is 172.168.204.1, and network is 172.168.204.0/24. |
openstack network list |
Checks the current network type. |
openstack subnet list |
Checks the subnet. |
openstack port list |
Checks the network ports. |