openstack(neutron网络搭建)

							控制节点

进入数据库
#mysql -uroot -proot
创建neutron数据库
>create database neutron
给neutron数据库设置权限
>GRANT ALL PRIVILEGES ON neutron.* TO ‘neutron’@‘localhost’
IDENTIFIED BY ‘NEUTRON_DBPASS’;
>GRANT ALL PRIVILEGES ON neutron.* TO ‘neutron’@’%’
IDENTIFIED BY ‘NEUTRON_DBPASS’;

宣告环境变量
#source openrc
创建neutron用户
#openstack uesr create --domain default --password=neutron neutron
创建角色
#openstack role add --project service --user neutron admin
创建neutron服务
#openstack service create --name neutron
–description “OpenStack Networking” network
创建网络服务API端点
#openstack endpoint create --region RegionOne
network public http://sheng0:9696
#openstack endpoint create --region RegionOne
network internal http://sheng0:9696
#openstack endpoint create --region RegionOne
network admin http://sheng0:9696
下载相关软件
#yum -y install openstack-neutron openstack-neutron-ml2 openvswitch openstack-neutron-openvswitch ebtables
修改配置文件(编辑配置文件之前先cp一份)
#vim /etc/neutron/neutron.conf
配置文件查看neutron配置文件neutron.conf
#vim /etc/neutron/plugins/ml2/ml2_conf.ini
配置文件查看neutron配置文件ml2_conf.ini
#vim /etc/neutron/plugins/ml2/openvswitch_agent.ini
配置文件查看neutron配置文件openvswitch_agent.ini
#vim /etc/neutron/l3_agent.ini
配置文件查看neutron配置文件l3_agent.ini
#vim /etc/neutron/metadata_agent.ini
配置文件查看neutron配置文件metadata_agent.ini
#vim /etc/neutron/dhcp_agent.ini
配置文件查看neutron配置文件dhcp_agent.ini

修改配置nova配置文件
#vim /etc/nova/nova.conf
把里面neutron下相关项目取消注释(具体参考nova配置文件)

创建软链接
# ln -s /etc/neutron/plugins/ml2/ml2_conf.init /etc/neutron/plugin.ini
导入neutron数据库
# 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服务
#systemctl restart openstack-nova-api
启动服务
#systemctl start neutron-server neutron-dhcp-agent openvswitch neutron-openvswitch-agent neutron-metadata-agent
设置开机自启
#systemctl enable neutron-server neutron-dhcp-agent openvswitch neutron-openvswitch-agent neutron-metadata-agent
创建网桥
#ovs-vsctl add-br br-ex
#ovs-vsctl add-port br-ex ens38
启动neutron-l3-agent
#systemctl start neutron-l3-agent.service
设置开机自启
#systemctl enable neutron-l3-agent.service

								计算节点

下载软件
#yum -y install openstack-neutron-openvswitch ebtables ipset
修改配置文件(配置文件cp一份在修改)
#vim /etc/neutron/neutron.conf
配置文件查看neutron配置文件neutron.conf
#vim /etc/neutron/plugins/ml2/openvswitch_agent.ini
配置文件查看neutron配置文件openvswitch_agent.ini

修改nova配置文件
#vim /etc/nova/nova.conf
打开neutron下的注释(最后两个注释掉)具体参考nova配置文件
重启nova服务
#systemctl restart openstack-nova-compute
启动服务
#systemctl start openvswitch neutron-openvswitch-agent
#systemctl enable openvswitch neutron-openvswitch-agent

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@sheng0
[agent]
[cors]
[cors.subdomain]
[database]
connection = mysql+pymysql://neutron:NEUTRON_DBPASS@sheng0/neutron
[keystone_authtoken]
auth_uri = http://sheng0:5000
auth_url = http://sheng0:35357
memcached_servers = sheng0: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://sheng0: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.18.51
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 = sheng0
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]

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@sheng0
[agent]
[cors]
[cors.subdomain]
[database]
#connection = mysql+pymysql://neutron:NEUTRON_DBPASS@sheng0/neutron
[keystone_authtoken]
auth_uri = http://sheng0:5000
auth_url = http://sheng0:35357
memcached_servers = sheng0: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://sheng0: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_agent.ini
[DEFAULT]
[agent]
tunnel_types = vxlan
l2_population = True
[ovs]
tunnel_bridge = br-tun
local_ip = 192.168.18.53
bridge_mappings =
[securitygroup]
firewall_driver = iptables_hybrid
enable_security_group = true
[xenapi]

猜你喜欢

转载自blog.csdn.net/weixin_44248438/article/details/89419765