一、
1.1創建neutron數據庫
授予對neutron數據庫的適當訪問權限
mysql -u root -p
MariaDB [(none)]> CREATE DATABASE neutron;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY '123qwe
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY '123qwe';
1.2 輸入admin憑據以訪問僅管理CLI命令
source /home/admin-openrc.sh
創建neutron用戶,
將admin角色添加到neutron用戶,
創建neutron服務實體,
創建網絡服務API端點
openstack user create --domain default --password-prompt neutron
openstack role add --project service --user neutron admin
openstack service create --name neutron --description "OpenStack Networking" network
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
3.配置提供商網絡
安裝組件
yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables
編輯/etc/neutron/neutron.conf
在本[database]節中,配置數據庫訪問,
在本[DEFAULT]節中,啓用模塊化第2層(ML2)插件並禁用其他插件,
在本[DEFAULT]節中,配置RabbitMQ 消息隊列訪問,
在[DEFAULT]和[keystone_authtoken]部分,配置身份服務訪問,
在[DEFAULT]和[nova]部分中,配置網絡以通知計算網絡拓撲變化,
在該[oslo_concurrency]部分中,配置鎖定路徑。
[database]
connection = mysql+pymysql://neutron:123qwe@controller/neutron
[DEFAULT]
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
core_plugin = ml2
service_plugins =
transport_url = rabbit://openstack:123qwe@controller
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = 123qwe
[nova]
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = 123qwe
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
4.配置模塊化二層(ML2)插件
編輯/etc/neutron/plugins/ml2/ml2_conf.ini
vi /etc/neutron/plugins/ml2/ml2_conf.ini
在本[ml2]節中,啓用平面和VLAN網絡,
在本[ml2]節中,禁用自助服務網絡,
在本[ml2]節中,啓用Linux橋機制,
在本[ml2]節中,啓用端口安全擴展驅動程序,
在該[ml2_type_flat]部分中,將提供商虛擬網絡配置爲平面網絡,
在本[securitygroup]節中,啓用ipset以提高安全組規則的效率,
[ml2]
type_drivers = flat,vlan
tenant_network_types =
mechanism_drivers = linuxbridge
extension_drivers = port_security
[ml2_type_flat]
flat_networks = provider
[securitygroup]
enable_ipset = true
5.配置Linux橋接器
編輯/etc/neutron/plugins/ml2/linuxbridge_agent.ini
vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
在本[linux_bridge]節中,將提供商虛擬網絡映射到提供商物理網絡接口,
在本[vxlan]節中,禁用VXLAN覆蓋網絡,
在本[securitygroup]節中,啓用安全組並配置Linux bridge iptables防火牆驅動程序,
[linux_bridge]
physical_interface_mappings = provider:enp3s0
[vxlan]
enable_vxlan = false
[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
6.配置DHCP代理
編輯/etc/neutron/dhcp_agent.ini
vi /etc/neutron/dhcp_agent.ini
在本[DEFAULT]節中,配置Linux網橋接口驅動程序Dnsmasq DHCP驅動程序,並啓用隔離元數據,以便提供商網絡上的實例可以通過網絡訪問元數據
[DEFAULT]
interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true
7.配置元數據代理
編輯/etc/neutron/metadata_agent.ini
在本[DEFAULT]節中,配置元數據主機和共享密鑰
vi /etc/neutron/metadata_agent.ini
[DEFAULT]
nova_metadata_ip = controller
metadata_proxy_shared_secret = 123qwe
8.配置計算服務以使用網絡服務
編輯/etc/nova/nova.conf
在本[neutron]節中,配置訪問參數,啓用元數據代理,並配置密碼
vi /etc/nova/nova.conf
[neutron]
url = http://controller:9696
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = 123qwe
service_metadata_proxy = true
metadata_proxy_shared_secret = 123qwe
9.完成安裝
網絡服務初始化腳本
填充數據庫
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
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
重新啓動Compute API服務
啓動網絡服務並將其配置爲在系統啓動時啓動
#systemctl restart openstack-nova-api.service
# systemctl enable neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service
# systemctl start neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service
10 驗證
輸入admin憑據以訪問僅管理CLI命令
列出加載的擴展以驗證成功啓動的 neutron-server過程
列出代理商,以驗證中子劑的成功發射
source /home/admin-openrc.sh
openstack extension list --network
openstack network agent list