openstack【Kilo】入门 【网络篇】十三:Neutron安装配置【控制节点】

来源:互联网 发布:python 循环读取文件 编辑:程序博客网 时间:2024/06/05 05:10
问题导读

1.如何配置启用 OVS iptables firewall 驱动?
2.同步数据库是否可以以前同步?
3.如何验证安装是否成功?








1.安装准备

1.创建数据
a.使用root登录mysql
[Bash shell] 纯文本查看 复制代码
?
1
mysql -u root -p


b.创建neutron数据库
[Bash shell] 纯文本查看 复制代码
?
1
CREATE DATABASE neutron;


c.授权访问数据库
[Bash shell] 纯文本查看 复制代码
?
1
2
3
4
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost'\
IDENTIFIED BY 'NEUTRON_DBPASS';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%'\
IDENTIFIED BY 'NEUTRON_DBPASS';


d.退出数据库
[Bash shell] 纯文本查看 复制代码
?
1
exit



2.生效环境变量
[Bash shell] 纯文本查看 复制代码
?
1
sourceadmin-openrc.sh


3.创建网络用户并授权

a.创建neutron用户
[Bash shell] 纯文本查看 复制代码
?
1
openstack user create --password-prompt neutron


User Password:
Repeat User Password:


b.创建admin角色到neutron用户
[Bash shell] 纯文本查看 复制代码
?
1
openstack role add --project service --user neutron admin

[Bash shell] 纯文本查看 复制代码
?
1
2
3
4
5
6
+-------+----------------------------------+
| Field | Value |
+-------+----------------------------------+
|id| cd2cb9a39e874ea69e5d4b896eb16128 |
| name | admin |
+-------+----------------------------------+


c.创建neutron 服务实例
[Bash shell] 纯文本查看 复制代码
?
1
2
openstack service create --name neutron \
  --description"OpenStack Networking" network

[Bash shell] 纯文本查看 复制代码
?
1
2
3
4
5
6
7
8
9
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Networking |
| enabled | True |
|id| f71529314dab4a4d8eca427e701d209e |
| name | neutron |
|type| network |
+-------------+----------------------------------+



4.创建网络服务API endpoint
[Bash shell] 纯文本查看 复制代码
?
1
2
3
4
5
6
openstack endpoint create \
--publicurl http://controller:9696 \
--adminurl http://controller:9696 \
--internalurl http://controller:9696 \
--region RegionOne \
network


[Bash shell] 纯文本查看 复制代码
?
01
02
03
04
05
06
07
08
09
10
11
12
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| adminurl | http://controller:9696 |
|id| 04a7d3c1de784099aaba83a8a74100b3 |
| internalurl | http://controller:9696 |
| publicurl | http://controller:9696 |
| region | RegionOne |
| service_id | f71529314dab4a4d8eca427e701d209e |
| service_name | neutron |
| service_type | network |
+--------------+----------------------------------+


2.安装新的网络组件

[Bash shell] 纯文本查看 复制代码
?
1
apt-getinstallneutron-server neutron-plugin-ml2 python-neutronclient


3.配置网络服务组件

编辑文件 /etc/neutron/neutron.conf完成下面内容

a.在 [database]部分,配置数据库访问
[Bash shell] 纯文本查看 复制代码
?
1
2
3
[database]
...
connection = mysql://neutron:NEUTRON_DBPASS@controller/neutron


neutron:NEUTRON_DBPASS记得替换为自己的密码

b.在[DEFAULT] 和 [oslo_messaging_rabbit]部分,配置RabbitMQ 消息队列服务
[Bash shell] 纯文本查看 复制代码
?
1
2
3
4
5
6
7
8
9
[DEFAULT]
...
rpc_backend = rabbit
 
[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS


c. 在[DEFAULT] 和 [keystone_authtoken]部分,配置认证访问
[Bash shell] 纯文本查看 复制代码
?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
[DEFAULT]
...
auth_strategy = keystone
 
[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_PASS密码记得替换为自己设置的密码,这里设置为123
[keystone_authtoken] 标签中,移除或则注释掉其它选项

d.在 [DEFAULT]部分,启用 Modular Layer 2 (ML2) plug-in,路由服务, 和 overlapping IP addresses:
[Bash shell] 纯文本查看 复制代码
?
1
2
3
4
5
[DEFAULT]
...
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True


e.在 [DEFAULT] 和 [nova]部分,配置计算节点网络拓扑变化通知
[Bash shell] 纯文本查看 复制代码
?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
[DEFAULT]
...
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
nova_url = http://controller:8774/v2
 
[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_PASS记得密码替换为自己设置的 


f.启用日志信息详细记录
[Bash shell] 纯文本查看 复制代码
?
1
2
3
[DEFAULT]
...
verbose = True


4.配置Modular Layer 2 (ML2) plug-in

ML2插件使用e Open vSwitch (OVS) 机制作为实例的虚拟网络架构,尽管如此,计算节点不需要ovs组件,因为它不处理实例的网络


编辑文件 /etc/neutron/plugins/ml2/ml2_conf.ini完成下面内容

a.在[ml2]部分,启用e flat, VLAN, generic routing encapsulation (GRE), 和 virtual extensible LAN (VXLAN) 网络类型驱动, GRE 租户网络, 和OVS 机制驱动:
[Bash shell] 纯文本查看 复制代码
?
1
2
3
4
5
[ml2]
...
type_drivers = flat,vlan,gre,vxlan
tenant_network_types = gre
mechanism_drivers = openvswitch


注意:一旦配置ML2插件,如何改变type_drivers值的话,会导致数据库不一致

b. 在[ml2_type_gre]部分,配置隧道标识符id的范围
[Bash shell] 纯文本查看 复制代码
?
1
2
3
[ml2_type_gre]
...
tunnel_id_ranges = 1:1000


c.在[securitygroup] 部分,启用security groups, 启用 ipset, 和 配置  OVS iptables firewall 驱动:
[Bash shell] 纯文本查看 复制代码
?
1
2
3
4
5
[securitygroup]
...
enable_security_group = True
enable_ipset = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver


5.重新配置网络【控制节点】

编辑文件 /etc/nova/nova.conf完成下面内容


a.在 [DEFAULT]部分,配置APIs和驱动

[Bash shell] 纯文本查看 复制代码
?
1
2
3
4
5
6
[DEFAULT]
...
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


b.在 [neutron] 部分,配置访问参数
[Bash shell] 纯文本查看 复制代码
?
1
2
3
4
5
6
7
8
[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_PASS 记得替换为自己的密码


6.完成安装

1.同步数据库
[Bash shell] 纯文本查看 复制代码
?
1
2
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


数据同步脚本是根据配置文件特别是插件的配置来进行同步的

2.重启计算服务
[Bash shell] 纯文本查看 复制代码
?
1
service nova-api restart


3.重启网络服务
[Bash shell] 纯文本查看 复制代码
?
1
service neutron-server restart


7.验证安装

1.生效环境变量
[Bash shell] 纯文本查看 复制代码
?
1
sourceadmin-openrc.sh


2.列出创建成功的neutron-server 进程
[Bash shell] 纯文本查看 复制代码
?
1
neutron ext-list


[Bash shell] 纯文本查看 复制代码
?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
+-----------------------+-----------------------------------------------+
|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                    |
+-----------------------+-----------------------------------------------+
阅读全文
0 0
原创粉丝点击