主题
Neutron 网络设计 (OVN)
1. OVN 架构
1.1 为什么选择 OVN
| 对比项 | OVS (ML2/OVS) | OVN |
|---|---|---|
| 控制模式 | 分布式 agent | 集中式 + 分布式 |
| 性能 | agent 开销大 | 原生 OVS 转发 |
| 扩展性 | 每节点 agent 开销 | 千节点验证通过 |
| 高可用 | L3 agent HA | 原生 gateway HA |
| 复杂度 | 多个 agent 协同 | 单一架构 |
1.2 OVN 组件部署
┌───────────────────────────────────────────────────────┐
│ OVN 架构 │
│ │
│ ┌─────────────────────────────────────────┐ │
│ │ OVN Northbound DB │ │
│ │ (逻辑网络定义: switch, router, ACL) │ │
│ │ Controller-1 ~ Controller-5 (Raft) │ │
│ └─────────────────┬───────────────────────┘ │
│ │ │
│ ┌─────────────────┴───────────────────────┐ │
│ │ OVN Northd (ovn-northd) │ │
│ │ (逻辑网络 → 逻辑流表) │ │
│ │ Controller-1 ~ Controller-5 │ │
│ └─────────────────┬───────────────────────┘ │
│ │ │
│ ┌─────────────────┴───────────────────────┐ │
│ │ OVN Southbound DB │ │
│ │ (逻辑流表: 实际转发规则) │ │
│ │ Controller-1 ~ Controller-5 (Raft) │ │
│ └─────────────────┬───────────────────────┘ │
│ │ Geneve Tunnel │
│ ┌──────────────┼──────────────┐ │
│ │ │ │ │
│ ┌──┴───┐ ┌───┴───┐ ┌───┴───┐ │
│ │OVN │ │OVN │ │OVN │ (x1000+) │
│ │Ctrl │ │Ctrl │ │Ctrl │ │
│ │Comp-1│ │Comp-2 │ │Comp-N │ │
│ └──────┘ └───────┘ └───────┘ │
└───────────────────────────────────────────────────────┘2. 网络平面设计
2.1 Provider Network (外部网络)
bash
# 创建外部 Provider 网络 (VLAN 模式)
openstack network create external-net \
--external --provider-network-type vlan \
--provider-physical-network physnet1 \
--provider-segment 300
openstack subnet create external-subnet \
--network external-net \
--subnet-range 203.0.113.0/24 \
--gateway 203.0.113.1 \
--allocation-pool start=203.0.113.100,end=203.0.113.254 \
--no-dhcp2.2 Tenant Network (租户网络)
bash
# 租户网络使用 Geneve overlay
openstack network create tenant-net-01
openstack subnet create tenant-subnet-01 \
--network tenant-net-01 \
--subnet-range 10.10.1.0/24 \
--gateway 10.10.1.1 \
--dns-nameserver 10.0.0.53
# 创建路由连接外部网络
openstack router create router-01
openstack router set router-01 --external-gateway external-net
openstack router add subnet router-01 tenant-subnet-012.3 网络安全组
bash
# 基础安全组
openstack security group create sg-base
openstack security group rule create sg-base \
--protocol icmp --remote-ip 0.0.0.0/0
openstack security group rule create sg-base \
--protocol tcp --dst-port 22 --remote-ip 10.0.0.0/8
# Web 服务安全组
openstack security group create sg-web
openstack security group rule create sg-web \
--protocol tcp --dst-port 80 --remote-ip 0.0.0.0/0
openstack security group rule create sg-web \
--protocol tcp --dst-port 443 --remote-ip 0.0.0.0/0
# 数据库安全组 (仅内网)
openstack security group create sg-db
openstack security group rule create sg-db \
--protocol tcp --dst-port 3306 --remote-ip 10.10.0.0/16
openstack security group rule create sg-db \
--protocol tcp --dst-port 5432 --remote-ip 10.10.0.0/163. 大规模网络优化
3.1 OVN 性能调优
ini
# OVN Northd 优化 (controller 节点)
[DEFAULT]
# 增加 worker 数量
ovn-northd-n-threads = 8
# 减少重计算频率
ovn-northd-probe-interval = 150003.2 Geneve 网络优化
bash
# 内核参数优化 (/etc/sysctl.d/99-ovn.conf)
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.core.optmem_max = 65536
net.ipv4.tcp_congestion_control = bbr
net.core.default_qdisc = fq
# MTU 设置 (Geneve 头部 58 bytes)
# 物理网络 MTU=9000 (Jumbo Frame)
# Geneve 隧道 MTU = 9000 - 58 = 8942
# VM 内部 MTU = 8942 - 50 (ethernet) = 8892
# 或使用标准: 物理=9000, VM=14503.3 网络带宽规划
| 流量类型 | 每节点带宽 | 聚合带宽 | 说明 |
|---|---|---|---|
| 管理流量 | 100Mbps | 100Gbps | API、监控 |
| 存储流量 | 1Gbps | 1000Gbps | Ceph RBD IO |
| 租户流量 | 500Mbps | 500Gbps | VM 业务流量 |
| 迁移流量 | 1Gbps | 100Gbps | 热迁移(峰值) |
| 隧道封装 | 500Mbps | 500Gbps | Geneve overlay |
4. 负载均衡 (Octavia)
4.1 Octavia 配置
bash
# 创建负载均衡器
openstack loadbalancer create --name lb-web \
--vip-subnet-id tenant-subnet-01
# 创建监听器
openstack loadbalancer listener create --name listener-http \
--protocol HTTP --protocol-port 80 lb-web
# 创建后端池
openstack loadbalancer pool create --name pool-web \
--lb-algorithm ROUND_ROBIN \
--listener listener-http --protocol HTTP
# 添加成员
openstack loadbalancer member create pool-web \
--address 10.10.1.10 --protocol-port 8080
openstack loadbalancer member create pool-web \
--address 10.10.1.11 --protocol-port 8080
# 健康检查
openstack loadbalancer healthmonitor create pool-web \
--type HTTP --url-path /health \
--delay 5 --timeout 3 --max-retries 35. DNS 服务 (Designate)
bash
# 创建 DNS Zone
openstack zone create example.com. --email admin@example.com
# 添加记录
openstack recordset create example.com. \
--type A --record 203.0.113.100 \
--name api.example.com.
# Neutron 自动 DNS (集成)
# 在 neutron.conf 中启用:
# dns_domain = example.com.