compute节点
安装软件包
yum -y install openstack-neutron-linuxbridge ebtables ipset
修改配置文件:/etc/neutron/neutron.conf
#查看文件属性
ll /etc/neutron/neutron.conf
-rw-r----- 1 root neutron ... /etc/neutron/neutron.conf
#备份配置文件
cp /etc/neutron/neutron.conf{,.bak}
#重新生成配置文件
egrep -v '^#|^$' /etc/neutron/neutron.conf.bak > /etc/neutron/neutron.conf
#查看文件属性
ll /etc/neutron/neutron.conf
-rw-r----- 1 root neutron ... /etc/neutron/neutron.conf
#修改文件内容
vi /etc/neutron/neutron.conf
#指定连接的rabbitmq的用户密码123,指定使用keystone认证[DEFAULT]transport_url = rabbit://openstack:123@controllerauth_strategy = keystone#配置keystone认证信息,注意将用户neutron密码改为:123[keystone_authtoken]www_authenticate_uri = http://controller:5000auth_url = http://controller:5000memcached_servers = controller:11211auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultproject_name = serviceusername = neutronpassword = 123#配置锁路径[oslo_concurrency]lock_path = /var/lib/neutron/tmp
创建provider提供商网络
根据官方文档提供的创建实例的时候提供了两种网络,一种是
provider
, 一种是self-service
;
provider network
又称为运营商网络,
self-service network
又称为租户网络;
参考地址:
https://docs.openstack.org/neutron/train/install/compute-install-option1-rdo.html
compute节点
修改linuxbridge(网桥)插件配置文件:/etc/neutron/plugins/ml2/linuxbridge_agent.ini
#查看文件属性
ll /etc/neutron/plugins/ml2/linuxbridge_agent.ini
-rw-r----- 1 root neutron ...6524 5月 11 2021 /etc/neutron/plugins/ml2/linuxbridge_agent.ini
#备份配置文件
cp /etc/neutron/plugins/ml2/linuxbridge_agent.ini{,.bak}
#重新生成配置文件
egrep -v '^#|^$' /etc/neutron/plugins/ml2/linuxbridge_agent.ini.bak > /etc/neutron/plugins/ml2/linuxbridge_agent.ini
#查看文件属性
ll /etc/neutron/plugins/ml2/linuxbridge_agent.ini
#修改文件内容
vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]# 指定桥接网络provider与本机ens34物理网卡做关联 ,后期给虚拟机分配 external(外部)网络地址,然后虚拟机就可以通过ens34上外网;桥接的物理网卡名有可能是bind0、br0等physical_interface_mappings = provider:ens34[vxlan]#不启用vxlanenable_vxlan = false[securitygroup]#启用安全组并配置 Linux 桥接 iptables 防火墙驱动enable_security_group = truefirewall_driver =neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
确保系统内核支持网桥过滤器
#加载modprobe br_netfilter网桥过滤器模块modprobe br_netfilter && lsmod | grep br_netfilterbr_netfilter 22256 0bridge 151336 1 br_netfilter#修改内核配置文件/etc/sysctl.conf,开启ipv4与ipv6的网络过滤功能vim /etc/sysctl.conf...net.bridge.bridge-nf-call-iptables = 1net.bridge.bridge-nf-call-ip6tables = 1#重新加载配置文件sysctl -p
修改
nova
配置文件,用于
neutron
交互,配置文件: /etc/nova/nova.conf
vim /etc/nova/nova.conf#指定neutron用户密码:123[neutron]auth_url = http://controller:5000auth_type = passwordproject_domain_name = defaultuser_domain_name = defaultregion_name = RegionOneproject_name = serviceusername = neutronpassword = 123
重启
nova-api
服务
systemctl restart openstack-nova-compute.service
开启neutron服务、设置开机自启动
systemctl enable neutron-linuxbridge-agent.servicesystemctl start neutron-linuxbridge-agent.servicesystemctl is-active neutron-linuxbridge-agent.service
服务验证
controller节点
切换
admin
身份查看下网络服务
source admin-openrc
openstack network agent list
到这里为止我们的网络服务neutron就搭建完毕了,现在我们的OpenStack环境就已经达到了启动实例的条件了。