CentOS部署OpenStack过程-网络服务

控制节点

安装条件

  1. 数据库
# login
mysql -u root
# create database
create database neutron;
# grant privilege
grant all privileges on neutron.* to 'nt_db'@'localhost' identified by 'passwd';
grant all privileges on neutron.* to 'nt_db'@'192.168.122.%' identified by 'passwd';
复制代码
  1. 创建用户
# create user
openstack user create \
--domain default \
--password-prompt neutron
# create role
openstack role add --project service --user neutron admin
复制代码
  1. 创建服务实体
openstack service create \
--name neutron \
--description "OpenStack Networking" network
复制代码
  1. 创建endpoint
# create public endpoint
openstack endpoint create \
--region RegionOne \
network public http://ops-cont:9696
# create internal admin endpoint like public
复制代码

创建私有网络

  1. 安装组件 yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -y
  2. 配置组件
vi /etc/neutron/neutron.conf
# configure database in [database]
connection=mysql+pymysql://nt_db:db_passwd@ops-cont/neutron
# configure ml2 plugin、rabbit、keystone_authtoken in [DEFAULT]
core_plugin=ml2
service_plugins=router
allow_overlapping_ips=True
rpc_backend=rabbit
auth_strategy=keystone
notify_nova_on_port_status_changes=True
notify_nova_on_port_data_changes=True
# configure  [oslo_messaging_rabbit]
[oslo_messaging_rabbit]
rabbit_host=ops-cont
rabbit_userid=openstack
rabbit_password=passwd
# configure keystone_auth in [keystone_authtoken]
auth_uri=http://ops-cont:5000
auth_url=http://ops-cont:35357
memcached_servers=ops-cont:11211
auth_type=password
project_domain_name=default
user_domain_name=default
project_name=service
username=neutron
password=passwd
# configure nova in [nova]
auth_url=http://ops-cont:35357
auth_type=password
region_name=RegionOne
project_domain_name=default
user_domain_name=default
project_name=service
username=nova
password=passwd
# configure lock path in [oslo_concurrency]
lock_path=/var/lib/neutron/tmp
复制代码
  1. 配置ml2插件
vi /etc/neutron/plugins/ml2/ml2.conf.ini
# enable flat,vlan,vxlan in [ml2]
# enable linuxbridge l2
# disable other type_drivers
[ml2]
type_drivers=flat,vlan,vxlan
tenant_network_types=vxlan
mechanism_drivers=linuxbridge,l2population
extension_drivers=port_security
#configure flat network in [ml2_type_flat]
[ml2_type_flat]
flat_networks=provider
# configure vxlan in [ml2_type_vxlan]
[ml2_type_vxlan]
vni_ranges=1:1000
# enable ipset in [securitygroup]
[securitygroup]
enabled_ipset=true
复制代码
  1. 配置linuxbridge代理
vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
# link nic with eth in [linux_bridge]
[linux_bridge]
physical_interface_mappings=provider:eth1
# configure vxlan in [vxlan]
[vxlan]
enable_vxlan=true
local_ip=192.168.122.200
l2_population=true
# configure security in [securitygroup]
[securitygroup]
enable_security_group=true
firewall_driver=neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
复制代码
  1. 配置l3代理
vi /etc/neutron/l3_agent.ini
[DEFAULT]
interface_driver=neutron.agent.linux.interface.BridgeInterfaceDriver
external_network_bridge=
复制代码
  1. 配置DHCP
vi /etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver=neutron.agent.linux.interface.BridgeInterfaceDriver
dhcp_driver=neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata =true
复制代码

配置元数据代理

vi /etc/neutron/metadata_agent.ini
[DEFAULT]
nova_metadata_ip=ops-cont
metadata_proxy_shared_secret=passwd
复制代码

为计算节点配置网络

  1. 配置nova.conf
vi /etc/nova/nova.conf
[neutron]
url=http://ops-cont:9696
auth_url=http://ops-cont:35357
auth_type=password
project_domain_name=default
user_domain_name=default
region_name=RegionOne
project_name=service
username=neutron
password=passwd
service_metadata_proxy=true
metadata_proxy_shared_secret=passwd
复制代码
  1. 创建1个链接 ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
  2. 同步数据库 su -c /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/nemutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
  3. 重启api服务 systemctl restart openstack-nova-api
  4. 启动网络服务
systemctl start neutron-server neutron-linuxbridge-agent neutron-dhcp-agent neutron-metadata-agent neutron-l3-agent
systemctl enable neutron-server neutron-linuxbridge-agent neutron-dhcp-agent neutron-metadata-agent neutron-l3-agent
复制代码

验证操作

在计算节点中的操作完成后,在控制节点中执行验证操作neutron ext-list neutron agent-list,输出结果应该包含控制节点上4个代理和每个计算节点上1个代理

计算节点

  1. 安装组件 yum install openstack-neutron-linuxbridge ebtables ipset -y
  2. 配置组件
vi /etc/neutron/neutron.conf
# disable all connection in [database]
# configure rabbit in [DEFAULT] [oslo_messaging_rabbit]
# configure auth
[DEFAULT]
rpc_backend=rabbit
auth_strategy=keystone
[oslo_messaging_rabbit]
rabbit_host=ops-cont
rabbit_userid=openstack
rabbit_password=passwd
[keystone_authtoken]
auth_uri=http://ops-cont:5000
auth_url=http://ops-cont:35357
memcached_servers=ops-cont:11211
auth_type=password
project_domain_name=default
user_domain_name=default
region_name=RegionOne
project_name=service
username=neutron
password=passwd
[oslo_concurrency]
lock_path=/var/lib/neutron/tmp
复制代码
  1. 为计算节点配置网络服务
vi /etc/nova/nova.conf
[neutron]
url=http://ops-cont:9696
auth_url=http://ops-cont:35357
auth_type=password
projrct_domain_name=default
user_domain_name=default
region_name=RegionOne
project_name=service
username=neutron
password=passwd
复制代码
  1. 重启计算服务 systemctl restart openstack-nova-compute
  2. 启动linuxbridge服务
systemctl start neutron-linuxbridge-agent
systemctl enable neutron-linuxbridge-agent
复制代码

注意

按照官方文档配置后,在计算节点中启动neutron-linuxbridge-agent服务时,会有如下报错:

neutron.plugins.ml2.drivers.linuxbridge.agent.linuxbridge_neutron_agent [-] Tunneling cannot be enabled without the local_ip bound to an interface on the host. Please configure local_ip None on the host interface to be used for tunneling and restart the agent.

根据提示,需要在/etc/neutron/plugins/ml2/linuxbridge-agent.ini中的[vxlan]部分中添加本地ip地址local_ip=192.168.122.100

参考

  1. 私有网络

转载于:https://juejin.im/post/5cff61026fb9a07eb051b8a6

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值