routerboard with openflow
DESCRIPTION
RouterBOARD (RB750GL)で OpenFlow動作を確認してみましたTRANSCRIPT
![Page 1: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/1.jpg)
RouterBOARD (RB750GL)で OpenFlow動作を確認してみました
2013.11.16 @ttsubo
![Page 2: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/2.jpg)
自己紹介
2
・通信事業者向けネットワークエンジニアをやってます。 ・最近は、データセンタ系ネットワーク技術動向に興味があり、 OpenStack等のIaaS管理基盤技術を勉強中。 ・さらに、「これからの時代、ネットワーク屋も、プログラミ ング必要だよね。」という風潮に感化されて、OpenFlow プログラミングも勉強中。
@ttsubo
![Page 3: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/3.jpg)
! MMM MMM KKK TTTTTTTTTTT KKK MMMM MMMM KKK TTTTTTTTTTT KKK MMM MMMM MMM III KKK KKK RRRRRR OOOOOO TTT III KKK KKK MMM MM MMM III KKKKK RRR RRR OOO OOO TTT III KKKKK MMM MMM III KKK KKK RRRRRR OOO OOO TTT III KKK KKK MMM MMM III KKK KKK RRR RRR OOOOOO TTT III KKK KKK ! MikroTik RouterOS 6.6 (c) 1999-2013 http://www.mikrotik.com/ ![?] Gives the list of available commands command [?] Gives help on the command and list of arguments ![Tab] Completes the command/word. If the input is ambigous, a second [Tab] gives possible options !/ Move up to base level .. Move up one level /command Use command at the base level
RouterBOARDとは
3
最新RouterOSの バージョンは、”6.6”
http://connpass.com/event/3208/?disp_content=presentation#tabs http://en.wikipedia.org/wiki/MikroTik
自宅ラック勉強会 #15.0 RouterBoard勉強会Vol.1の 資料あたりをご確認ください。
RB2011L-IN
RB750GL
CCR1036-12G-4S
豊富なネットワーク制御機能を有するRouterOSを搭載して おり、最近、OpenFlow対応したそうです。
http://routerboard.jp
¥9,450
¥13,650
¥115,500
![Page 4: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/4.jpg)
RouterOSでのOpenFlow対応
4
Currently RouterOS implements OpenFlow version 1.0.0 required features. Support for newer versions, optional features and switching hardware acceleration are to be added. Current implementation should be considered experimental - NOT production ready and is available for evaluation purposes. Please contact support with feature requests and bug reports. OpenFlow support is available as standalone openflow package. OpenFlow feature overrides regular packet processing functionality - packets that are received on interfaces that are OpenFlow switch ports, will not pass through the regular networking stack unless OpenFlow controller sets up flows that enable this. Due to this care must be taken to not disable access to the device when configuring OpenFlow. Currently only unencrypted TCP is available as the communications channel between RouterOS OpenFlow switch and controller.
http://wiki.mikrotik.com/wiki/Manual:OpenFlow
あくまで、実験用途とのことですが、個人の出費レベル でOpenFlowスイッチが手に入るのは魅力ですよね。
![Page 5: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/5.jpg)
5
ということで、 どの程度、OpenFlow機能が使えるのかを 試してみました
目標感: OpenFlow化したRB750GLで SimpleRouterを実現してみる。
![Page 6: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/6.jpg)
OpenFlowの動作確認シナリオ
6
PC-A PC-B
ARP Request Packet-inPacket-outARP Reply
ICMP_Echo RequestPacket-out
Drop!!Packet-in
ARP RequestARP Reply
FlowMod
ICMP_Echo Request ICMP_Echo RequestICMP (Echo ReplyICMP (Echo Reply
PC-AとPC-B間でのL3通信を実現するために、 IPルーティングな挙動をOpenFlowで動作させてみる
192.168.0.1 192.168.1.1
OFS OFC
Secure Channel
![Page 7: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/7.jpg)
ファーストチャレンジ: 残念ながらNGでした
7
OFS側でのPacket-in処理が実施されなかった
PC-B
Packet-outARP Reply
ICMP_Echo RequestPacket-out
Drop!!Packet-in
ARP RequestARP Reply
FlowMod
ICMP_Echo Request ICMP_Echo RequestICMP (Echo ReplyICMP (Echo Reply
192.168.1.1
ARP Request
ARP Requestを 受信しても Packet-inされない
OFS OFC
Secure Channel
PC-A
192.168.0.1
![Page 8: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/8.jpg)
Features Replyを確認してみると...
8
OFS側でPacket-inが実施されない原因解析として Secure Channel開設フェーズを確認してみた
Hello
Hello
Set Config
Echo Request
Echo Reply
Features Request
Features Reply
Max packets bufferedが “0”となっている!!
OFS OFC
Secure Channel
![Page 9: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/9.jpg)
Max packets buffered
9
/* Switch features. */ struct ofp_switch_features { struct ofp_header header; }; uint64_t datapath_id; uint32_t n_buffers; uint8_t n_tables; uint8_t auxiliary_id; uint8_t pad[2]; /* Datapath unique ID. The lower 48-bits are for a MAC address, while the upper 16-bits are implementer-defined. */ /* Max packets buffered at once. */ /* Number of tables supported by datapath. */ /* Identify auxiliary connections */ /* Align to 64-bits. */ /* Features. */ uint32_t capabilities; /* Bitmap of support "ofp_capabilities". */ uint32_t reserved; }; OFP_ASSERT(sizeof(struct ofp_switch_features) == 32); The datapath_id field uniquely identifies a datapath. The lower 48 bits are intended for the switch MAC address, while the top 16 bits are up to the implementer. An example use of the top 16 bits would be a VLAN ID to distinguish multiple virtual switch instances on a single physical switch. This field should be treated as an opaque bit string by controllers.
The n_buffers field specifies the maximum number of packets the switch can buffer when sending packets to the controller using packet-in messages (see 6.1.2).
OpenFlow Switch Specification Version 1.3.2 7.3 Controller-to-Switch Messages
RouterBoard (RB750GL)によるOpenFlow環境では、 Packet-in処理は対応していないみたい...
![Page 10: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/10.jpg)
ちょっと、動作確認シナリオを改良してみる
10
PC-B
ARP Request Packet-inPacket-outARP Reply
ICMP_Echo RequestPacket-out
Drop!!Packet-in
ARP RequestARP Reply
ICMP_Echo Request ICMP_Echo RequestICMP (Echo ReplyICMP (Echo Reply
Packet-in処理を排除した検証シナリオにて、引き続き、 IPルーティングな挙動をOpenFlowで動作させてみる
192.168.1.1
事前に、PC-A, PC-B側でARP学習 させた上で、OFS側で適切なFlowエントリ を登録しておく。
Packet-outARP Reply
FlowMod
Packet-out ARP Reply
OFS OFC
Secure Channel
PC-A
192.168.0.1
![Page 11: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/11.jpg)
11
PC-A PC-B
ARP Reply
ICMP_Echo Request ICMP_Echo Request
192.168.0.1 192.168.1.1
Packet-outARP Reply
FlowMod
Packet-out
セカンドチャレンジ: 惜しくもNGでした
ICMP_Echo_Reply が受信されない
PC-Aでのping疎通が失敗してしまった
ICMP (Echo ReplyICMP (Echo Reply
OFS OFC
Secure Channel
![Page 12: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/12.jpg)
動作結果を解析してみると...
12
PC-A PC-B
ARP Reply
ICMP_Echo Request ICMP_Echo Request
192.168.0.1 192.168.1.1
Packet-outARP Reply
FlowMod
Packet-out
OFS OFC
Secure Channel
[admin@MikroTik] > openflow flow print detail Flags: I - inactive 0 switch=oflow1 version=1 match="inport:1 dlsrc:7C:C3:A1:87:8F:65 dldst:00:00:00:00:00:01 dltype:0x800 nwdst:192.168.1.1/32" actions="set_dl_src:00:00:00:00:00:02, set_dl_dst:00:1A:80:0A:9E:D4, output:2" info="priority 255, idletimeout 0, hardtimeout 0, cookie 0, removenotify 1" ! 1 switch=oflow1 version=1 match="inport:2 dlsrc:00:1A:80:0A:9E:D4 dldst:00:00:00:00:00:02 dltype:0x800 nwdst:192.168.0.1/32" actions="set_dl_src:00:00:00:00:00:01, set_dl_dst:7C:C3:A1:87:8F:65, output:1" info="priority 255, idletimeout 0, hardtimeout 0, cookie 0, removenotify 1"
Flowエントリは、 正しく設定されていた
![Page 13: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/13.jpg)
13
PC-B
ARP Reply
ICMP_Echo Request ICMP_Echo Request
192.168.1.1
Packet-outARP Reply
FlowMod
Packet-out
Flowエントリの統計情報が、 カウントアップされていない !!
[admin@MikroTik] > openflow flow print stats Flags: I - inactive # SWITCH MATCH BYTES PACKETS DURATION 0 oflow1 inpor... 0 0 3m38s830ms 1 oflow1 inpor... 0 0 3m38s830ms
動作結果を解析してみると...OFS OFC
Secure Channel
PC-A
192.168.0.1
![Page 14: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/14.jpg)
14
動作結果を解析してみると...PC-B
ARP Reply
ICMP_Echo Request ICMP_Echo Request
192.168.1.1
Packet-outARP Reply
FlowMod
Packet-out
PC-B側でパケット キャプチャしてみたところ、 ICMP_Echo_Requestを 受信しているにも関わらず、 ICMP_Echo_Replyを 送信していない
OFS OFC
Secure Channel
PC-A
192.168.0.1
![Page 15: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/15.jpg)
15
ICMP_Echo_Requestを確認してみると…
PC-Aが送信したICMP_Echo_Request がそのままPC-Bに到着していた
PC-A
OFSPC-B
ICMP_Echo Request
192.168.0.1 (7C:C3:A1:87:8F:65)
192.168.1.1 (00:1A:80:0A:9E:D4)Flowエントリ
に従った転送制御 が行われていない !!192.168.0.10
(00:00:00:00:00:01)
![Page 16: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/16.jpg)
Features Replyを確認してみると...
16
OFS側でFlowエントリに従った転送制御が実施されない原因解析として、Secure Channel開設フェーズを再度、確認してみた
Hello
Hello
Set Config
Echo Request
Echo Reply
Features Request
Features Reply
OFS OFCSecure Channel
RouterBOARD (RB750GL)では、 L2/L3ヘッダを更新する処理に対応 していないみたい…
![Page 17: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/17.jpg)
17
目標を変更して、どの程度、OpenFlow機能が 使えるのかを試してみました
目標感: OpenFlow化したRB750GLで SimpleRouterを実現してみる。SimpleSwitch
![Page 18: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/18.jpg)
18
OpenFlowの動作確認シナリオ
PC-B
ARP Request Packet-inPacket-outARP Reply
ICMP_Echo RequestPacket-out
Drop!!Packet-in
ARP RequestARP Reply
ICMP_Echo Request ICMP_Echo RequestICMP (Echo ReplyICMP (Echo Reply
L2/L3ヘッダの更新処理を排除した検証シナリオにて、 L2転送(ダムHUB)な挙動をOpenFlowで動作させてみる
192.168.0.2
OFS側で適切なFlowエントリ を登録しておく。
FlowMod
OFS OFC
Secure Channel
PC-A
192.168.0.1
![Page 19: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/19.jpg)
19
PC-B
ICMP_Echo Request ICMP_Echo Request
192.168.0.2
FlowMod
サードチャレンジ: やっぱりNGでした
PC-Aでのping疎通は成功するが...
ICMP (Echo ReplyICMP (Echo Reply
Flowエントリ に従った転送制御 が行われていない??
OFS OFC
Secure Channel
PC-A
192.168.0.1
tsubois-MacBook-Air:~ t_tsubo2000$ ping 192.168.0.2 PING 192.168.0.2 (192.168.0.2): 56 data bytes 64 bytes from 192.168.0.2: icmp_seq=0 ttl=64 time=0.691 ms 64 bytes from 192.168.0.2: icmp_seq=1 ttl=64 time=0.462 ms 64 bytes from 192.168.0.2: icmp_seq=2 ttl=64 time=0.563 ms 64 bytes from 192.168.0.2: icmp_seq=3 ttl=64 time=0.460 ms 64 bytes from 192.168.0.2: icmp_seq=4 ttl=64 time=0.461 ms
![Page 20: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/20.jpg)
動作結果を解析してみると...
20
[admin@MikroTik] > openflow flow print detail Flags: I - inactive 0 switch=oflow1 version=1 match="inport:1" actions="output:2" info="priority 255, idletimeout 0, hardtimeout 0, cookie 0, removenotify 1" ! 1 switch=oflow1 version=1 match="inport:2" actions="output:1" info="priority 255, idletimeout 0, hardtimeout 0, cookie 0, removenotify 1"
PC-A PC-B
ICMP_Echo Request ICMP_Echo Request
192.168.0.1 192.168.0.2
FlowMod
Flowエントリは、 正しく設定されていた
OFS OFC
Secure Channel
![Page 21: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/21.jpg)
21
PC-A PC-B
ICMP_Echo Request ICMP_Echo Request
192.168.0.1
FlowMod
Flowエントリの統計情報が、 カウントアップされていない !!
[admin@MikroTik] > openflow flow print stats Flags: I - inactive # SWITCH MATCH BYTES PACKETS DURATION 0 oflow1 inport:1 0 0 4m2s430ms 1 oflow1 inport:2 0 0
動作結果を解析してみると...OFS OFC
Secure Channel
192.168.0.2
ICMP (Echo ReplyICMP (Echo Reply
![Page 22: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/22.jpg)
OpenFlow動作まとめ
22
PC-A PC-BFlow テーブル
FlowMod を用いたFlowエントリ 書き込み処理は正しく動作した
Packet-out を用いたパケット送出処理は正しく動作した
Flowエントリにマッチしない 未知パケットのPacket-in 処理は動作しなかった
Flowエントリに従った Forwarding 処理は動作しなかった
OpenFlowプロトコルの挙動を、ひととおり確認してみたが、OpenFlowスイッチ本来のパケット転送が正しく動作しなかった。 まだ実験レベルなので、今後の製品版の出荷に期待したい。
SecureChannel は正しく開設できた
OFS
OFC
![Page 23: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/23.jpg)
参考) Buffaloルータの場合
23
OFS OFCPC-B
ARP Request
Secure Channel
Packet-inPacket-outARP Reply
ICMP_Echo RequestPacket-out
Drop!!Packet-in
ARP RequestARP Reply
FlowMod
ICMP_Echo Request ICMP_Echo RequestICMP (Echo ReplyICMP (Echo Reply
192.168.1.1
ちなみに、Buffalo WHR-G301Nで、L3ルーティング な挙動をOpenFlowで動作させてみたら、一発OKでした!!
Flowエントリ に従った転送制御 が行われていた !!
PC-A
192.168.0.1
![Page 24: RouterBOARD with OpenFlow](https://reader035.vdocuments.net/reader035/viewer/2022081800/55515069b4c905f2288b54bf/html5/thumbnails/24.jpg)
24
BusyBox v1.19.3 (2012-03-24 08:32:17 JST) built-in shell (ash) Enter 'help' for a list of built-in commands. ! _______ ________ __ | |.-----.-----.-----.| | | |.----.| |_ | - || _ | -__| || | | || _|| _| |_______|| __|_____|__|__||________||__| |____| |__| W I R E L E S S F R E E D O M ATTITUDE ADJUSTMENT (bleeding edge, r30406) ---------- * 1/4 oz Vodka Pour all ingredients into mixing * 1/4 oz Gin tin with ice, strain into glass. * 1/4 oz Amaretto * 1/4 oz Triple sec * 1/4 oz Peach schnapps * 1/4 oz Sour mix * 1 splash Cranberry juice ----------------------------------------------------- root@OpenWrt1:~# dpctl dump-flows unix:/var/run/dp0.sock stats_reply (xid=0x430268b9): flags=none type=1(flow) cookie=0, duration_sec=16s, duration_nsec=17000000s, table_id=1, priority=255, n_packets=16, n_bytes=1568, idle_timeout=0,hard_timeout=0,ip,in_port=1,dl_src=7c:c3:a1:87:8f:65,dl_dst=00:00:00:00:00:01,nw_dst=192.168.1.1,actions=mod_dl_src:00:00:00:00:00:02,mod_dl_dst:00:1a:80:0a:9e:d4,output:2 cookie=0, duration_sec=16s, duration_nsec=17000000s, table_id=1, priority=255, n_packets=16, n_bytes=1568, idle_timeout=0,hard_timeout=0,ip,in_port=2,dl_src=00:1a:80:0a:9e:d4,dl_dst=00:00:00:00:00:02,nw_dst=192.168.0.1,actions=mod_dl_src:00:00:00:00:00:01,mod_dl_dst:7c:c3:a1:87:8f:65,output:1 root@OpenWrt1:~#
Flowエントリ に従った転送制御 が行われている !!
OpenFlow化されたBuffalo WHR-G301NでのFlowTable
参考) Buffaloルータの場合