openstack網絡服務neutron

一、環境準備

1、虛擬機準備

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

其中,linux-node1當作控制節點

linux-node2當作計算節點

二、neutron服務

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

三、安裝和配置

1、安裝

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

2、配置

先決條件

(1)創建數據庫

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

創建用戶

3、配置數據庫連接

我們選擇配置公共網絡

connection = mysql+pymysql://neutron:[email protected]/neutron

4、配置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

5、配置rabbitmq

vim /etc/neutron/neutron.conf

rpc_backend = rabbit

rabbit_host = 192.168.56.11
rabbit_userid = openstack
rabbit_password = openstack

6、配置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

7、配置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

8、配置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

9、配置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

10、配置元數據代理

vim /etc/neutron/metadata_agent.ini

nova_metadata_ip = 192.168.56.11
metadata_proxy_shared_secret = oldboy

11、爲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

12、完成安裝後的操作

(1)創建軟鏈接

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

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

13、在keystone上做服務註冊

在創建之前,要先執行環境變量腳本

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章