neutron控制节点

首先巡检
内存,free-h
磁盘,df -h
cpu检测top,ps
70告警,80中度告警
内存已满清除错误日志
/var/log/mailog
编写计划任务

检测openstack
systemctl status httpd | grep active
systemctl status rabbitmq-server.service | grep active
systemctl status mariadb| grep active
systemctl status memcached.service | grep active
rabbitmqctl cluster_status
nova list
systemctl status openstack-glance-registry.service openstack-glance-api.service| grep active
nova service-list


环境前部署
节点zxw6三块网卡
root@zxw6 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens38
HWADDR=00:0C:29:5C:6C:B2
TYPE=Ethernet
IPV6INIT=no
NAME=ens38
UUID=8656cb7b-4b13-377a-be81-796a0b19085c
ONBOOT=yes
AUTOCONNECT_PRIORITY=-999

 

 

 

第一步:创建neutron数据库和用户
[root@zxw6 ~]# mysql -uroot -p123
create database neutron;
grant all on neutron.* to 'neutron'@'loaclhost' identified by'zxw6';
grant all on neutron.* to 'neutron'@'%' identified by'zxw6';


登录到openstack界面


第二步:创建neutron用户
[root@zxw6 ~]# openstack user create --domain default --password=zxw6 neutron
+---------------------+----------------------------------+
| Field | Value |
+---------------------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | 0778712d47f844a9ab20cd34e1b9baf0 |
| name | neutron |
| options | {} |
| password_expires_at | None |
+---------------------+----------------------------------+

第三步:在service项目添加neutron用户到admin角色
[root@zxw6 ~]# openstack role add --project service --user neutron admin

第三步:创建项目
[root@zxw6 ~]# openstack service create --name neutron --description "OpenStack Networking" network
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Networking |
| enabled | True |
| id | 84bbbe38ac374ed38acaa1808cc11dbe |
| name | neutron |
| type | network |

第四步:创建服务节点9696

[root@zxw6 ~]# openstack endpoint create --region RegionOne \
network public http://zxw6:9696
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 9117edf4faef4c3f9e606107cb3f2f61 |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 84bbbe38ac374ed38acaa1808cc11dbe |
| service_name | neutron |
| service_type | network |
| url | http://zxw6:9696 |


[root@zxw6 ~]# openstack endpoint create --region RegionOne \
network internal http://zxw6:9696
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 4f673d1bd6f74babae231a951068e7e9 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 84bbbe38ac374ed38acaa1808cc11dbe |
| service_name | neutron |
| service_type | network |
| url | http://zxw6:9696 |
+--------------+----------------------------------+

root@zxw6 ~]# openstack endpoint create --region RegionOne network admin http://zxw6:9696
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | 161f83bfcbfd46b0874f40abc230b785 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 84bbbe38ac374ed38acaa1808cc11dbe |
| service_name | neutron |
| service_type | network |
| url | http://zxw6:9696 |
+--------------+----------------------------------+


第四步:下载nuetron安装包
[root@zxw6 ~]# yum install openstack-neutron openstack-neutron-ml2 openvswitch openstack-neutron-openvswitch ebtables -y

第五步:修改配置文件
[root@zxw6 ~]# cat /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:zxw6@zxw6

[agent]

[cors]

[cors.subdomain]

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

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

[matchmaker_redis]

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

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


修改ml2的配置文件
[root@zxw6 ml2]# pwd
/etc/neutron/plugins/ml2
root@zxw6 ml2]# vim ml2_conf.ini

[DEFAULT]
[ml2]
type_drivers = flat,vxlan
tenant_network_types = vxlanmechanism_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

修改openvswitch_agent的配置文件
[root@zxw6 ml2]# pwd
/etc/neutron/plugins/ml2

[root@zxw6 ml2]# vim openvswitch_agent.ini

[DEFAULT]
 
[agent]
tunnel_types = vxlan
l2_population = True
 
[ovs]tunnel_bridge = br-tun
local_ip = 192.168.92.135
bridge_mappings =
 
[securitygroup]
firewall_driver = iptables_hybridenable_security_group = true
 
[xenapi]


修改 l3_agent.ini的配置文件
[root@zxw6 neutron]# pwd
/etc/neutron
[root@zxw6 neutron]# vim l3_agent.ini

[DEFAULT]
interface_driver = openvswitch
external_network_bridge = br-ex
 
[agent]
 
[ovs]


修改 dhcp的配置文件
[root@zxw6 neutron]# pwd
/etc/neutron
[root@zxw6 neutron]# vim dhcp_agent.ini

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

修改 metadata_agent的配置文件元数据

[root@zxw6 neutron]# vim metadata_agent.ini

[DEFAULT]
nova_metadata_ip = zxw6
metadata_proxy_shared_secret = METADATA_SECRET
 
[agent]
 
[cache]

第六步:编辑配置文件nova
[root@zxw6 nova]# vim /etc/nova/nova.conf

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

 

 

 

 

 


第七步:软连接ml2_conf.ini到plugin.ini
[root@zxw6 nova]# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

第八步:导入neutron的数据库
[root@zxw6 ~]# 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


第九步:重启nova_api服务
[root@zxw6 ~]# systemctl restart openstack-nova-api.service

第十步:启动所有服务
[root@zxw6 ~]# systemctl start neutron-server.service neutron-dhcp-agent.service openvswitch neutron-openvswitch-agent neutron-metadata-agent.service

[root@zxw6 ~]# systemctl enable neutron-server.service neutron-dhcp-agent.service openvswitch neutron-openvswitch-agent neutron-metadata-agent.service

[root@zxw6 ~]# systemctl status neutron-server.service neutron-dhcp-agent.service openvswitch neutron-openvswitch-agent neutron-metadata-agent.service | grep active
Active: active (running) since 四 2019-08-01 22:55:24 CST; 1min 33s ago
Active: active (running) since 四 2019-08-01 22:56:56 CST; 1s ago
Active: active (exited) since 四 2019-08-01 22:55:12 CST; 1min 45s ago
Active: active (running) since 四 2019-08-01 22:56:55 CST; 2s ago
Active: active (running) since 四 2019-08-01 22:56:57 CST; 147ms ago

第十一步:创建br-ex的网桥
[root@zxw6 ~]# ovs-vsctl add-br br-ex

[root@zxw6 ~]# ovs-vsctl show
65eb7fce-e6b1-48ce-971f-3192e21103d6
Bridge br-ex
Port br-ex
Interface br-ex
type: internal
ovs_version: "2.9.0"


第十二步:添加ens38到br-ex网桥
[root@zxw6 ~]# ovs-vsctl add-port br-ex ens38
[root@zxw6 ~]# ovs-vsctl show
65eb7fce-e6b1-48ce-971f-3192e21103d6
Bridge br-ex
Port br-ex
Interface br-ex
type: internal
Port "ens38"
Interface "ens38"
ovs_version: "2.9.0"2019-08-14
[root@zxw6 ~]# 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 |
+------------------------+--------------------+------+-------------------+-------+----------------+-------------------------+
| 5e559f85-fabf-4695-a75 | DHCP agent | zxw6 | nova | :-) | True | neutron-dhcp-agent |
| 8-95a605c374e6 | | | | | | |
| 6d9dd18e-bba8-4546-99e | Open vSwitch agent | zxw6 | | :-) | True | neutron-openvswitch- |
| 4-d4cfe27bfea9 | | | | | | agent |
| 98ce7a22-eae1-4727-811 | Metadata agent | zxw6 | | :-) | True | neutron-metadata-agent |
| 4-eed65c1703f3 | | | | | | |
+------------------------+--------------------+------+-------------------+-------+----------------+-------------------------+

第十三步:启动l3-agent服务
[root@zxw6 ~]# systemctl start neutron-l3-agent.service
[root@zxw6 ~]# systemctl enable neutron-l3-agent.service
Created symlink from /etc/systemd/system/multi-user.target.wants/neutron-l3-agent.service to /usr/lib/systemd/system/neutron-l3-agent.service.

 

四: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@controller
 
[agent]
 
[cors]
 
[cors.subdomain]
 
[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 = neutron
 
[matchmaker_redis]
 
[nova]
region_name = RegionOne
auth_url = http://controller: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]
 
 
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

openvswitch_agent.ini
[DEFAULT]
 
[agent]
tunnel_types = vxlan
l2_population = True
 
[ovs]
tunnel_bridge = br-tun
local_ip = 192.168.254.63
bridge_mappings =
 
[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = true
 
[xenapi]
 
l3_agent.ini
[DEFAULT]
interface_driver = openvswitch
external_network_bridge = br-ex
 
[agent]
 
[ovs]
 
metadata_agent.ini
[DEFAULT]
nova_metadata_ip = controller
metadata_proxy_shared_secret = METADATA_SECRET
 
[agent]
 
[cache]
 
dhcp_agent.ini
[DEFAULT]
interface_driver = openvswitch
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true
 
[agent]
 
[ovs]
 
注意:配置完配置文件后,提前准备ovs外网用的网桥,之后同步数据库,启动服务:
(控制)yum install openstack-neutron openstack-neutron-ml2 openvswitch openstack-neutron-openvswitch ebtables -y
 
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
 
ovs-vsctl add-br br-ex
 
ovs-vsctl add-port br-ex eth2
 
systemctl enable neutron-l3-agent.service
 
systemctl start neutron-l3-agent.service
 
(计算)yum install openvswitch openstack-neutron-openvswitch ebtables ipset
systemctl enable openvswitch neutron-openvswitch-agent
systemctl start openvswitch neutron-openvswitch-agent
systemctl stop openvswitch neutron-openvswitch-agent

 

posted on 2019-08-14 08:50  我就是我没毛病  阅读(947)  评论(0编辑  收藏  举报

导航