OpenStack-Pike 搭建之Neutron(五)

OpenStack-Pike 搭建之Neutron(五)

Acha
2022-07-14 / 0 评论 / 192 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2022年07月21日,已超过667天没有更新,若内容或图片失效,请留言反馈。

Neutron

安装和配置 控制节点

前置条件

1、创建数据库并授权

  • 使用 root 用户登录数据库
mysql -u root -p000000
  • 创建 neutron 数据库
CREATE DATABASE neutron;
  • neutron 用户对 neutron数据库有所有权限
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \
  IDENTIFIED BY '000000';

GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \
  IDENTIFIED BY '000000';

2、获取 admin 凭证

. admin-openrc

3、创建服务凭证

  • 创建 neutron 用户
openstack user create --domain default --password 000000 neutron
  • 将 service项目 中的 neutron用户 设置为 admin角色
openstack role add --project service --user neutron admin
  • 创建 neutron 服务实体
openstack service create --name neutron --description "OpenStack Networking" network

4、创建 网络服务 API端点

openstack endpoint create --region RegionOne network public http://controller:9696

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

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

配置网络选项(Falt 网络)

[ 配置参考] :https://docs.openstack.org/neutron/latest/configuration/config.html

安装组件

yum install -y openstack-neutron openstack-neutron-ml2 \
  openstack-neutron-linuxbridge ebtables

配置服务组件

配置 neutron.conf

# sed -i.bak '/^#/d;/^$/d' /etc/neutron/neutron.conf

# vim /etc/neutron/neutron.conf

[database]
# 配置数据库访问
connection = mysql+pymysql://neutron:000000@controller/neutron


[DEFAULT]
# 启用 ML2插件并禁用其他插件
core_plugin = ml2
service_plugins =
# 配置RabbitMQ 消息队列访问
transport_url = rabbit://openstack:000000@controller
# 配置身份服务访问
auth_strategy = keystone
# 配置 Networking 以通知 Compute 网络拓扑更改
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true

[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 = 000000

[nova]
# 配置 Networking 以通知 Compute 网络拓扑更改
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = 000000

[oslo_concurrency]
# 配置锁定路径
lock_path = /var/lib/neutron/tmp

配置 ML2插件

配置 ml2_conf.ini

# sed -i.bak '/^#/d;/^$/d' /etc/neutron/plugins/ml2/ml2_conf.ini

# vim /etc/neutron/plugins/ml2/ml2_conf.ini

[ml2]
# 启用平面和 VLAN 网络
type_drivers = flat,vlan
# 禁用自助服务网络
tenant_network_types =
# 启用 Linux 桥接机制
mechanism_drivers = linuxbridge
# 启用端口安全扩展驱动程序
extension_drivers = port_security

[securitygroup]
# 启用 ipset 以提高安全组规则的效率
enable_ipset = true

配置 Linux网桥代理

配置 linuxbridge_agent.ini

# sed -i.bak '/^#/d;/^$/d' /etc/neutron/plugins/ml2/linuxbridge_agent.ini

# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini

[linux_bridge]
# 将Flat网络映射到物理网络接口
physical_interface_mappings = provider:eth0

[vxlan]
# 禁用 VXLAN 覆盖网络
enable_vxlan = false

[securitygroup]
# 启用安全组并配置 Linux 网桥 iptables 防火墙驱动程序
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

配置 DHCP代理

配置 dhcp_agent.ini

# sed -i.bak '/^#/d;/^$/d' /etc/neutron/dhcp_agent.ini

# vim /etc/neutron/dhcp_agent.ini

[DEFAULT] 
# 配置 Linux 网桥接口驱动程序、Dnsmasq DHCP 驱动程序,并启用隔离元数据
interface_driver  =  linuxbridge 
dhcp_driver  =  neutron.agent.linux.dhcp.Dnsmasq 
enable_isolated_metadata  =  true

配置元数据代理

配置 metadata_agent.ini

sed -i.bak '/^#/d;/^$/d' /etc/neutron/metadata_agent.ini

vim /etc/neutron/metadata_agent.ini

[DEFAULT]
# 配置元数据主机和共享密钥
nova_metadata_host = controller
metadata_proxy_shared_secret = 000000

配置计算服务使用网络服务

配置 nova.conf

vim /etc/nova/nova.conf

[neutron]
# 配置访问参数、启用元数据代理和配置密钥
url = http://controller:9696
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = 000000
service_metadata_proxy = true
metadata_proxy_shared_secret = 000000

完成安装

1、创建 plugin.ini 链接

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

2、同步 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

3、重启 nova-api 服务

systemctl restart openstack-nova-api.service

4、启动网络服务设置开机自启

systemctl enable neutron-server.service \
  neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
  neutron-metadata-agent.service

systemctl start neutron-server.service \
  neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
  neutron-metadata-agent.service

5、开启路由转发

[root@controller ~]# vim /etc/sysctl.conf 
net.bridge.bridge-nf-call-iptables = 1
net.ipv6.conf.all.disable_ipv6 = 1

[root@controller ~]# sysctl -p
net.bridge.bridge-nf-call-iptables = 1
net.ipv6.conf.all.disable_ipv6 = 1

安装和配置 计算节点

安装组件

yum install -y openstack-neutron-linuxbridge ebtables ipset

配置通用组件

配置 neutron.conf

# sed -i.bak '/^#/d;/^$/d' /etc/neutron/neutron.conf

# vim /etc/neutron/neutron.conf

[DEFAULT]
# 配置RabbitMQ 消息队列访问
transport_url = rabbit://openstack:000000@controller
# 配置身份服务访问
auth_strategy = keystone

[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 = 000000

[oslo_concurrency]
# 配置锁定路径
lock_path = /var/lib/neutron/tmp

配置网络选项(Flat网络)

配置 linuxbridge_agent.ini

# sed -i.bak '/^#/d;/^$/d' /etc/neutron/plugins/ml2/linuxbridge_agent.ini

# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini

[linux_bridge]
# 将Flat网络映射到物理网络接口
physical_interface_mappings = provider:eth0

[vxlan]
# 禁用 VXLAN 覆盖网络
enable_vxlan = false

[securitygroup]
# 启用安全组并配置 Linux 网桥 iptables 防火墙驱动程序
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

配置计算服务使用网络服务

配置 nova.conf

# vim /etc/nova/nova.conf

[neutron]
# 配置访问参数
url = http://controller:9696
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = 000000

完成安装

1、重启计算服务

systemctl restart openstack-nova-compute.service

2、启动 网桥服务并设置开机自启

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

3、开启路由转发

[root@compute ~]#  vim /etc/sysctl.conf 
net.bridge.bridge-nf-call-iptables = 1
net.ipv6.conf.all.disable_ipv6 = 1

[root@compute ~]# sysctl -p
net.bridge.bridge-nf-call-iptables = 1
net.ipv6.conf.all.disable_ipv6 = 1

0

评论

博主关闭了当前页面的评论