Copyright © NIFTY Corporation All Rights Reserved.
VyOSでMPLS
ニフティ株式会社
日下部 雄也
Copyright © NIFTY Corporation All Rights Reserved. 2
自己紹介
 Twitter/GitHub: higebu
 ニフティクラウド
 仮想ネットワーク
 DRサービス with VMware vCloud® Air™
Technology
 その他
 VyOS
 コミット権持ってる
 vyos-users.jp
Copyright © NIFTY Corporation All Rights Reserved. 3
ニフティクラウドとVyOS
 VPNゲートウェイとルーターという機能で
使っている
 数百台動いている
 ちょっと改造してる
 L2フィルタ
 Managed L2TPv3
 その他バグ修正
後輩の蓮沼くん
最近は彼が直している
Copyright © NIFTY Corporation All Rights Reserved. 4
ニフティクラウドとMPLS
 物理ネットワークの人に聞いたところ、
ちょっと使ってるらしい
 MPLSが盛り上がったのは数年前なので今
さら話してもという感じらしい
Copyright © NIFTY Corporation All Rights Reserved. 5
新しいVyOS
 Debian Jessieベース
 Systemd…
 Linux Kernel 4.4系
 MPLS使える
 詳しくはWebで
 http://vyos.net/wiki/Beryllium
 https://www.higebu.com/blog/2016/02/
26/2016-02-26-vyos-beryllium/
Copyright © NIFTY Corporation All Rights Reserved. 6
新しいVyOSを動かす
 ISOからインストールするのが面倒なので、とり
あえずインストール済みのVMイメージを使う
 https://github.com/higebu/vyos-
build/releases/tag/1.2.0-higebu5
 1.2.0正式リリース時にはVMイメージもリリー
スされるはず
Copyright © NIFTY Corporation All Rights Reserved. 7
iproute2をv4.4.0にする
 vyos/vyatta-iprouteというリポジトリがあるの
で、それを使う
 4.4.0にしてビルドしたパッケージはこちら
 https://github.com/higebu/vyatta-
iproute/releases/tag/debian%2F4.4.0-1vyos2
 4.4.0にした方がよくない?と言ったら昨晩本体
も4.4.0になったけどちょっとおかしいので後で
直したい
 未だに”iproute”パッケージしかビルドしてない
 DebianのパッケージがISOに入ってしまってるよう
に見える
 さっき見たら修正したISOできてた
– UnicronNLさん仕事早すぎる
Copyright © NIFTY Corporation All Rights Reserved. 8
iproute2をv4.4.0にする
dpkg -l | grep iproute
ii iproute 1:3.16.0-2 all transitional dummy package for iproute2
ii iproute2 3.16.0-2 amd64 networking and traffic control tools
dpkg -i iproute_4.4.0-1vyos2_all.deb iproute2_4.4.0-
1vyos2_amd64.deb
dpkg -l | grep iproute
ii iproute 1:4.4.0-1vyos2 all transitional dummy package for iproute2
ii iproute2 1:4.4.0-1vyos2 amd64 networking and traffic control tools
※最新のISOを使う場合、この手順はいらないです
Copyright © NIFTY Corporation All Rights Reserved. 9
MPLSを試してみる
 Linux kernel 4.3.0から使えるようになった
 4.4でMultipath routingがサポートされた
 https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.g
it/commit/?id=f8efb73c97e2fa0abbe2e07c5c5df07800312
643
 https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.g
it/commit/?id=1c78efa8319cad2f10f421afa627745fb4d9b
29f
 BrocadeやCumulusの方だ…
 VyOSのカーネルが4.4になって使えそうなので
試してみる
 内容は MPLS testbed on Ubuntu Linux with
kernel 4.3 と同じです
Copyright © NIFTY Corporation All Rights Reserved. 10
MPLSを試してみる
 動くかどうか見たいだけなのでとりあえず1ノー
ドでNetwork Namespace作って試す
netns host1
veth1
netns host2
veth3
veth0 veth2
lo lo
10.3.3.1/24 10.4.4.1/24
10.10.10.1/3210.3.3.2/24 10.4.4.2/2410.10.10.2/32
Label: 111
Label: 112
VyOS
Copyright © NIFTY Corporation All Rights Reserved. 11
MPLSを試してみる
modprobe mpls_router
modprobe mpls_iptunnel
modprobe mpls_gso
sysctl -w net.mpls.platform_labels=1000
モジュールをロードして、ラベルの最大値を設定する
Copyright © NIFTY Corporation All Rights Reserved. 12
MPLSを試してみる
ip link add veth0 type veth peer name veth1
ip link add veth2 type veth peer name veth3
sysctl -w net.mpls.conf.veth0.input=1
sysctl -w net.mpls.conf.veth2.input=1
ifconfig veth0 10.3.3.1/24 up
ifconfig veth2 10.4.4.1/24 up
ip netns add host1
ip netns add host2
ip link set veth1 netns host1
ip link set veth3 netns host2
ip netns exec host1 ifconfig lo 10.10.10.1/32 up
ip netns exec host1 ifconfig veth1 10.3.3.2/24 up
ip netns exec host2 ifconfig lo 10.10.10.2/32 up
ip netns exec host2 ifconfig veth3 10.4.4.2/24 up
ip netns exec host1 ip route add 10.10.10.2/32 encap mpls 112 via inet 10.3.3.1
ip netns exec host2 ip route add 10.10.10.1/32 encap mpls 111 via inet 10.4.4.1
ip -f mpls route add 111 via inet 10.3.3.2
ip -f mpls route add 112 via inet 10.4.4.2
veth作ってnetns作ってmplsの設定をする
Copyright © NIFTY Corporation All Rights Reserved. 13
MPLSを試してみる
ip netns exec host1 ip route
10.3.3.0/24 dev veth1 proto kernel scope link src 10.3.3.2
10.10.10.2 encap mpls 112 via 10.3.3.1 dev veth1
ip netns exec host2 ip route
10.4.4.0/24 dev veth3 proto kernel scope link src 10.4.4.2
10.10.10.1 encap mpls 111 via 10.4.4.1 dev veth3
ip -M route
111 via inet 10.3.3.2 dev veth0
112 via inet 10.4.4.2 dev veth2
ルートが入っているか確認
Copyright © NIFTY Corporation All Rights Reserved. 14
MPLSを試してみる
ip netns exec host2 ping 10.10.10.1 -I 10.10.10.2
PING 10.10.10.1 (10.10.10.1) from 10.10.10.2 : 56(84) bytes of data.
64 bytes from 10.10.10.1: icmp_seq=1 ttl=63 time=0.131 ms
64 bytes from 10.10.10.1: icmp_seq=2 ttl=63 time=0.085 ms
64 bytes from 10.10.10.1: icmp_seq=3 ttl=63 time=0.119 ms
tcpdump -envi veth0
tcpdump: listening on veth0, link-type EN10MB (Ethernet), capture size 262144 bytes
12:31:55.328221 0e:5c:af:ae:ad:68 > 76:3c:bd:ec:13:ac, ethertype IPv4 (0x0800), length
98: (tos 0x0, ttl 63, id 10742, offset 0, flags [DF], proto ICMP (1), length 84)
10.10.10.2 > 10.10.10.1: ICMP echo request, id 2865, seq 27, length 64
12:31:55.328246 76:3c:bd:ec:13:ac > 0e:5c:af:ae:ad:68, ethertype MPLS unicast
(0x8847), length 102: MPLS (label 112, exp 0, [S], ttl 64)
(tos 0x0, ttl 64, id 62371, offset 0, flags [none], proto ICMP (1), length 84)
10.10.10.1 > 10.10.10.2: ICMP echo reply, id 2865, seq 27, length 64
host2のloからhost1のloにping通るか試す(Label: 112)
MPLSのラベルが付いているか確認する
Copyright © NIFTY Corporation All Rights Reserved. 15
今後の予定
 MPLSのコマンド作る?
 早く1.2.0正式版リリースしないと…
 ニフティクラウドのネットワーク周りの機
能アップデートにもご期待ください

VyOSでMPLS

  • 1.
    Copyright © NIFTYCorporation All Rights Reserved. VyOSでMPLS ニフティ株式会社 日下部 雄也
  • 2.
    Copyright © NIFTYCorporation All Rights Reserved. 2 自己紹介  Twitter/GitHub: higebu  ニフティクラウド  仮想ネットワーク  DRサービス with VMware vCloud® Air™ Technology  その他  VyOS  コミット権持ってる  vyos-users.jp
  • 3.
    Copyright © NIFTYCorporation All Rights Reserved. 3 ニフティクラウドとVyOS  VPNゲートウェイとルーターという機能で 使っている  数百台動いている  ちょっと改造してる  L2フィルタ  Managed L2TPv3  その他バグ修正 後輩の蓮沼くん 最近は彼が直している
  • 4.
    Copyright © NIFTYCorporation All Rights Reserved. 4 ニフティクラウドとMPLS  物理ネットワークの人に聞いたところ、 ちょっと使ってるらしい  MPLSが盛り上がったのは数年前なので今 さら話してもという感じらしい
  • 5.
    Copyright © NIFTYCorporation All Rights Reserved. 5 新しいVyOS  Debian Jessieベース  Systemd…  Linux Kernel 4.4系  MPLS使える  詳しくはWebで  http://vyos.net/wiki/Beryllium  https://www.higebu.com/blog/2016/02/ 26/2016-02-26-vyos-beryllium/
  • 6.
    Copyright © NIFTYCorporation All Rights Reserved. 6 新しいVyOSを動かす  ISOからインストールするのが面倒なので、とり あえずインストール済みのVMイメージを使う  https://github.com/higebu/vyos- build/releases/tag/1.2.0-higebu5  1.2.0正式リリース時にはVMイメージもリリー スされるはず
  • 7.
    Copyright © NIFTYCorporation All Rights Reserved. 7 iproute2をv4.4.0にする  vyos/vyatta-iprouteというリポジトリがあるの で、それを使う  4.4.0にしてビルドしたパッケージはこちら  https://github.com/higebu/vyatta- iproute/releases/tag/debian%2F4.4.0-1vyos2  4.4.0にした方がよくない?と言ったら昨晩本体 も4.4.0になったけどちょっとおかしいので後で 直したい  未だに”iproute”パッケージしかビルドしてない  DebianのパッケージがISOに入ってしまってるよう に見える  さっき見たら修正したISOできてた – UnicronNLさん仕事早すぎる
  • 8.
    Copyright © NIFTYCorporation All Rights Reserved. 8 iproute2をv4.4.0にする dpkg -l | grep iproute ii iproute 1:3.16.0-2 all transitional dummy package for iproute2 ii iproute2 3.16.0-2 amd64 networking and traffic control tools dpkg -i iproute_4.4.0-1vyos2_all.deb iproute2_4.4.0- 1vyos2_amd64.deb dpkg -l | grep iproute ii iproute 1:4.4.0-1vyos2 all transitional dummy package for iproute2 ii iproute2 1:4.4.0-1vyos2 amd64 networking and traffic control tools ※最新のISOを使う場合、この手順はいらないです
  • 9.
    Copyright © NIFTYCorporation All Rights Reserved. 9 MPLSを試してみる  Linux kernel 4.3.0から使えるようになった  4.4でMultipath routingがサポートされた  https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.g it/commit/?id=f8efb73c97e2fa0abbe2e07c5c5df07800312 643  https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.g it/commit/?id=1c78efa8319cad2f10f421afa627745fb4d9b 29f  BrocadeやCumulusの方だ…  VyOSのカーネルが4.4になって使えそうなので 試してみる  内容は MPLS testbed on Ubuntu Linux with kernel 4.3 と同じです
  • 10.
    Copyright © NIFTYCorporation All Rights Reserved. 10 MPLSを試してみる  動くかどうか見たいだけなのでとりあえず1ノー ドでNetwork Namespace作って試す netns host1 veth1 netns host2 veth3 veth0 veth2 lo lo 10.3.3.1/24 10.4.4.1/24 10.10.10.1/3210.3.3.2/24 10.4.4.2/2410.10.10.2/32 Label: 111 Label: 112 VyOS
  • 11.
    Copyright © NIFTYCorporation All Rights Reserved. 11 MPLSを試してみる modprobe mpls_router modprobe mpls_iptunnel modprobe mpls_gso sysctl -w net.mpls.platform_labels=1000 モジュールをロードして、ラベルの最大値を設定する
  • 12.
    Copyright © NIFTYCorporation All Rights Reserved. 12 MPLSを試してみる ip link add veth0 type veth peer name veth1 ip link add veth2 type veth peer name veth3 sysctl -w net.mpls.conf.veth0.input=1 sysctl -w net.mpls.conf.veth2.input=1 ifconfig veth0 10.3.3.1/24 up ifconfig veth2 10.4.4.1/24 up ip netns add host1 ip netns add host2 ip link set veth1 netns host1 ip link set veth3 netns host2 ip netns exec host1 ifconfig lo 10.10.10.1/32 up ip netns exec host1 ifconfig veth1 10.3.3.2/24 up ip netns exec host2 ifconfig lo 10.10.10.2/32 up ip netns exec host2 ifconfig veth3 10.4.4.2/24 up ip netns exec host1 ip route add 10.10.10.2/32 encap mpls 112 via inet 10.3.3.1 ip netns exec host2 ip route add 10.10.10.1/32 encap mpls 111 via inet 10.4.4.1 ip -f mpls route add 111 via inet 10.3.3.2 ip -f mpls route add 112 via inet 10.4.4.2 veth作ってnetns作ってmplsの設定をする
  • 13.
    Copyright © NIFTYCorporation All Rights Reserved. 13 MPLSを試してみる ip netns exec host1 ip route 10.3.3.0/24 dev veth1 proto kernel scope link src 10.3.3.2 10.10.10.2 encap mpls 112 via 10.3.3.1 dev veth1 ip netns exec host2 ip route 10.4.4.0/24 dev veth3 proto kernel scope link src 10.4.4.2 10.10.10.1 encap mpls 111 via 10.4.4.1 dev veth3 ip -M route 111 via inet 10.3.3.2 dev veth0 112 via inet 10.4.4.2 dev veth2 ルートが入っているか確認
  • 14.
    Copyright © NIFTYCorporation All Rights Reserved. 14 MPLSを試してみる ip netns exec host2 ping 10.10.10.1 -I 10.10.10.2 PING 10.10.10.1 (10.10.10.1) from 10.10.10.2 : 56(84) bytes of data. 64 bytes from 10.10.10.1: icmp_seq=1 ttl=63 time=0.131 ms 64 bytes from 10.10.10.1: icmp_seq=2 ttl=63 time=0.085 ms 64 bytes from 10.10.10.1: icmp_seq=3 ttl=63 time=0.119 ms tcpdump -envi veth0 tcpdump: listening on veth0, link-type EN10MB (Ethernet), capture size 262144 bytes 12:31:55.328221 0e:5c:af:ae:ad:68 > 76:3c:bd:ec:13:ac, ethertype IPv4 (0x0800), length 98: (tos 0x0, ttl 63, id 10742, offset 0, flags [DF], proto ICMP (1), length 84) 10.10.10.2 > 10.10.10.1: ICMP echo request, id 2865, seq 27, length 64 12:31:55.328246 76:3c:bd:ec:13:ac > 0e:5c:af:ae:ad:68, ethertype MPLS unicast (0x8847), length 102: MPLS (label 112, exp 0, [S], ttl 64) (tos 0x0, ttl 64, id 62371, offset 0, flags [none], proto ICMP (1), length 84) 10.10.10.1 > 10.10.10.2: ICMP echo reply, id 2865, seq 27, length 64 host2のloからhost1のloにping通るか試す(Label: 112) MPLSのラベルが付いているか確認する
  • 15.
    Copyright © NIFTYCorporation All Rights Reserved. 15 今後の予定  MPLSのコマンド作る?  早く1.2.0正式版リリースしないと…  ニフティクラウドのネットワーク周りの機 能アップデートにもご期待ください