6543 发表于 2017-1-16 18:19:09

云计算之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

   
# 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


   
# 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


   
# 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


   
# 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

   
# 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
   
# cd /etc/neutron/
# cp neutron.conf neutron.conf.bak
# egrep -v "^$|^#" neutron.conf.bak > neutron.conf
# vim neutron.conf


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


...
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


...
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


...
lock_path = /var/lib/neutron/tmp


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

   
# cd /etc/neutron/plugins/ml2/
# cp ml2_conf.ini ml2_conf.ini.bak
# egrep -v "^$|^#" ml2_conf.ini.bak > ml2_conf.ini
# vim ml2_conf.ini


...
type_drivers = flat,vlan
tenant_network_types =
mechanism_drivers = linuxbridge
extension_drivers = port_security


...
flat_networks = provider


...
enable_ipset = True

6.编辑/etc/neutron/plugins/ml2/linuxbridge_agent.ini   
# cd /etc/neutron/plugins/ml2/
# cp linuxbridge_agent.ini linuxbridge_agent.ini.bak
# egrep -v "^$|^#" linuxbridge_agent.ini.bak >linuxbridge_agent.ini
# vim linuxbridge_agent.ini

physical_interface_mappings = provider:eth0

enable_vxlan = False


...
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

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

   
# cd /etc/neutron/
# cp dhcp_agent.ini dhcp_agent.ini.bak
# egrep -v "^$|^#" dhcp_agent.ini.bak > dhcp_agent.ini
# vim dhcp_agent.ini


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

8.修改/etc/neutron/metadata_agent.ini
   
# cd /etc/neutron/
# cp metadata_agent.ini metadata_agent.ini.bak
# egrep -v "^$|^#" metadata_agent.ini.bak metadata_agent.ini
# egrep -v "^$|^#" metadata_agent.ini.bak > metadata_agent.ini
# vim metadata_agent.ini


...
nova_metadata_ip = controller
metadata_proxy_shared_secret = mate

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

   
# cd /etc/nova/
# cp nova.conf nova.conf.nova
# vim nova.conf


...
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.创建链接
1
   
# 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.验证

   
# 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      |
+--------------------------------------+--------------------+----------------------+-------------------+-------+-------+---------------------------+



页: [1]
查看完整版本: 云计算之openstack-newton版搭建(七)