本操作在网络节点上完成
安装neutron软件包
使用OVS作为虚拟交换机
root@network:~# apt -y install neutron-plugin-ml2 neutron-l3-agent neutron-dhcp-agent neutron-metadata-agent python-neutronclient neutron-openvswitch-agent
修改neutron配置文件
由于官方配置文件修改较为麻烦,这里直接创建一个新的配置文件
root@network:~# mv /etc/neutron/neutron.conf /etc/neutron/neutron.conf.org
root@network:~# vi /etc/neutron/neutron.conf
# 添加以下内容,保存退出
[DEFAULT]
core_plugin = ml2
service_plugins = router
auth_strategy = keystone
state_path = /var/lib/neutron
allow_overlapping_ips = True
# 消息队列连接设置
transport_url = rabbit://openstack:root@controller
[agent]
root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
# Keystone连接设置
[keystone_authtoken]
auth_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 = root
[oslo_concurrency]
lock_path = $state_path/lock
因为配置文件是新建的,这里把权限加回去
root@network:~# chmod 640 /etc/neutron/neutron.conf
root@network:~# chgrp neutron /etc/neutron/neutron.conf
修改三层代理配置
root@network:~# vi /etc/neutron/l3_agent.ini
# 第17行:去掉注释并添加
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
修改DHCP代理配置
root@network:~# vi /etc/neutron/dhcp_agent.ini
# 第17行:去掉注释并添加
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
# 第28行:去掉注释
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
# 第37行:取消注释并修改
enable_isolated_metadata = True
修改元数据代理配置
root@network:~# vi /etc/neutron/metadata_agent.ini
# 第22行:去掉注释并添加控制节点IP
nova_metadata_host = 10.0.0.7
# 第34行:去掉注释并添加元数据代理共享密码
metadata_proxy_shared_secret = metadata_secret
# 第260行:去掉注释并添加控制节点IP
memcache_servers = 10.0.0.7:11211
修改二层插件配置
root@network:~# vi /etc/neutron/plugins/ml2/ml2_conf.ini
# 第129行:添加相应设置(tenant_network_types设置暂时留空,之后会设置)
[ml2]
type_drivers = flat,vlan,gre,vxlan
tenant_network_types =
mechanism_drivers = openvswitch,l2population
extension_drivers = port_security
# 第262行:去掉注释并添加firewall_driver
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
# 最后一行:取消注释
enable_ipset = True
创建链接文件、重启服务
创建链接文件
root@network:~# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
重启服务
root@network:~# systemctl enable openvswitch-switch neutron-openvswitch-agent neutron-l3-agent neutron-dhcp-agent neutron-metadata-agent
Synchronizing state of openvswitch-switch.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable openvswitch-switch
Synchronizing state of neutron-openvswitch-agent.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable neutron-openvswitch-agent
Synchronizing state of neutron-l3-agent.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable neutron-l3-agent
Synchronizing state of neutron-dhcp-agent.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable neutron-dhcp-agent
Synchronizing state of neutron-metadata-agent.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable neutron-metadata-agent
root@network:~# systemctl restart openvswitch-switch neutron-openvswitch-agent neutron-l3-agent neutron-dhcp-agent neutron-metadata-agent