云计算之openstack-newton版搭建(七)

网友投稿 293 2022-11-13

云计算之openstack-newton版搭建(七)

网络服务neutron服务器端的安装及配置1.创建数据库

# mysql -u root -p123456

mysql> CREATE DATABASE neutron;

mysql> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \   IDENTIFIED BY 'NEUTRON_DBPASS'; mysql> GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \   IDENTIFIED BY 'NEUTRON_DBPASS';

2.获取admin权限

# . admin-openrc

3.创建neutron服务

# openstack user create --domain default --password-prompt neutron

[root@controller ~]# openstack user create --domain default --password-prompt neutron User Password:123456 Repeat User Password:123456 +---------------------+----------------------------------+ | Field               | Value                            | +---------------------+----------------------------------+ | domain_id           | default                          | | enabled             | True                             | | id                  | f510da80ec9948009e8d62dad74177fe | | name                | neutron                          | | password_expires_at | None                             | +---------------------+----------------------------------+

# openstack role add --project service --user neutron admin

# openstack service create --name neutron \   --description "OpenStack Networking" network

[root@controller ~]# openstack service create --name neutron \ >   --description "OpenStack Networking" network +-------------+----------------------------------+ | Field       | Value                            | +-------------+----------------------------------+ | description | OpenStack Networking             | | enabled     | True                             | | id          | 49d146c23d8e4bb3b936a504b6961eed | | name        | neutron                          | | type        | network                          | +-------------+----------------------------------+

4.创建网络服务API端点

$ openstack endpoint create --region RegionOne \   network public http://controller:9696

[root@controller ~]# openstack endpoint create --region RegionOne \ >   network public http://controller:9696 +--------------+----------------------------------+ | Field        | Value                            | +--------------+----------------------------------+ | enabled      | True                             | | id           | c05e3a81d744442db25c180556cb4083 | | interface    | public                           | | region       | RegionOne                        | | region_id    | RegionOne                        | | service_id   | 49d146c23d8e4bb3b936a504b6961eed | | service_name | neutron                          | | service_type | network                          | | url          | http://controller:9696           | +--------------+----------------------------------+

# openstack endpoint create --region RegionOne \   network internal http://controller:9696

[root@controller ~]# openstack endpoint create --region RegionOne \ >   network internal http://controller:9696 +--------------+----------------------------------+ | Field        | Value                            | +--------------+----------------------------------+ | enabled      | True                             | | id           | 8c5eccd7a5594dbf836299dec3fd9f3c | | interface    | internal                         | | region       | RegionOne                        | | region_id    | RegionOne                        | | service_id   | 49d146c23d8e4bb3b936a504b6961eed | | service_name | neutron                          | | service_type | network                          | | url          | http://controller:9696           | +--------------+----------------------------------+

# openstack endpoint create --region RegionOne \   network admin http://controller:9696

[root@controller ~]# openstack endpoint create --region RegionOne \ >   network admin http://controller:9696 +--------------+----------------------------------+ | Field        | Value                            | +--------------+----------------------------------+ | enabled      | True                             | | id           | da4a06f7c16b4a4e87e0e20ba00285d8 | | interface    | admin                            | | region       | RegionOne                        | | region_id    | RegionOne                        | | service_id   | 49d146c23d8e4bb3b936a504b6961eed | | service_name | neutron                          | | service_type | network                          | | url          | http://controller:9696           | +--------------+----------------------------------+

网络选择网络1模式:Provider networks

4.安装软件包

# yum install openstack-neutron openstack-neutron-ml2 \   openstack-neutron-linuxbridge ebtables -y

5.编辑 /etc/neutron/neutron.conf

[root@controller ~]# cd /etc/neutron/ [root@controller neutron]# cp neutron.conf neutron.conf.bak [root@controller neutron]# egrep -v "^$|^#" neutron.conf.bak > neutron.conf [root@controller neutron]# vim neutron.conf

[database] ... connection = mysql+pymysql://neutron:NEUTRON_DBPASS@controller/neutron

[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 = 123456

[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 = 123456

[oslo_concurrency] ... lock_path = /var/lib/neutron/tmp

[DEFAULT] core_plugin = ml2 service_plugins = transport_url = rabbit://openstack:RABBIT_PASS@controller auth_strategy = keystone notify_nova_on_port_status_changes = True notify_nova_on_port_data_changes = True

6.编辑/etc/neutron/plugins/ml2/ml2_conf.ini

[root@controller ~]# cd /etc/neutron/plugins/ml2/ [root@controller ml2]# cp ml2_conf.ini ml2_conf.ini.bak [root@controller ml2]# egrep -v "^$|^#" ml2_conf.ini.bak > ml2_conf.ini [root@controller ml2]# vim ml2_conf.ini

[ml2] ... type_drivers = flat,vlan tenant_network_types = mechanism_drivers = linuxbridge extension_drivers = port_security

[ml2_type_flat] ... flat_networks = provider

[securitygroup] ... enable_ipset = True

6.编辑/etc/neutron/plugins/ml2/linuxbridge_agent.ini

[root@controller ~]# cd /etc/neutron/plugins/ml2/ [root@controller ml2]# cp linuxbridge_agent.ini linuxbridge_agent.ini.bak [root@controller ml2]# egrep -v "^$|^#" linuxbridge_agent.ini.bak >linuxbridge_agent.ini [root@controller ml2]# vim linuxbridge_agent.ini

[linux_bridge]physical_interface_mappings = provider:eth0

[vxlan]enable_vxlan = False

[securitygroup] ... enable_security_group = True firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

7.编辑/etc/neutron/dhcp_agent.ini

[root@controller ~]# cd /etc/neutron/ [root@controller neutron]# cp dhcp_agent.ini dhcp_agent.ini.bak [root@controller neutron]# egrep -v "^$|^#" dhcp_agent.ini.bak > dhcp_agent.ini [root@controller neutron]# vim dhcp_agent.ini

[DEFAULT] ... interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = True

8.修改/etc/neutron/metadata_agent.ini

[root@controller ~]# cd /etc/neutron/ [root@controller neutron]# cp metadata_agent.ini metadata_agent.ini.bak [root@controller neutron]# egrep -v "^$|^#" metadata_agent.ini.bak metadata_agent.ini [root@controller neutron]# egrep -v "^$|^#" metadata_agent.ini.bak > metadata_agent.ini [root@controller neutron]# vim metadata_agent.ini

[DEFAULT] ... nova_metadata_ip = controller metadata_proxy_shared_secret = mate

8.编辑/etc/nova/nova.conf

[root@controller ~]# cd /etc/nova/ [root@controller nova]# cp nova.conf nova.conf.nova [root@controller nova]# vim 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 = mate

9.创建链接

# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

10.导入数据库

# 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

11.重启nova-api服务

# systemctl restart openstack-nova-api.service

12.启动服务

# 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

# systemctl enable neutron-l3-agent.service # systemctl start neutron-l3-agent.service

13.验证

[root@controller nova]# openstack network agent list +--------------------------------------+--------------------+----------------------+-------------------+-------+-------+---------------------------+ | ID                                   | Agent Type         | Host                 | Availability Zone | Alive | State | Binary                    | +--------------------------------------+--------------------+----------------------+-------------------+-------+-------+---------------------------+ | 698c8ca2-3090-4c0c-99c6-c057372b964f | Linux bridge agent | controller.novalocal | None              | True  | UP    | neutron-linuxbridge-agent | | 75342101-7cc6-449f-93aa-915b145d071e | Metadata agent     | controller.novalocal | None              | True  | UP    | neutron-metadata-agent    | | d8c7e1b1-52a1-4a4f-9b9b-ab5fa56e94e9 | DHCP agent         | controller.novalocal | nova              | True  | UP    | neutron-dhcp-agent        | +--------------------------------------+--------------------+----------------------+-------------------+-------+-------+---------------------------+

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:三星S5P4418开发板资料详解
下一篇:采用TMS320C5416处理器与P89C52单片机实现指纹自动识别系统的设计
相关文章

 发表评论

暂时没有评论,来抢沙发吧~