openstack網絡服務neutron

1、環境準備

一、虛擬機準備

IP地址		主機名			操做系統
192.168.56.11	linux-node1		CentOS7
192.168.56.12	linux-node2		CentOS7

其中,linux-node1看成控制節點node

linux-node2看成計算節點mysql

2、neutron服務

OpenStack網絡(neutron)管理OpenStack環境中全部虛擬網絡基礎設施(VNI),物理網絡基礎設施(PNI)的接入層。linux

3、安裝和配置

一、安裝

[root@linux-node1 ~]# yum install -y openstack-neutron openstack-neutron-ml2 \
openstack-neutron-linuxbridge ebtables

二、配置

先決條件sql

(1)建立數據庫

(2)得到 admin 憑證來獲取只有管理員能執行的命令的訪問權限

建立用戶數據庫

三、配置數據庫鏈接

咱們選擇配置公共網絡vim

connection = mysql+pymysql://neutron:neutron@192.168.56.11/neutronapi

四、配置keystone

vim /etc/neutron/neutron.conf

auth_strategy = keystone


[keystone_authtoken]
auth_uri = http://192.168.56.11:5000
auth_url = http://192.168.56.11:35357
memcached_servers = 192.168.56.11:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron

五、配置rabbitmq

vim /etc/neutron/neutron.conf

rpc_backend = rabbit

rabbit_host = 192.168.56.11
rabbit_userid = openstack
rabbit_password = openstack

六、配置neutron

vim /etc/neutron/neutron.conf
core_plugin = ml2

service_plugins =

#在[DEFAULT]和[nova]部分,配置網絡服務來通知計算節點的網絡拓撲變化
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true

[nova]
auth_url = http://192.168.56.11:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = nova

#配置鎖路徑
lock_path = /var/lib/neutron/tmp

七、配置Modular Layer2插件

ML2插件使用Linuxbridge機制來爲實例建立layer-2虛擬網絡基礎設施網絡

type_drivers = flat,vlan,gre,vxlan,geneve
tenant_network_types =
mechanism_drivers = linuxbridge,openvswitch
extension_drivers = port_security
flat_networks = public
enable_ipset = true

八、配置Linuxbridge代理

[root@linux-node1 ~]# vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini 

physical_interface_mappings = public:eth0
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver 
enable_security_group = true
enable_vxlan = false

九、配置DHCP代理

vim /etc/neutron/dhcp_agent.ini

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

十、配置元數據代理

vim /etc/neutron/metadata_agent.ini

nova_metadata_ip = 192.168.56.11
metadata_proxy_shared_secret = oldboy

十一、爲nova-api配置網絡服務

vim /etc/nova/nova.conf

url = http://192.168.56.11:9696
auth_url = http://192.168.56.11:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron

十二、完成安裝後的操做

(1)建立軟連接

網絡服務初始化腳本須要一個超連接 /etc/neutron/plugin.ini指向ML2插件配置文件/etc/neutron/plugins/ml2/ml2_conf.ini。若是超連接不存在,使用下面的命令建立它app

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

(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

(3)重啓nova-api服務

systemctl restart openstack-nova-api.service

(4)啓動neutron,並設置開機啓動

[root@linux-node1 ~]# systemctl enable neutron-server.service \
>   neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
>   neutron-metadata-agent.service

[root@linux-node1 ~]# systemctl start neutron-server.service \
>   neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
>   neutron-metadata-agent.service

1三、在keystone上作服務註冊

在建立以前,要先執行環境變量腳本dom

[root@linux-node1 ~]# source admin-openstack.sh

再建立網絡

[root@linux-node1 ~]# openstack service create --name neutron --description "OpenStack Networking" network
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Networking             |
| enabled     | True                             |
| id          | 8e34c26e3fec40f4bd0bd3f86e20df76 |
| name        | neutron                          |
| type        | network                          |
+-------------+----------------------------------+

建立服務的API endpoint

[root@linux-node1 ~]# openstack endpoint create --region RegionOne   network public http://192.168.56.11:9696
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 7bddf204d5264c678049eef6cc6ab88d |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 8e34c26e3fec40f4bd0bd3f86e20df76 |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://192.168.56.11:9696        |
+--------------+----------------------------------+
[root@linux-node1 ~]# openstack endpoint create --region RegionOne network admin http://192.168.56.11:9696
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | df3c6758c4414671b0978140ee3c6bb2 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 8e34c26e3fec40f4bd0bd3f86e20df76 |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://192.168.56.11:9696        |
+--------------+----------------------------------+
[root@linux-node1 ~]# openstack endpoint create --region RegionOne network internal http://192.168.56.11:9696
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 415f75265c074ac1bdb10b140c1fec8e |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 8e34c26e3fec40f4bd0bd3f86e20df76 |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://192.168.56.11:9696        |
+--------------+----------------------------------+

驗證是否建立成功

[root@linux-node1 ~]# neutron agent-list
+--------------------------------------+--------------------+-------------+-------------------+-------+----------------+---------------------------+
| id                                   | agent_type         | host        | availability_zone | alive | admin_state_up | binary                    |
+--------------------------------------+--------------------+-------------+-------------------+-------+----------------+---------------------------+
| 0324ab11-18a1-4615-83c0-9359d9696655 | Linux bridge agent | linux-node1 |                   | :-)   | True           | neutron-linuxbridge-agent |
| 3c1c33f7-a236-4799-a4cb-00c486bced17 | DHCP agent         | linux-node1 | nova              | :-)   | True           | neutron-dhcp-agent        |
| b23e4246-d1e9-45af-8d20-036d8585ed77 | Metadata agent     | linux-node1 |                   | :-)   | True           | neutron-metadata-agent    |
+--------------------------------------+--------------------+-------------+-------------------+-------+----------------+---------------------------+
相關文章
相關標籤/搜索