使用 OVN NB 数据库的 EVPN L3VNI

一种部署示例是运行 OVN BGP Agent,并使用纯三层功能暴露提供商网络和租户网络。

流量流程

下图显示了通过 VRF 到 VM 的南北流量,包括 VRF 路由表中的路由信息。

EVPN l3vpn diagram

在 Host-2 上,外部路由器网关端口 (GW, 172.16.2.12) 以及它暴露的子网 (192.168.0.0/24) 的 IP 地址都会添加到 vrf (vrf-1001) 的路由表中。 此外,任何直接连接到提供商网络的实例也会添加到路由表中。

然后使用 FRR 通过 BGP/EVPN 暴露此 vrf。 从其他节点导入的路由将被添加为 VXLAN 路由,指向桥接器 (br-1001)。

这允许外部路由到达内部 VM,可能通过托管路由器网关端口的主机路由。

配置

frr-bgpd.conf

典型的 FRR BGP 配置如下(例如对于 host-1)

router bgp 64531
  bgp router-id 10.100.100.1
  bgp default l2vpn-evpn

  neighbor rr-peers peer-group
  neighbor rr-peers remote-as internal
  neighbor rr-peers bfd

  neighbor upstream-peers peer-group
  neighbor upstream-peers remote-as internal
  neighbor upstream-peers bfd

  ! Upstream routers (these will most likely expose the default outbound route)
  neighbor 10.100.250.3 peer-group upstream-peers
  neighbor 10.100.250.4 peer-group upstream-peers

  ! Route reflector peers (used for distributing routes between compute nodes)
  neighbor 10.100.50.66 peer-group rr-peers
  neighbor 10.100.51.66 peer-group rr-peers
  neighbor 10.100.52.66 peer-group rr-peers

  address-family l2vpn evpn
    neighbor rr-peers soft-reconfiguration inbound
    neighbor upstream-peers soft-reconfiguration inbound
    advertise-all-vni
  exit-address-family
exit

注意

在我们的最佳实践中,我们使用中央节点上的 FRR 实例作为路由反射器。 如何扩展您的 BGP 网络以及您可能使用的实践超出了本文档示例的范围。

ovn-bgp-agent.conf

要使用 NB 驱动程序和 EVPN L3 模式运行 OVN BGP Agent,建议使用以下配置

[DEFAULT]
# Time (seconds) between re-sync actions.
reconcile_interval = 600

# Time (seconds) between re-sync actions to ensure frr configuration is correct.
# NOTE: This function does not do anything in our setup, so this high interval is fine.
frr_reconcile_interval = 86400

# Expose VM IPs on tenant networks.
expose_tenant_networks = True

# The NB driver is capable of advertising the tenant networks either per
# host or per subnet. So either per /32 or /128 or per subnet like /24.
# Choose "host" as value for this option to advertise per host or choose
# "subnet" to announce per subnet prefix.
advertisement_method_tenant_networks = subnet

# Require SNAT on the router port to be disabled before exposing the tenant
# networks. Otherwise the exposed tenant networks will be reachable from the
# outside, but the connections set up from within the tenant vm will always
# be SNAT-ed by the router, thus be the router ip. When SNAT is disabled,
# OVN will do pure routing without SNAT
require_snat_disabled_for_tenant_networks = True

# Expose only VM IPv6 IPs on tenant networks if they are GUA.
# expose_ipv6_gua_tenant_networks = False

# Driver to be used.
driver = 'nb_ovn_bgp_driver'

# The connection string for the native OVSDB backend.
ovsdb_connection = tcp:127.0.0.1:6640

# Timeout in seconds for the OVSDB connection transaction.
# ovsdb_connection_timeout = 180

# AS number to be used by the Agent when running in BGP mode.
bgp_AS = < CONFIGURE YOUR AS HERE >

# Router ID to be used by the Agent when running in BGP mode.
bgp_router_id = < CONFIGURE YOUR ROUTER ID/IP HERE >

# IP address of local EVPN VXLAN (tunnel) endpoint.
evpn_local_ip = < CONFIGURE YOUR HOST'S EVPN VXLAN IP HERE>

# If enabled, all routes are removed from the VRF table at startup.
clear_vrf_routes_on_startup = False

# Allows to filter on the address scope (optional, comma separated list of uuids)
# address_scopes = 11111111-1111-1111-1111-111111111111,22222222-2222-2222-2222-222222222222

# The exposing mechanism to be used.
exposing_method = 'vrf'

[ovn]
# The connection string for the OVN_Northbound OVSDB.
# Use tcp:IP:PORT for TCP connection.
# Use unix:FILE for unix domain socket connection.
ovn_nb_connection = < CONNECTION STRING TO NB OVN DB>

配置提供商网络

本节假定您已经配置了 OVN,并在主机本身上应用了正确的桥接映射,请参阅 Neutron 文档关于提供商网络。

首先,通过 neutron 创建您的提供商网络

openstack network create my_network \
   --provider-network-type vlan \
   --provider-physical-network physnet1 \
   --provider-segment 123 \
   --mtu 1500 \
   --external \
   --default

然后,通过 Neutron BGPVPN API 或 ovn 命令行配置您的提供商网络

ovn-nbctl set logical-switch < UUID > external_ids:"neutron_bgpvpn\:type"="l3"
ovn-nbctl set logical-switch < UUID > external_ids:"neutron_bgpvpn\:vni"="1001"  # or any other number

现在使用此网络连接路由器(因此更新提供商网络上的 router:external)或在租户之间共享您的网络(shared = True)

并创建一些路由器,或在提供商网络上添加一些实例,以便主机开始暴露网络和/或 IP 地址。

当前已知限制

  • 每个 vni 只能暴露一个 Flat 提供商网络。 建议使用 VLAN 提供商网络。

  • 不要在同一个 VNI 中两次使用相同的 VLAN ID。 类型为 flat 的提供商网络被认为是 vlan 0。

  • 不可能在单独的 VRF 中拥有租户网络(通过网关路由),请确保使用地址范围和子网池来防止 IP 重叠,如果您计划暴露租户网络。

  • 支持类型为 flat 的提供商网络,但受到限制(由于 flat 网络的操作方式),每个桥接映射只能有一个提供商网络。 建议使用类型为 vlan 的提供商网络。 这样也可以更轻松地创建多个提供商网络,而无需为每个提供商网络创建新的桥接映射。

    每个提供商网络都可以分配一个单独的 VNI,因此只要为这些提供商网络使用单独的 VNI,IP 重叠就不是问题。

请参阅 NB BGP 驱动程序的其他已知限制 限制