一.neutron環境
參考文檔:http://www.aboutyun.com/thread-13108-1-1.html
http://docs.openstack.org/mitaka/install-guide-ubuntu/neutron-controller-install.html
1.創建neutron數據庫並授權
- 創建
mysql -u root -p
CREATE DATABASE neutron;
- 授權
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'NEUTRON_PASS';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'NEUTRON_PASS';
- 退出
exit
2.生效環境變量
source admin-openrc.sh
3.創建網絡用戶並授權
- 創建neutron用戶
openstack user create --password-prompt neutron
User Password:(我的設置neutron)
Repeat User Password:
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | e0353a670a9e496da891347c589539e9 |
| enabled | True |
| id | b20a6692f77b4258926881bf831eb683 |
| name | neutron |
+-----------+----------------------------------+
- 添加admin角色到neutron用戶
openstack role add --project service --user neutron admin
- 創建neutron 服務實例
openstack service create --name neutron --description "OpenStack Networking" network
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Networking |
| enabled | True |
| id | f71529314dab4a4d8eca427e701d209e |
| name | neutron |
| type | network |
+-------------+----------------------------------+
- 創建網絡服務API endpoint
openstack endpoint create \
--publicurl http://controller:9696 \
--adminurl http://controller:9696 \
--internalurl http://controller:9696 \
--region RegionOne \
network
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| adminurl | http://controller:9696 |
| id | 85d80a6d02fc4b7683f611d7fc1493a3 |
| internalurl | http://controller:9696 |
| publicurl | http://controller:9696 |
| region_id | RegionOne |
| service_id | f71529314dab4a4d8eca427e701d209e |
| service_name | neutron |
| service_type | network |
+--------------+----------------------------------+
二.安裝Neutron
1.安裝neutron組件
apt-get install neutron-server neutron-plugin-ml2 python-neutronclient
2.配置環境
vim /etc/neutron/neutron.conf
[DEFAULT]
verbose = True
rpc_backend = rabbit
#配置認證訪問
auth_strategy = keystone
#啓用 Modular Layer 2 (ML2) plug-in,路由服務, 和 overlapping IP addresses:
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True
#配置計算節點網絡拓撲變化通知
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
nova_url = http://controller:8774/v2
[database]
connection = mysql://neutron:NEUTRON_DBPASS(neutron的數據庫密碼)@controller/neutron
[oslo_messaging_rabbit]
#配置RabbitMQ 消息隊列服務
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS(密碼爲創建的消息中間件密碼,我的爲123)
[keystone_authtoken]
#配置認證訪問
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = NEUTRON_PASS(我的密碼neutron)
[nova]
#配置計算節點網絡拓撲變化通知
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = nova
password = NOVA_PASS(上一篇設置的nova密碼,我的爲nova)
3.配置Modular Layer 2 (ML2) plug-in
vim /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
#啓用flat,VLAN,GRE和VXLAN網絡類型驅動,GRE租戶網絡,和OVS機制驅動:
type_drivers = flat,vlan,gre,vxlan
tenant_network_types = gre
mechanism_drivers = openvswitch
[ml2_type_gre]
#配置隧道標識符的id範圍
tunnel_id_ranges = 1:1000
[securitygroup]
#啓用security groups, 啓用 ipset, 和 配置 OVS iptables firewall 驅動
enable_security_group = True
enable_ipset = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
4.重新配置網絡(修改控制節點nova.conf,添加如下內容)
vim /etc/nova/nova.conf
[DEFAULT]
#配置Apis與驅動
network_api_class = nova.network.neutronv2.api.API
security_group_api = neutron
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[neutron]
#配置訪問參數
url = http://controller:9696
auth_strategy = keystone
admin_auth_url = http://controller:35357/v2.0
admin_tenant_name = service
admin_username = neutron
admin_password = NEUTRON_PASS(密碼爲neutron的密碼,我的爲neutron)
5.同步數據庫(同步之後,可以看看數據庫中是否存在表,有則成功,沒有則表明可能sqlite數據庫沒刪,刪除後在同步rm -f /var/lib/neutron/neutron.sqlite)
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
6.重啓計算服務與網絡服務
service nova-api restart
service neutron-server restart
7.驗證安裝
- 加載環境
source admin-openrc.sh
- 查看創建的neutron-server進程(大概是這幾項,我的好像多了一項,不知道爲什麼)
neutron net-list
+-----------------------+-----------------------------------------------+
| alias | name |
+-----------------------+-----------------------------------------------+
| security-group | security-group |
| l3_agent_scheduler | L3 Agent Scheduler |
| ext-gw-mode | Neutron L3 Configurable external gateway mode |
| binding | Port Binding |
| provider | Provider Network |
| agent | agent |
| quotas | Quota management support |
| dhcp_agent_scheduler | DHCP Agent Scheduler |
| l3-ha | HA Router extension |
| multi-provider | Multi Provider Network |
| external-net | Neutron external network |
| router | Neutron L3 Router |
| allowed-address-pairs | Allowed Address Pairs |
| extraroute | Neutron Extra Route |
| extra_dhcp_opt | Neutron Extra DHCP opts |
| dvr | Distributed Virtual Router |
+-----------------------+-----------------------------------------------+