從裸機到雲端:OpenStack Neutron 介紹 — OVS Self-service Networks

Auto Draft

上篇介紹了 Open vSwitch with Provider Networks 的架構及封包流向,今天這篇會來介紹 Open vSwitch with self-serivce networks。

Open vSwitch: Self-service Networks

架構

上圖為 Open vSwitch – Self-service networks 架構下的整個架構總覽,可以看到那些元件是跑在 controller node 上,哪些是在 compute node 上,哪些是在 network node 上。

這張圖畫出了在單一 untagged (flat) provider network 和單一 self-service networks 下其中所使用的的元件是怎麼串接的。在這個範例中 Instance 跟 DHCP agent 是在同一台的,但是在實際狀況下 DHCP agent 有可能是在其他 compute node 上。

Traffic Flow

這節會介紹在各個狀況下實際封包是如何在架構中流通的。

架構設定

以下是我們預想的架構,有兩個透過 vxlan 隔離的 self-service networks 並且上面各有一台 instance

  • Provider network 1 (VLAN)
    • VLAN ID 101 (tagged)
  • Self-service network 1 (VXLAN)
    • VXLAN ID (VNI) 101
  • Self-service network 2 (VXLAN)
    • VXLAN ID (VNI) 102
  • Self-service router
    • Gateway on the provider network
    • Interface on self-service network 1
    • Interface on self-service network 2
  • Instance 1
  • Instance 2

南北向流量 1:固定 IP 的 Instance

對於具有固定 IPv4 地址的 Instance,網路節點 (network node) 對從 self-service networks 傳到 Internet 等外部網路的南北流量執行 SNAT。 對於具有固定 IPv6 地址的 Instance,網路節點會透過常規的路由將封包送往外部網路。

  • Instance 在 compute node 1 上並使用 self-service network 1
  • Instance 將封包送往外部網路

  • Instance 的網路介面 (1) 透過 veth pair (2) 將封包送往 linux bridge 的 instance port
  • 在 linux bridge 上 iptables (3) 會處理防火牆跟 connection tracking
  • Linux bridge 上的 ovs 介 (4) 面透過 veth pair 將封包送往 OVS integration bridge security group 介面 (5)
  • OVS integration bridge 將封包加上 internal VLAN tag
  • OVS integration bridge int-br-provider patch 介面 (6) 將封包送往 OVS tunnel bridge r patch 介面 (7)
  • OVS tunnel bridge (8) 將封包包入 VNI 101
  • 實體網路介面 (9) 透過 overlay 網路 (10) 將封包送往 network node

封包到達 network node 後:

  • Overlay 網路對應的實體網路介面 (11) 將封包送往 OVS tunnel bridge (12)
  • OVS tunnel bridge 解開 VXLAN 封包並加封包加上 internal tunnel ID
  • OVS tunnel bridge 將 internal tunnel ID 換成 internal VLAN tag
  • OVS tunnel bridge patch port (13) 將封包送往 OVS integration bridge patch port (14)
  • Self-service network 的 OVS integration bridge port (15) 拆掉 internal VLAN tag 並將封包送往路由器 namespace 中的 self-service network interface (16)
    • 在 IPv4 的狀況下,路由器會用 SNAT 將 source IP 改成 router 的 IP 之後將封包投過 provider network 上的 gateway 介面 (17) 送往 gateway。
    • 在 IPv6 的狀況下,路由器會將封包送往 next-hop IP 地址,通常是 provider network 的 gateway,也是會透過 provider network 上的 gateway 介面 (17)
  • 路由器將封包送往路由器的 provider network 對應的 OVS integration bridge 介面 (18)
  • OVS integration 將封包加上 internal VLAN
  • OVS integration bridge 上的 int-br-provider patch port (19) 會將封包送往 OVS provider bridge phy-br-provider patch port (20).
  • OVS Provider bridge 將 internal VLAN tag 換成實際 provider network 的 VLAN tag 101
  • Provider 實體網路介面 (14) 將封包加上 VLAN tag 101 並且送往實體網路設施中 (15)
  • OVS Provider bridge 上的 provider network 介面 (21) 會將封包送往實體網路介面 (22)
  • 實體網路介面將封包送往實體網路設施中的交換器 (23)

後面的部分就跟大家一般網路了解的一樣,封包會在實體網路中被送往 router 後送出去。而封包回程的模式就是整個倒過來。

南北向流量 2:Floating IP 的 Instance

對於具有固定 IPv4 地址的 Instance,網路節點 (network node) 對從 self-service networks 傳到 Internet 等外部網路的南北流量執行 SNAT 並將從外部網路回來的流量進行 DNAT。Floating IP 並不適用於 IPv6。

由於 Instance 出去到外網的封包流向與範例 1 是一樣的,這裡不多做介紹,唯一的區別是 SNAT 的 IP 換成了 floating IP 而不是路由器的 IP。這邊將會介紹從外網回來的流量。

  • Instance 在 compute node 1 上並使用 self-service network 1
  • 外部網路將封包送往 Instance

外網封包到達 network node 後:

  • 實體網路設施 (1) 將封包送往 Provider 實體網路介面 (2)
  • Provider 實體網路介面 (2) 將 VLAN tag 101 拿掉之後送往 OVS provider bridge 上的 provider network port (3)
  • OVS provider bridge 將 VLAN tag 101 換成 internal VLAN tag
  • OVS provider bridge 上的 phy-br-provider port (4) 將封包送往 OVS integration bridge 上的 int-br-provider port (5).
  • OVS integration bridge 上的 provider network port (6) 將 internal VLAN tag 拿掉並且將封包送往 路由器 namespace 中的 provider network interface (7)
    • 在 IPv4 的狀況下,路由器會用 DNAT 將 destination IP 改成 instance 的 IP 之後將封包透過 self-service 介面 (8) 送往 self-service network。
    • 在 IPv6 的狀況下,路由器會將封包送往 next-hop IP 地址,通常是 self-service network 的 gateway,也是會透過 self-service 介面 (8)
  • 路由器將封包送往 OVS integration bridge 對應 self-service network 的介面 (9)
  • OVS integration 將封包加上 internal VLAN
  • OVS tunnel bridge 將 internal tunnel ID 換成 internal VLAN tag
  • OVS integration bridge 上的 patch-tun patch port (10)) 會將封包送往 OVS tunnel bridge patch-int patch port (11)
  • OVS tunnel bridge (12) 將封包包進 VNI 101
  • 實體網路介面 (13) 將 VXLAN 封包透過 overlay 網路 (14) 送往 compute node

封包到達 compute node 後:

  • Overlay 網路對應的實體網路介面 (15) 將封包送往 OVS tunnel bridge (16)
  • OVS tunnel bridge 解開 VXLAN 封包並加封包加上 internal tunnel ID
  • OVS tunnel bridge 將 internal tunnel ID 換成 internal VLAN tag
  • OVS tunnel bridge patch-int port (17) 將封包送往 OVS integration bridge patch-tun patch port (18).
  • OVS integration bridge 將 internal VLAN tag 拿掉
  • OVS integration bridge security group 介面 (19) 將封包送往 Linux bridge 上的 ovs 介面 (20)
  • 在 linux bridge 上 iptables (21) 會處理防火牆跟 connection tracking
  • linux bridge 的 instance port (22) 透過 veth pair 將封包送往Instance 的網路介面 (23)

以上就是使用 Floating IP 時回程封包的流向。

東西向流量 1:在同一個網路下的 instance

  • Instance 1 在 compute node 1 上並使用 self-service network 1
  • Instance 2 在 compute node 2 上並使用 self-service network 1
  • Instance 1 將封包送往 Instance 2

在 compute node 1 上:

  • Instance 的網路介面 (1) 透過 veth pair (2) 將封包送往 linux bridge 的 instance port
  • 在 linux bridge 上 iptables (3) 會處理防火牆跟 connection tracking
  • Linux bridge 上的 ovs 介 (4) 面透過 veth pair 將封包送往 OVS integration bridge security group 介面 (5)
  • OVS integration bridge 將封包加上 internal VLAN tag
  • OVS integration bridge int-br-provider patch 介面 (6) 將封包送往 OVS tunnel bridge r patch 介面 (7)
  • OVS tunnel bridge (8) 將封包包入 VNI 101
  • 實體網路介面 (9) 透過 overlay 網路 (10) 將封包送往 compute node 2

到達 compute node 2 上後:

  • Overlay 網路對應的實體網路介面 (11) 將封包送往 OVS tunnel bridge (12)
  • OVS tunnel bridge 解開 VXLAN 封包並加封包加上 internal tunnel ID
  • OVS tunnel bridge 將 internal tunnel ID 換成 internal VLAN tag
  • OVS tunnel bridge patch-int port (13) 將封包送往 OVS integration bridge patch-tun patch port (14).
  • OVS integration bridge 將 internal VLAN tag 拿掉
  • OVS integration bridge security group 介面 (15) 封包送往 Linux bridge 上的 ovs 介面 (16)
  • 在 linux bridge 上 iptables (17) 會處理防火牆跟 connection tracking
  • linux bridge 的 instance port (18) 透過 veth pair 將封包送往 Instance 的網路介面 (19)

東西向流量 2:在不同一個網路下的 instance

  • Instance 1 在 compute node 1 上並且用 self-service network 1
  • Instance 2 在 compute node 1 上並且用 self-service network 2
  • Instance 1 將封包送往 Instance 2

在 compute node 上:

  • Instance 的網路介面 (1) 透過 veth pair (2) 將封包送往 linux bridge 的 instance port
  • 在 linux bridge 上 iptables (3) 會處理防火牆跟 connection tracking
  • Linux bridge 上的 ovs 介 (4) 面透過 veth pair 將封包送往 OVS integration bridge security group 介面 (5)
  • OVS integration bridge 將封包加上 internal VLAN tag
  • OVS integration bridge int-br-provider patch 介面 (6) 將封包送往 OVS tunnel bridge r patch 介面 (7)
  • OVS tunnel bridge (8) 將封包包入 VNI 101
  • 實體網路介面 (9) 透過 overlay 網路 (10) 將封包送往 network node

封包到達 network node 後:

  • Overlay 網路對應的實體網路介面 (11) 將封包送往 OVS tunnel bridge (12)
  • OVS tunnel bridge 解開 VXLAN 封包並加封包加上 internal tunnel ID
  • OVS tunnel bridge 將 internal tunnel ID 換成 internal VLAN tag
  • OVS tunnel bridge patch port (13) 將封包送往 OVS integration bridge patch-tun patch port (14)
  • Self-service network 1 的 OVS integration bridge port (15) 拆掉 internal VLAN tag 並將封包送往路由器 namespace 中的 self-service network 1 interface (16)
  • 路由器會將封包送往 next-hop IP 地址,通常透過 self-service network 2 interface (17) 送往 self-service network 2 的 gateway
  • 路由器將封包送往路由器的 self-service network 2 對應的 OVS integration bridge 介面 (18)
  • OVS integration 將封包加上 internal VLAN
  • OVS integration bridge 將 internal VLAN tag 換成 internal tunnel ID
  • OVS integration bridge 上的 patch-tun patch port (19) 會將封包送往 OVS tunnel bridge patch-int patch port (20).
  • OVS tunnel bridge (21) 將封包包進 VNI 102
  • 實體網路介面 (22) 將 VXLAN 封包透過 overlay 網路 (23) 送往 compute node

封包回到 compute node 後:

  • Overlay 網路對應的實體網路介面 (24) 將封包送往 OVS tunnel bridge (25)
  • OVS tunnel bridge 解開 VXLAN 封包並加封包加上 internal tunnel ID
  • OVS tunnel bridge 將 internal tunnel ID 換成 internal VLAN tag
  • OVS tunnel bridge patch-int patch port (26) 將封包送往 OVS integration bridge patch-tun patch port (27).
  • OVS integration bridge 將 internal VLAN tag 拿掉
  • OVS integration bridge security group 介面 (28) 封包送往 Linux bridge 上的 ovs 介面 (29)
  • 在 linux bridge 上 iptables (30) 會處理防火牆跟 connection tracking
  • linux bridge 的 instance port (31) 透過 veth pair 將封包送往Instance 的網路介面 (32)

以上就是各種狀況下 Open vSwitch self service networks 的封包流量。

小結

本篇介紹了 Open vSwitch self service networks 下的架構跟封包流向,同樣的在了解網路封包怎麼流之後會讓你在 debug 網路不通時有更好的概念。而下一篇仍然會是 Neutron,但是這次會介紹一個比較新的 plug-in,OVN plug-in 的架構。


Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.

Leave a Reply