首页 > 代码库 > openstack部署(四)-计算节点(Networking)

openstack部署(四)-计算节点(Networking)

计算节点增加Networking及配置


安装组件 yum install -y openstack-neutron openstack-neutron-linuxbridge ebtables ipset

配置普通组件  vim /etc/neutron/neutron.conf //更改或增加

[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone
verbose = True
[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = o3NXovnz5
[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 = mdcGVl29i
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp



配置linux桥接agent

[root@compute ~]# mv /etc/neutron/plugins/ml2/linuxbridge_agent.ini /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak
[root@compute ~]# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini  增加以下内容
[linux_bridge]
physical_interface_mappings = public:eno16777736
[vxlan]
enable_vxlan = False
[agent]
prevent_arp_spoofing = True
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

配置compute使用网络

vi /etc/nova/nova.conf  //更改或增加

[neutron]
url = http://controller:9696
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = neutron
password = neutronpasswd

启动服务

systemctl restart openstack-nova-compute.service   

systemctl enable neutron-linuxbridge-agent.service

systemctl start neutron-linuxbridge-agent.service

[root@compute ~]# systemctl restart openstack-nova-compute.service 
[root@compute ~]# systemctl enable neutron-linuxbridge-agent.service
Created symlink from /etc/systemd/system/multi-user.target.wants/neutron-linuxbridge-agent.service to /usr/lib/systemd/system/neutron-linuxbridge-agent.service.
[root@compute ~]# systemctl start neutron-linuxbridge-agent.service
[root@compute ~]#

验证配置(controller)

执行环境变量脚本

source admin-openrc.sh


列出所有的扩展

neutron ext-list

[root@controller network-scripts]# neutron ext-list
+-----------------------+-----------------------------------------------+
| alias                 | name                                          |
+-----------------------+-----------------------------------------------+
| dns-integration       | DNS Integration                               |
| ext-gw-mode           | Neutron L3 Configurable external gateway mode |
| binding               | Port Binding                                  |
| agent                 | agent                                         |
| subnet_allocation     | Subnet Allocation                             |
| l3_agent_scheduler    | L3 Agent Scheduler                            |
| external-net          | Neutron external network                      |
| flavors               | Neutron Service Flavors                       |
| net-mtu               | Network MTU                                   |
| quotas                | Quota management support                      |
| l3-ha                 | HA Router extension                           |
| provider              | Provider Network                              |
| multi-provider        | Multi Provider Network                        |
| extraroute            | Neutron Extra Route                           |
| router                | Neutron L3 Router                             |
| extra_dhcp_opt        | Neutron Extra DHCP opts                       |
| security-group        | security-group                                |
| dhcp_agent_scheduler  | DHCP Agent Scheduler                          |
| rbac-policies         | RBAC Policies                                 |
| port-security         | Port Security                                 |
| allowed-address-pairs | Allowed Address Pairs                         |
| dvr                   | Distributed Virtual Router                    |
+-----------------------+-----------------------------------------------+
[root@controller network-scripts]#

列出所有agent

neutron agent-list

[root@controller network-scripts]# neutron agent-list
+--------------------------------------+--------------------+------------+-------+----------------+---------------------------+
| id                                   | agent_type         | host       | alive | admin_state_up | binary                    |
+--------------------------------------+--------------------+------------+-------+----------------+---------------------------+
| 4280e1bf-9167-4513-9128-8d71bb1235cc | DHCP agent         | controller | :-)   | True           | neutron-dhcp-agent        |
| 75faf736-924d-43a5-bb2c-620dcd474602 | Metadata agent     | controller | :-)   | True           | neutron-metadata-agent    |
| af9496f7-9c3a-4b29-9112-4fbd19a91b70 | Linux bridge agent | compute    | :-)   | True           | neutron-linuxbridge-agent |
| fdc74917-b760-48e4-b5d6-5290083521bf | Linux bridge agent | controller | :-)   | True           | neutron-linuxbridge-agent |
+--------------------------------------+--------------------+------------+-------+----------------+---------------------------+
[root@controller network-scripts]#

agent type如下:

Linux bridge agent

Linux bridge agent

DHCP agent

Metadata agent

必须要有4个,否则说明上面的某个步骤配置有问题。


增加dashboard  - horizon (controller)

openstack dashboard也被称为Horizon,是一个web界面,使用管理员和用户能够管理openstack不同的资源和服务
dashboard 通过OpenStack APIs操作openstack云计算控制器
Horizon允许定制自己的商标
Horizon提供了核心类和可重复使用的木板和工具
这个部署使用的是 Apache web server.


安装包 yum install -y openstack-dashboard

编辑配置文件

vi /etc/openstack-dashboard/local_settings //更改或增加

OPENSTACK_HOST = "controller"   #配置openstack服务dashboard,运行在控制节点
ALLOWED_HOSTS = [‘*‘, ]         #允许任何主机访问dashboard

#配置缓存会话存储服务,注意:注释掉其它session存储配置

CACHES = {
    ‘default‘: {
         ‘BACKEND‘: ‘django.core.cache.backends.locmem.LocMemCache‘,
         ‘LOCATION‘: ‘127.0.0.1:11211‘,
     }
}

OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
OPENSTACK_API_VERSIONS = {
"identity": 3,
"volume": 2,
}

TIME_ZONE = "Asia/Chongqing"  #时区

重启服务  systemctl restart httpd.service memcached.service

此时可以去访问了 http://controller/dashboard   使用账号admin或者demon用户登陆即可,域为default


block storage又叫做cinder,用来给openstack提供存储服务,比如我们在阿里云购买一台云主机,同时想购买容量大的磁盘,通常叫做云盘,这个云盘就是block storage。

创建库并授权cinder用户

mysql -uroot -proot

> CREATE DATABASE cinder;

> GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘localhost‘    IDENTIFIED BY ‘cinder‘;

> GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘%‘    IDENTIFIED BY ‘cinder‘;

MariaDB [(none)]> CREATE DATABASE cinder;
Query OK, 1 row affected (0.03 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘localhost‘    IDENTIFIED BY ‘cinder‘;
Query OK, 0 rows affected (0.14 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder‘@‘%‘    IDENTIFIED BY ‘cinder‘;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]>


执行初始化脚本

source admin-openrc.sh

创建cinder用户 (密码为cinderpasswd)

openstack user create --domain default --password-prompt cinder

添加admin角色

openstack role add --project service --user cinder admin


未完----

本文出自 “时光依然轻擦” 博客,请务必保留此出处http://xulianglinux.blog.51cto.com/8001428/1855843

openstack部署(四)-计算节点(Networking)