neutron网络服务部署

安装部署操作

登录数据库
mysql -uroot -p123

建立数据库
CREATE DATABASE neutron;

建立数据库用户,分别允许本地和远程登录
GRANT ALL PRIVILEGES ON neutron.* TO ‘neutron’@‘localhost’
IDENTIFIED BY ‘123’;

GRANT ALL PRIVILEGES ON neutron.* TO ‘neutron’@’%’
IDENTIFIED BY ‘123’;

exit

在openstack中创建用户
openstack user create --domain default --password=neutron neutron

[root@chen1 ~]# openstack user create --domain default --password=neutron neutron
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | fb1eeb5bb4cc4ec0813bd268f667c32a |
| name                | neutron                          |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

设置为管理员
openstack role add --project service --user neutron admin

建立服务
openstack service create --name neutron
–description “OpenStack Networking” network

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

建立服务端点
openstack endpoint create --region RegionOne
network public http://chen1:9696

[root@chen1 ~]# openstack endpoint create --region RegionOne \
>   network public http://chen1:9696
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 4b03c19c877345f99de4e3da4792a6bb |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 98905503fc6c47f18f02d5ec701ddb50 |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://chen1:9696                |
+--------------+----------------------------------+

openstack endpoint create --region RegionOne
network internal http://chen1:9696

[root@chen1 ~]# openstack endpoint create --region RegionOne \
>   network internal http://chen1:9696
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 5649aced85a64573b3354179646ebadd |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 98905503fc6c47f18f02d5ec701ddb50 |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://chen1:9696                |
+--------------+----------------------------------+

openstack endpoint create --region RegionOne
network admin http://chen1:9696

[root@chen1 ~]# openstack endpoint create --region RegionOne \
>   network admin http://chen1:9696
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 89c8ab86f6344e2198a109cbfd51ba0c |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 98905503fc6c47f18f02d5ec701ddb50 |
| service_name | neutron                          |
| service_type | network                          |
| url          | http://chen1:9696                |
+--------------+----------------------------------+

安装相关服务
yum -y install openstack-neutron openstack-neutron-ml2
openvswitch openstack-neutron-openvswitch ebtables

修改配置文件
cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak
vim /etc/neutron/neutron.conf

[DEFAULT]
state_path = /var/lib/neutron
auth_strategy = keystone
core_plugin = ml2
service_plugins = router
dhcp_agent_notification = true
allow_overlapping_ips = True
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
transport_url = rabbit://openstack:admin@chen1 #这里的密码是rabbit消息队列的

[agent]

[cors]

[cors.subdomain]

[database]
connection = mysql+pymysql://neutron:123@chen1/neutron

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

[matchmaker_redis]

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

[oslo_concurrency]
lock_path = $state_path/lock

[oslo_messaging_amqp]

[oslo_messaging_kafka]

[oslo_messaging_notifications]

[oslo_messaging_rabbit]

[oslo_messaging_zmq]

[oslo_middleware]

[oslo_policy]

[qos]

[quotas]

[ssl]

修改权限
cd /etc/neutron
chmod 640 neutron.conf
chown root.neutron neutron.conf

配置ml2文件

同样先备份
cp /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugins/ml2/ml2_conf.ini.bak
vim /etc/neutron/plugins/ml2/ml2_conf.ini

[DEFAULT]

[ml2]
type_drivers = flat,vxlan
tenant_network_types = vxlan
mechanism_drivers = openvswitch,l2population
extension_drivers = port_security

[ml2_type_flat]

[ml2_type_geneve]

[ml2_type_gre]

[ml2_type_vlan]

[ml2_type_vxlan]
vni_ranges = 1:1000

[securitygroup]
enable_ipset = true

赋予权限
chmod 640 ml2_conf.ini
chown root.neutron ml2_conf.ini

配置openvswitch文件
cp /etc/neutron/plugins/ml2/openvswitch_agent.ini /etc/neutron/plugins/ml2/openvswitch_agent.ini.bak
vim /etc/neutron/plugins/ml2/openvswitch_agent.ini

[DEFAULT]

[agent]
tunnel_types = vxlan
l2_population = True

[ovs]
tunnel_bridge = br-tun
local_ip = 192.168.1.37            #第二块网卡IP
bridge_mappings =

[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = true

[xenapi]

配置openstack中虚拟路由器layer-3 agent配置文件
cp /etc/neutron/l3_agent.ini /etc/neutron/l3_agent.ini.bak
vim /etc/neutron/l3_agent.ini

[DEFAULT]
interface_driver = openvswitch
external_network_bridge = br-ex

[agent]

[ovs]

编辑dhcp_agent配置文件
cp /etc/neutron/dhcp_agent.ini /etc/neutron/dhcp_agent.ini.bak
vim /etc/neutron/dhcp_agent.ini

[DEFAULT]
interface_driver = openvswitch
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true

[agent]

[ovs]

编辑metadate文件
cp /etc/neutron/metadata_agent.ini /etc/neutron/metadata_agent.ini.bak
vim /etc/neutron/metadata_agent.ini

[DEFAULT]
nova_metadata_ip = chen1
metadata_proxy_shared_secret = 123

[agent]

[cache]

再将/etc/nova/nova.conf中nova模块的注释打开
vim /etc/nova/nova.conf

[neutron]
url = http://chen1:9696
auth_url = http://chen1:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron
service_metadata_proxy = true
metadata_proxy_shared_secret = 123

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

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

systemctl restart openstack-nova-api.service

开启服务并重启
systemctl enable neutron-server.service neutron-dhcp-agent.service openvswitch neutron-openvswitch-agent neutron-metadata-agent.service

systemctl start neutron-server.service neutron-dhcp-agent.service openvswitch neutron-openvswitch-agent neutron-metadata-agent.service

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

查看列表
neutron agent-list /或者为 openstack network agent list

[root@chen1 ~]# neutron agent-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+------------------+------------------+-------+-------------------+-------+----------------+------------------+
| id               | agent_type       | host  | availability_zone | alive | admin_state_up | binary           |
+------------------+------------------+-------+-------------------+-------+----------------+------------------+
| a733db16-1575-47 | Open vSwitch     | chen1 |                   | :-)   | True           | neutron-         |
| 52-8951-4dff9890 | agent            |       |                   |       |                | openvswitch-     |
| 7b5b             |                  |       |                   |       |                | agent            |
| c5a1c668-cb93-4a | DHCP agent       | chen1 | nova              | :-)   | True           | neutron-dhcp-    |
| 5d-9270-0222cec4 |                  |       |                   |       |                | agent            |
| b74c             |                  |       |                   |       |                |                  |
| c9df87d1-592a-4e | L3 agent         | chen1 | nova              | :-)   | True           | neutron-l3-agent |
| 59-9575-172722ff |                  |       |                   |       |                |                  |
| b3f6             |                  |       |                   |       |                |                  |
| d3130fd7-d403-4d | Metadata agent   | chen1 |                   | :-)   | True           | neutron-         |
| a7-aebb-         |                  |       |                   |       |                | metadata-agent   |
| dcd48f177a3b     |                  |       |                   |       |                |                  |
+------------------+------------------+-------+-------------------+-------+----------------+------------------+

绑定网桥
ovs-vsctl add-br br-ex
查看网桥命令
ovs-vsctl show
neutron网络服务部署_第1张图片

将网桥绑定到我的第三块网卡,ens38
ovs-vsctl add-port br-ex ens38

开启路由功能
systemctl enable neutron-l3-agent.service

systemctl start neutron-l3-agent.service

查看网络服务列表
openstack network agent list

[root@chen1 ~]# openstack network agent list
+--------------------+--------------------+-------+-------------------+-------+-------+-----------------------+
| ID                 | Agent Type         | Host  | Availability Zone | Alive | State | Binary                |
+--------------------+--------------------+-------+-------------------+-------+-------+-----------------------+
| a733db16-1575-4752 | Open vSwitch agent | chen1 | None              | True  | UP    | neutron-openvswitch-  |
| -8951-4dff98907b5b |                    |       |                   |       |       | agent                 |
| c5a1c668-cb93-4a5d | DHCP agent         | chen1 | nova              | True  | UP    | neutron-dhcp-agent    |
| -9270-0222cec4b74c |                    |       |                   |       |       |                       |
| c9df87d1-592a-4e59 | L3 agent           | chen1 | nova              | True  | UP    | neutron-l3-agent      |
| -9575-172722ffb3f6 |                    |       |                   |       |       |                       |
| d3130fd7-d403-4da7 | Metadata agent     | chen1 | None              | True  | UP    | neutron-metadata-     |
| -aebb-dcd48f177a3b |                    |       |                   |       |       | agent                 |
+--------------------+--------------------+-------+-------------------+-------+-------+-----------------------+

计算节点

yum install openvswitch openstack-neutron-openvswitch ebtables ipset

配置文件
cp /etc/neutron/neutron.conf /etc/neutron/neutron.conf.bak
vim /etc/neutron/neutron.conf

[DEFAULT]
#state_path = /var/lib/neutron
auth_strategy = keystone
#core_plugin = ml2
#service_plugins = router
#dhcp_agent_notification = true
#allow_overlapping_ips = True
#notify_nova_on_port_status_changes = true
#notify_nova_on_port_data_changes = true
transport_url = rabbit://openstack:admin@chen1 #这里的密码是rabbit消息队列的

[agent]

[cors]

[cors.subdomain]

[database]
#connection = mysql+pymysql://neutron:123@chen1/neutron

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

[matchmaker_redis]

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

[oslo_concurrency]
lock_path = $state_path/lock

[oslo_messaging_amqp]

[oslo_messaging_kafka]

[oslo_messaging_notifications]

[oslo_messaging_rabbit]

[oslo_messaging_zmq]

[oslo_middleware]

[oslo_policy]

[qos]

[quotas]

[ssl]

编辑openvswitch文件
cp /etc/neutron/plugins/ml2/openvswitch_agent.ini /etc/neutron/plugins/ml2/openvswitch_agent.ini.bak
vim /etc/neutron/plugins/ml2/openvswitch_agent.ini

[DEFAULT]

[agent]
tunnel_types = vxlan
l2_population = True

[ovs]
tunnel_bridge = br-tun
local_ip = 172.168.1.14           #第二块网卡IP
bridge_mappings =

[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = true

[xenapi]

最后重启
systemctl enable openvswitch neutron-openvswitch-agent
systemctl start openvswitch neutron-openvswitch-agent
systemctl stop openvswitch neutron-openvswitch-agent

你可能感兴趣的:(openstack)