1:打开本地mysql数据库
$ mysql -u root -p
2:创建neutron数据库
MariaDB [(none)] CREATE DATABASE neutron;
3:给neutron数据库授予权限并设置密码
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'NEUTRON_DBPASS'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'NEUTRON_DBPASS'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'主机名' IDENTIFIED BY 'NEUTRON_DBPASS';
4:在vim /etc/profile中配置
5:创建服务凭据
openstack user create --domain default --password-prompt neutron
添加admin用户进neutron角色
$ openstack role add --project service --user neutron admin
创建服务实体
$ openstack service create --name neutron --description "OpenStack Networking" network
6:创建网络服务api节点
$ 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
7:下载所需要的包
# yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables
8:进入/etc/neutron/neutron.conf文件配置
[database] # ... connection = mysql+pymysql://neutron:NEUTRON_DBPASS@controller/neutron #NEUTRON_DBPASS为自己设置的密码 controller为自己的ip
[DEFAULT] # ... core_plugin = ml2 service_plugins = router allow_overlapping_ips = true
[DEFAULT] # ... transport_url = rabbit://openstack:RABBIT_PASS@controller #RABBIT_PASS为自己的rabbitmq的密码 controller为自己的ip
[DEFAULT] # ... 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 = NEUTRON_PASS #controller为自己的ip service为自己的用户 NEUTRON_PASS为自己的密码
[DEFAULT] # ... notify_nova_on_port_status_changes = true notify_nova_on_port_data_changes = true [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 = NOVA_PASS #controller为自己的ip service为自己的用户 NEUTRON_PASS为自己的密码
[oslo_concurrency] # ... lock_path = /var/lib/neutron/tmp
9:进入/etc/neutron/plugins/ml2/ml2_conf.ini文件配置
[ml2] # ... type_drivers = flat,vlan,vxlan
[ml2] # ... tenant_network_types = vxlan
[ml2] # ... mechanism_drivers = linuxbridge,l2population
[ml2] # ... extension_drivers = port_security
[ml2_type_flat] # ... flat_networks = provider
[ml2_type_vxlan] # ... vni_ranges = 1:1000
[securitygroup] # ... enable_ipset = true
10:进入/etc/neutron/plugins/ml2/linuxbridge_agent.ini文件配置
[linux_bridge] physical_interface_mappings = provider:PROVIDER_INTERFACE_NAME #PROVIDER_INTERFACE_NAME为自己的env33
[vxlan] enable_vxlan = true local_ip = OVERLAY_INTERFACE_IP_ADDRESS l2_population = true #OVERLAY_INTERFACE_IP_ADDRESS为自己的本机ip
[securitygroup] # ... enable_security_group = true firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
11:进入vim /etc/sysctl.conf文件
加入此行
net.bridge.bridge-nf-call-iptables=1 net.bridge.bridge-nf-call-ip6tables=1
输入sysctl -p 结果为此图为正确
12:进入/etc/neutron/dhcp_agent.ini配置
[DEFAULT] # ... interface_driver = linuxbridge dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = true
13:进入/etc/neutron/metadata_agent.ini进行配置
[DEFAULT] # ... nova_metadata_host = controller metadata_proxy_shared_secret = METADATA_SECRET #controller为自己的ip METADATA_SECRET为密码可自己设置
14:进入 /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 = NEUTRON_PASS service_metadata_proxy = true metadata_proxy_shared_secret = METADATA_SECRET #controller为自己的密码 service为自己的用户 NEUTRON_PASS为自己的密码 METADATA_SECRET源码密码与上方一致
15:创建一个插件
# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
16:填充数据库
# 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
17:重启api数据服务
# systemctl restart openstack-nova-api.service
18:开启配置完的服务
# systemctl enable neutron-server neutron-linuxbridge-agent neutron-dhcp-agent neutron-metadata-agent # systemctl start neutron-server neutron-linuxbridge-agent neutron-dhcp-agent neutron-metadata-agent
# systemctl enable neutron-l3-agent # systemctl start neutron-l3-agent