安装和配置控制节点(Controller node)
在配置Openstack网络(项目代号为neutron)服务前,需要创建相关数据库、服务认证service credentials
、API入口endpoints
- 创建数据库
$ mysql -uroot -p
mysql> create database neutron;
mysql> grant all privileges on neutron.* to 'neutron'@'localhost' \
identified by '123456' with grant option;
mysql> grant all privileges on neutron.* to 'neutron'@'%' \
identified by '123456' with grant option;
mysql> exit;
- 切换到
admin
用户环境,以获得admin-only
CLI权限
$ . admin-openrc
- 创建
neutron
服务认证
创建neutron
用户
$ openstack user create --domain default --password-prompt neutron
User Password:
Repeat User Password:
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | 5d9c95b32eaa4d80934f5d5d765bd3f5 |
| enabled | True |
| id | c5be46da15fb42fc9b96a1b1c884fb6b |
| name | neutron |
| password_expires_at | None |
+---------------------+----------------------------------+
neutron
用户添加admin
角色
$ 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 | 1ce836e494024e4ea9e2e7899cf01e09 |
| name | neutron |
| type | network |
+-------------+----------------------------------+
- 创建Networking服务的
API endpoints
$ openstack endpoint create --region RegionOne \
network public http://controller:9696
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 7184c9fcc8d544d7a3957c9810ce4142 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 1ce836e494024e4ea9e2e7899cf01e09 |
| service_name | neutron |
| service_type | network |
| url | http://controller:9696 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne \
network internal http://controller:9696
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 7228694155f440eda571df686b6c49be |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 1ce836e494024e4ea9e2e7899cf01e09 |
| service_name | neutron |
| service_type | network |
| url | http://controller:9696 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne \
network admin http://controller:9696
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 224bcf7ffa934baba1f75e029f64abab |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 1ce836e494024e4ea9e2e7899cf01e09 |
| service_name | neutron |
| service_type | network |
| url | http://controller:9696 |
+--------------+----------------------------------+
配置 networking 选项
可以选择option 1
或option 2
架构以部署Networking
服务。
-
Option 1
架构是最简单的,只支持将虚拟机实例接入provider(external)
网络,没有self-service(private)
网络、routers
以及floating IP(浮动IP)
。仅有admin
用户或其他同级用户可管理provider
网络 -
Option 2
架构则使用layer-3
服务扩展了option 1
,支持虚拟机实例使用self-service
网络。demo
用户或其他用户可以自行管理self-service
网络,包括routers以及floating IP
。floating IP
可以让虚拟机实例通过self-service
网络访问external
网络,例如外网。self-service
网络的数据包会使用 1500 的MTU
值
Option 2
同样支持将虚拟机实例接入provider
网络
配置完成下述任一网络架构后,再回到这里继续配置 metadata 代理
- Option 1: Provider 网络 部署
-Option 2: Self-service 网络
配置metadata agent
metadata agent用于提供配置信息,例如虚拟机实例的凭据
- 编辑
/etc/neutron/metadata_agent.ini
[DEFAULT]
...
nova_metadata_ip = controller
metadata_proxy_shared_secret = METADATA_SECRET #可以设置为其他合适的密码
配置Compute service
使用网络服务
- 编辑
/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 = 123456
service_metadata_proxy = true
metadata_proxy_shared_secret = METADATA_SECRET
安装收尾
# 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
# systemctl restart openstack-nova-api.service
- 对于
option 1
和option 2
,都需要如下操作
# 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
- 对于
option 2
,还需要启用layer-3
服务
# systemctl enable neutron-l3-agent.service
# systemctl start neutron-l3-agent.service