VyOS と Arista で VXLAN 相互接続 (original : 2014/12/24)
この記事は某所で 2014/12/24
に書いた記事のコピーです。
そのため 2017/05/11
時点ではやや古い情報も含まれています。
概要
また Arista ですか? いえ、これは VyOS Advent Calendar 2014 の記事です。
本項でやること
VyOS と Arista で VXLAN 相互接続します。
とはいえ、interoperability で色々痛い目にあってきた人が思うような苦難は全く無いです。
Arista と VyOS では VXLAN で使おうとする dstPort 番号が異なるのですが、VyOS の記事なので敢えて VyOS 側でこれを変えます。
# デファクトスタンダードな openvswitch ではなく、何でニッチなアレ同士で…というツッコミは不可。
前段
VXLAN とは?
VXLAN 相互接続で気にすべき点
事前の鍵交換 phase やらの面倒ごとが無いシンプルなプロトコルなので、2 台で相互接続する分には左程気をつける点は無いです。
今年の Shownet では、各メーカの箱モノで相互接続実験とかやっていて、(以下のスライド 68-75)
これを見ても気にする点は以下くらいだと分かります。
- BUM トラフィック転送方法 (Unicast or Multicast)
- UDP dstport 番号 (4789 or 8472)
- VXLAN カプセリング時の 802.1q tag 取扱い (除去 or そのまま)
1 つ目は製品によってマチマチです。RFC では Multicast 実装が示されています。
2 つ目は、本項でも気にしています。draft で「IANA から UDP ポート番号割り当ててもらわないと~」と言っている時代が長かったからなのか、Linux VXLAN では 8472 が今も使われています。その内どうにかしないと、ってスタンスではあるようです。( Linux/drivers/net/vxlan.c 参照)
現在は IANA から 4789 を割り当てられているので、最近はそれを使っている・過去の経緯を考慮して dstport 変更可能な製品が多いです。
3 つ目は RFC で取り除けと言ってます↓。本項では、access VLAN しか使っていないので、見ていません。
a VTEP SHOULD NOT include an inner VLAN tag on tunnel packets
本項で取り扱う VTEP 実装
VyOS
VyOS なので基本的に Linux ベースです。
VyOS に VXLAN 取り込んだよ、って話は作者の以下資料を参照して下さい。
VXLAN の dstport に関して(の悩みどころ)はスライド 23 に書かれています。
VyOS 1.1.1 現在は普通に動かすと、dstport 8472 で動きます。
Arista
VXLAN が動かない機器群を収容して、自分が VTEP をやる Hardware VTEP です。(本項で使うのは Software 版ですが…)
デフォルトの dstport は 4789 ですが、設定で変更して既存の 8472 に歩み寄ることができます。本項ではやりませんが。
とりあえず、メーカが出している分かり易い資料は以下です。
Arista EOS 自体については、以下の本をオススメしときますね。
Arista Warrior: A Real-World Guide to Understanding Arista Switches and EOS
- 作者: Gary A. Donahue
- 出版社/メーカー: O'Reilly Media
- 発売日: 2012/10/27
- メディア: ペーパーバック
- この商品を含むブログを見る
環境情報など
構成図/環境
以下の構成でやります。全て箱庭の仮想環境です。
赤いテナントと青いテナントを Isolation します、的な。
ルータは multicast routing 出来れば、何でも良いです(VyOS 1.1.1 では不可だけど実装予定には入っているみたい)。 ノードは何でも良いです。
ホスト環境
- ホスト:Windows7 + VirtualBox 4.3.18
VyOS 環境 (VTEP)
- OS:VyOS 1.1.1
- CPU:1Core
- Memory:256MB
Arista 環境 (VTEP)
- Aboot-veos:Aboot-veos-2.1.0
- OS:vEOS-4.14.2F
- CPU:1core
- Memory:1024MB
Firefly 環境 (ルータ)
- OS:12.1X47-D10.4
- CPU:2core
- Memory:2048MB
ノード環境 (4台共)
事前準備
VyOS のデプロイ
以下を参考に作っておきます。2014/12/24 現在の最新版である 1.1.1 を使います。
Arista(vEOS) のデプロイ
以下リンクを参考に作っておきます。公式に、各種ハイパーバイザごとの導入手順詳細とかもあります。
Firefly のデプロイ~ルータモードに変更
以下リンクを参考に作っておきます。(これは VMPlayer 版ですが、各種ハイパーバイザ使えます。)
あと、デフォルトだと firewall 的な動作をして鬱陶しいので、以下を参考にルータモード(俗称)に切り替えておきます。
Ubuntu のデプロイと設定
ノードの OS は別に問わないので、好きに作って IP アドレス設定だけすれば OK です。 VLAN tag とかも食いません。
設定
VyOS の VXLAN 設定
modprobe vxlan に udp_port オプション追記
事前に Linux Kernel と VyOS バージョン確認しておきます。
kotetsu@vtep-vyos01:~$ uname -r 3.13.11-1-amd64-vyos kotetsu@vtep-vyos01:~$ show version Version: VyOS 1.1.1 Description: VyOS 1.1.1 (helium) Copyright: 2014 VyOS maintainers and contributors Built by: maintainers@vyos.net Built on: Sun Dec 7 21:41:28 UTC 2014 Build ID: 1412072141-129950d System type: x86 64-bit Boot via: disk Hypervisor: VirtualBox HW model: VirtualBox HW S/N: 0 HW UUID: EF4B6725-D02A-47D3-8194-BFADF71F9987 Uptime: 23:17:43 up 22:39, 1 user, load average: 0.01, 0.02, 0.05
VXLAN の Kernel module を modprobe する時点で dstport をデフォルトの 8472 から 4789 に変更されるように、以下ファイルを書き換えます。
kotetsu@vyos# ls -alh /opt/vyatta/share/vyatta-cfg/templates/interfaces/vxlan total 20K drwxr-xr-x 3 root root 4.0K Dec 23 00:53 . drwxr-xr-x 16 root root 4.0K Dec 8 06:44 .. -rw-r--r-- 1 root root 1.1K Dec 23 00:53 node.def -rw-r--r-- 1 root root 1.1K Oct 30 17:43 node.def.orig drwxr-xr-x 13 root root 4.0K Dec 8 06:44 node.tag kotetsu@vyos:~$ sudo diff /opt/vyatta/share/vyatta-cfg/templates/interfaces/vxlan/node.def /opt/vyatta/share/vyatta-cfg/templates/interfaces/vxlan/node.def.orig 14c14 < [ -d /sys/module/vxlan ] || sudo modprobe vxlan udp_port=4789 --- > [ -d /sys/module/vxlan ] || sudo modprobe vxlan
CLI で設定
では構成図のように順次設定していきます。
set interfaces ethernet eth2 address '172.16.2.1/24' set interfaces bridge 'br100' set interfaces bridge 'br200' set interfaces ethernet eth3 bridge-group bridge 'br100' set interfaces ethernet eth4 bridge-group bridge 'br200'
set interfaces vxlan vxlan0 bridge-group bridge 'br100' set interfaces vxlan vxlan0 group '239.0.0.1' set interfaces vxlan vxlan0 link 'eth2' set interfaces vxlan vxlan0 vni '10' set interfaces vxlan vxlan1 bridge-group bridge 'br200' set interfaces vxlan vxlan1 group '239.0.0.1' set interfaces vxlan vxlan1 link 'eth2' set interfaces vxlan vxlan1 vni '20'
VyOS が認識しないといけない Arista 側の VTEP IP アドレスは、Arista の Loopback アドレスになるので、StaticRoute を追加しておきます。 #これだと拡張が面倒なので、実環境では DefaultRoute か動的ルーティングを使うことが多い気がします。
set protocols static route 172.16.3.1/32 next-hop '172.16.2.254'
commit
~ save
して設定確認しておきます。
設定確認
kotetsu@vtep-vyos01:~$ show bridge bridge name bridge id STP enabled interfaces br100 0000.0800272ede56 no eth3 vxlan0 br200 0000.0800276532b1 no eth4 vxlan1
kotetsu@vtep-vyos01:~$ show interfaces vxlan Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down Interface IP Address S/L Description --------- ---------- --- ----------- vxlan0 - u/u vxlan1 - u/u kotetsu@vtep-vyos01:~$ ip -d link show vxlan0 10: vxlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue master br100 state UNKNOWN mode DEFAULT group default link/ether 96:3e:2b:62:6a:57 brd ff:ff:ff:ff:ff:ff promiscuity 1 vxlan id 10 group 239.0.0.1 dev eth2 port 32768 61000 ttl 16 ageing 300 kotetsu@vtep-vyos01:~$ ip -d link show vxlan1 15: vxlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue master br200 state UNKNOWN mode DEFAULT group default link/ether 8e:02:68:1e:d2:69 brd ff:ff:ff:ff:ff:ff promiscuity 1 vxlan id 20 group 239.0.0.1 dev eth2 port 32768 61000 ttl 16 ageing 300
Arista(vEOS) の VXLAN 設定
設定
vlan 100,200 interface Ethernet1 description DEV=fw01 IF=ge-0/0/2 no switchport ip address 172.16.1.1/24 ! interface Ethernet2 description DEV=node001 IF=eth2 switchport access vlan 100 ! interface Ethernet3 description DEV=node101 IF=eth2 switchport access vlan 200
以下のように VXLAN インターフェースの source-interface には、Loopback Interface しか適用できません。VyOS などの dev と同じノリで物理IFを指定できるかと思いきや…。
interface Loopback0 ip address 172.16.3.1/32 ! interface Vxlan1 vxlan multicast-group 239.0.0.1 vxlan source-interface Loopback0 vxlan udp-port 4789 vxlan vlan 100 vni 10 vxlan vlan 200 vni 20
このままだと VTEP は 239.0.0.1 宛の通信をどこに投げればいいのか分からないので、Multicast Routing の設定をします。
ip routing ip multicast-routing interface Ethernet1 ip pim sparse-mode ip pim rp-address 172.16.1.254 ip route 172.16.2.0/24 172.16.1.254
設定確認
vtep-arista01#show interfaces vxlan 1 Vxlan1 is up, line protocol is up (connected) Hardware is Vxlan Source interface is Loopback0 and is active with 172.16.3.1 Replication/Flood Mode is multicast Static vlan to vni mapping is [100, 10] [200, 20] Multicast group address is 239.0.0.1 vtep-arista01#show vxlan vtep Remote vteps for Vxlan1: Total number of remote vteps: 0 vtep-arista01#show vxlan counters software Rx bytes for encapsulation : 0 Rx pkts for encapsulation : 0 Encaped bytes : 0 Encaped packets : 0 Tx bytes after encapsulation : 0 Tx pkts after encapsulation : 0 Rx dot1Q Tunnel pkts for encapsulation : 0 Rx bytes after decapsulation : 0 Rx pkts after decapsulation : 0 Decaped bytes : 0 Decaped packets : 0 ARP bytes : 0 ARP packets : 0 Read error for pkts coming in for encapsulation : 0 Discarded runt pkts ( encap side ) : 0 Discard vlan range ( encap eide ) : 0 Discard vlan map ( encap side ) : 0 Discard mlag peer link ( encap side ) : 0 Discarded pkts due to empty flood list : 0 Encap send error : 0 Encap timeout : 0 Discarded runt pkts ( decap side ) : 0 Discard pkts not for vtep ( decap side ) : 0 Discard bytes not for vtep ( decap side ) : 0 Discard pkts with invalid vxlan header : 0 Discard vlan map ( decap side ) : 0 Discard VNI range ( decap side ) : 0 Decap timeout : 0 Decap socket error : 0 ARP send error : 0 vtep-arista01#show vxlan address-table Vxlan Mac Address Table ---------------------------------------------------------------------- Vlan Mac Address Type Prt Vtep Moves Last Move ---- ----------- ---- --- ---- ----- --------- Total Remote Mac Addresses for this criterion: 0 vtep-arista01#show vxlan counters varp arp cache installed: 0 vxlan encapsulated arps: 0 arp reply to vArp mac and vArp vtep: 0 arp reply RX: 0 arp reply head-end-replicated: 0 arp reply TX: 0 arp request decaped and sent: 0 arp cache install err 0 arp request decap and send TX err: 0 unknown cpu port id: 0 packet too short: 0 unexpected ether type: 0 unexpected non IP packet 0 unexpected IP prot 0 unexpected UPD port 0 unexpected inner packet 0 unexpected arp reply 0 invalid IP checksum 0 invalid Vxlan header 0 invalid arp packet 0 unknown vlan to vni mapping 0 unknown source IP 0 no BUM flood list TX err 0 arp reply to Arp agent TX err 0
Firefly の multicast routing 設定
設定
VXLAN の RFC には dense より bidirectional PIM が効果的かもね、と書いてあります。 ガン無視して、ここは簡単な dense 設定でいきます。
set interfaces ge-0/0/2 unit 0 family inet address 172.16.1.254/24 set interfaces ge-0/0/3 unit 0 family inet address 172.16.2.254/24 set routing-options static route 172.16.3.1/32 next-hop 172.16.1.1 set protocols pim interface ge-0/0/2.0 mode dense set protocols pim interface ge-0/0/3.0 mode dense
動作確認
疎通
赤 node 同士、青 node 同士が疎通可能なことを確認します。
この時、VyOS や Arista で tcpdump
かけておき後で確認します。
# 疎通したは良いが、異様に RTT がでかい…。firefly と Arista 間もそんな感じで、ショボいマシンでArista 動かしている所為かも。
$ ping 10.0.0.2 PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=72.9 ms 64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=67.2 ms 64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=63.2 ms 64 bytes from 10.0.0.2: icmp_seq=4 ttl=64 time=163 ms 64 bytes from 10.0.0.2: icmp_seq=5 ttl=64 time=75.7 ms 64 bytes from 10.0.0.2: icmp_seq=6 ttl=64 time=67.2 ms 64 bytes from 10.0.0.2: icmp_seq=7 ttl=64 time=68.8 ms 64 bytes from 10.0.0.2: icmp_seq=8 ttl=64 time=73.7 ms 64 bytes from 10.0.0.2: icmp_seq=9 ttl=64 time=55.3 ms 64 bytes from 10.0.0.2: icmp_seq=10 ttl=64 time=102 ms 64 bytes from 10.0.0.2: icmp_seq=11 ttl=64 time=38.5 ms 64 bytes from 10.0.0.2: icmp_seq=12 ttl=64 time=33.0 ms 64 bytes from 10.0.0.2: icmp_seq=13 ttl=64 time=35.1 ms 64 bytes from 10.0.0.2: icmp_seq=14 ttl=64 time=31.7 ms
~$ ping 10.0.0.2 PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=70.6 ms 64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=62.5 ms 64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=100 ms 64 bytes from 10.0.0.2: icmp_seq=4 ttl=64 time=38.6 ms 64 bytes from 10.0.0.2: icmp_seq=5 ttl=64 time=35.3 ms 64 bytes from 10.0.0.2: icmp_seq=6 ttl=64 time=30.0 ms 64 bytes from 10.0.0.2: icmp_seq=7 ttl=64 time=34.4 ms 64 bytes from 10.0.0.2: icmp_seq=8 ttl=64 time=26.1 ms 64 bytes from 10.0.0.2: icmp_seq=9 ttl=64 time=29.9 ms 64 bytes from 10.0.0.2: icmp_seq=10 ttl=64 time=28.7 ms 64 bytes from 10.0.0.2: icmp_seq=11 ttl=64 time=25.9 ms 64 bytes from 10.0.0.2: icmp_seq=12 ttl=64 time=24.8 ms 64 bytes from 10.0.0.2: icmp_seq=13 ttl=64 time=24.4 ms
$ ping 10.0.0.1 PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=24.3 ms 64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=25.9 ms 64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=28.5 ms 64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=24.7 ms 64 bytes from 10.0.0.1: icmp_seq=5 ttl=64 time=26.2 ms 64 bytes from 10.0.0.1: icmp_seq=6 ttl=64 time=59.4 ms 64 bytes from 10.0.0.1: icmp_seq=7 ttl=64 time=29.0 ms 64 bytes from 10.0.0.1: icmp_seq=8 ttl=64 time=26.9 ms 64 bytes from 10.0.0.1: icmp_seq=9 ttl=64 time=72.5 ms 64 bytes from 10.0.0.1: icmp_seq=10 ttl=64 time=55.1 ms 64 bytes from 10.0.0.1: icmp_seq=11 ttl=64 time=49.7 ms 64 bytes from 10.0.0.1: icmp_seq=12 ttl=64 time=92.5 ms 64 bytes from 10.0.0.1: icmp_seq=13 ttl=64 time=45.3 ms 64 bytes from 10.0.0.1: icmp_seq=14 ttl=64 time=41.3 ms 64 bytes from 10.0.0.1: icmp_seq=15 ttl=64 time=37.7 ms 64 bytes from 10.0.0.1: icmp_seq=16 ttl=64 time=36.7 ms 64 bytes from 10.0.0.1: icmp_seq=17 ttl=64 time=35.3 ms
$ ping 10.0.0.1 PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=26.2 ms 64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=23.4 ms 64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=28.3 ms 64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=73.0 ms 64 bytes from 10.0.0.1: icmp_seq=5 ttl=64 time=65.0 ms 64 bytes from 10.0.0.1: icmp_seq=6 ttl=64 time=62.3 ms 64 bytes from 10.0.0.1: icmp_seq=7 ttl=64 time=112 ms 64 bytes from 10.0.0.1: icmp_seq=8 ttl=64 time=45.6 ms 64 bytes from 10.0.0.1: icmp_seq=9 ttl=64 time=38.3 ms 64 bytes from 10.0.0.1: icmp_seq=10 ttl=64 time=35.6 ms 64 bytes from 10.0.0.1: icmp_seq=11 ttl=64 time=34.9 ms 64 bytes from 10.0.0.1: icmp_seq=12 ttl=64 time=40.1 ms 64 bytes from 10.0.0.1: icmp_seq=13 ttl=64 time=38.3 ms
VTEP状態確認
kotetsu@vtep-vyos01:~$ show interfaces vxlan detail vxlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue master br100 state UNKNOWN group default link/ether fe:61:bc:ca:cd:1d brd ff:ff:ff:ff:ff:ff inet6 fe80::fc61:bcff:feca:cd1d/64 scope link valid_lft forever preferred_lft forever RX: bytes packets errors dropped overrun mcast 117556 1480 0 0 0 0 TX: bytes packets errors dropped carrier collisions 383710 4382 0 0 0 0 vxlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue master br200 state UNKNOWN group default link/ether b2:02:ef:4e:26:d4 brd ff:ff:ff:ff:ff:ff inet6 fe80::b002:efff:fe4e:26d4/64 scope link valid_lft forever preferred_lft forever RX: bytes packets errors dropped overrun mcast 232330 3109 0 0 0 0 TX: bytes packets errors dropped carrier collisions 490658 5270 0 0 0 0
vtep-arista01#show vxlan vtep Remote vteps for Vxlan1: 172.16.2.1 Total number of remote vteps: 1 vtep-arista01#show mac address-table Mac Address Table ------------------------------------------------------------------ Vlan Mac Address Type Ports Moves Last Move ---- ----------- ---- ----- ----- --------- 100 0800.272d.daa2 DYNAMIC Vx1 1 0:14:19 ago 100 0800.27a6.f13d DYNAMIC Et2 1 0:14:22 ago 200 0800.272c.080f DYNAMIC Et3 1 0:11:05 ago 200 0800.27a9.6b58 DYNAMIC Vx1 1 0:10:33 ago Total Mac Addresses for this criterion: 4 Multicast Mac Address Table ------------------------------------------------------------------ Vlan Mac Address Type Ports ---- ----------- ---- ----- Total Mac Addresses for this criterion: 0 vtep-arista01#show vxlan address-table Vxlan Mac Address Table ---------------------------------------------------------------------- Vlan Mac Address Type Prt Vtep Moves Last Move ---- ----------- ---- --- ---- ----- --------- 100 0800.272d.daa2 DYNAMIC Vx1 172.16.2.1 1 0:14:15 ago 200 0800.27a9.6b58 DYNAMIC Vx1 172.16.2.1 1 0:10:28 ago Total Remote Mac Addresses for this criterion: 2 vtep-arista01#show vxlan counters software Rx bytes for encapsulation : 249372 Rx pkts for encapsulation : 2390 Encaped bytes : 249372 Encaped packets : 2390 Tx bytes after encapsulation : 306732 Tx pkts after encapsulation : 2390 Rx dot1Q Tunnel pkts for encapsulation : 0 Rx bytes after decapsulation : 79320 Rx pkts after decapsulation : 733 Decaped bytes : 23664 Decaped packets : 348 ARP bytes : 0 ARP packets : 0 Read error for pkts coming in for encapsulation : 0 Discarded runt pkts ( encap side ) : 0 Discard vlan range ( encap eide ) : 0 Discard vlan map ( encap side ) : 0 Discard mlag peer link ( encap side ) : 0 Discarded pkts due to empty flood list : 0 Encap send error : 0 Encap timeout : 0 Discarded runt pkts ( decap side ) : 1 Discard pkts not for vtep ( decap side ) : 384 Discard bytes not for vtep ( decap side ) : 40980 Discard pkts with invalid vxlan header : 0 Discard vlan map ( decap side ) : 0 Discard VNI range ( decap side ) : 0 Decap timeout : 0 Decap socket error : 0 ARP send error : 0 vtep-arista01# vtep-arista01#show vxlan counters varp arp cache installed: 0 vxlan encapsulated arps: 2 arp reply to vArp mac and vArp vtep: 0 arp reply RX: 0 arp reply head-end-replicated: 0 arp reply TX: 0 arp request decaped and sent: 2 arp cache install err 0 arp request decap and send TX err: 0 unknown cpu port id: 0 packet too short: 0 unexpected ether type: 0 unexpected non IP packet 0 unexpected IP prot 0 unexpected UPD port 0 unexpected inner packet 0 unexpected arp reply 0 invalid IP checksum 0 invalid Vxlan header 0 invalid arp packet 0 unknown vlan to vni mapping 0 unknown source IP 0 no BUM flood list TX err 0 arp reply to Arp agent TX err 0
パケットキャプチャ
特徴的なものをいくつか画面キャプチャで貼っていきます。
↓ node からの BUM トラフィック(ping 実行時最初の ARP)は、設定したマルチキャストアドレスで。
↓ VNI10 側。VTEP 間のユニキャストにカプセリングされているのがよく分かる。また、指定どおり UDP dstport 4789 で動作している。
↓VNI20 側も一緒。