TungstenFabricとVyOSのBGPaaS

Tungsten Fabric の機能の一つに、BGPaaS という機能がある。

ユースケースとしては以下を参照
https://blueprints.launchpad.net/juniperopenstack/+spec/bgp-as-a-service
https://blueprints.launchpad.net/juniperopenstack/+spec/bgp-as-a-service-v2
https://networkop.co.uk/blog/2018/01/02/os-contrail/

今回は、以前構築した k8s+TF4.0 の環境で、
( http://aaabbb-200904.hatenablog.jp/entry/2017/10/15/034243 )
vyos のコンテナを動かし、実際にvrouterとvyos間でbgpがつながり、VRF内の経路がVNFに挿入されることを確認してみる。
※ テスト用の構成であり、実際のユースケースを想定したものではないので、念のため

まず、TFのwebuiから、仮想ネットワークを以下の情報で作成する。

name: vn1
subnet: 10.0.1.0/24

その後、vyos 用のコンテナを、以下の内容で作成する。
※ command と privileged: true を指定しないと、うまく起動できないので注意

apiVersion: v1
kind: Pod
metadata:
  name: vyos1
  labels:
    name: vyos1
  annotations: {
    "opencontrail.org/network" : '{"domain":"default-domain", "project": "default", "name":"vn1"}'
  }
spec:
  containers:
  - name: vyos1
    image: 2stacks/vyos
    command:
      - /sbin/init
    securityContext:
      privileged: true

このあと、vyos 側で以下のコンフィグを投入し、vrouter の gw と、bgp を設定する。

# kubectl exec -it vyos1 vbash
# su - vyos
> configure
# set protocols bgp 65311 neighbor 10.0.1.1 remote-as 64512
# commit
# exit

合わせて、TF側では、以下のように、BGPaaSの設定を実施する。

Configure > Services > BGP as a Service > Create

name: bgpaas11
autonomous system: 65311
virtual machine interface: (vyosのvmiを選択)
advanced options > ip address: 10.0.1.3 (vyosのipを記載)
advanced options > hold time: 180

f:id:aaabbb_200904:20180501181747p:plain

うまくいくと、以下のように、vyos 側でbgpがEstablished になり、TF 内の経路を受け取っていることが確認できる。

vyos@vyos:~$ show ip bgp summary 
BGP router identifier 10.0.1.3, local AS number 65311
IPv4 Unicast - max multipaths: ebgp 1 ibgp 1
RIB entries 1, using 96 bytes of memory
Peers 1, using 4560 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.0.1.1        4 64512       4       5        0    0    0 00:01:11        1

Total number of neighbors 1
vyos@vyos:~$ 

vyos@vyos:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
       I - ISIS, B - BGP, > - selected route, * - FIB route

K>* 0.0.0.0/0 via 10.0.1.1, eth0
C>* 10.0.1.0/24 is directly connected, eth0
B>* 10.0.1.3/32 [20/100] via 10.0.1.1, eth0, 00:00:24     <-- TF VRF内の経路がVNFに挿入されている
C>* 127.0.0.0/8 is directly connected, lo
vyos@vyos:~$ 

また、TF側からは、Monitor > Infrastructure > Control Nodes > (control node名) > Peers から、BGP peerの状態を確認できる。
f:id:aaabbb_200904:20180501181807p:plain