Copyright©2014 NTT corp. All Rights Reserved.
Lagopusで試すFirewall
OpenFlow1.3で実現する
FW運用のテストツール試作
2015/09/29
hibitomo
1Copyright©2014 NTT corp. All Rights Reserved.
はじめに
 今回の内容はTremaday#7で発表した
内容+αです.
 Tremadayでのリクエストにお応えして,
ACLのテスト駆動をデモします.
2Copyright©2014 NTT corp. All Rights Reserved.
Agenda
 Lagopus/OpenFlowについて
 お約束
 TremaDayの内容
 聞いたことある人はごめんなさい
 テスト駆動なFW
 アーキテクチャ
 Ryu certificationと おまじない
 デモ
3Copyright©2014 NTT corp. All Rights Reserved.
コントローラ
SDN?OpenFlow?Lagopus?
 レガシーなネットワーク装置
ルータ
コントロールプレーン
データプレーン
ファイアーウォール
コントロールプレーン
データプレーン
ロードバランサ
コントロールプレーン
データプレーン
 SDN
スイッチ
データプレーン
スイッチ
データプレーン
スイッチ
コントロールプレーン
データプレーン
アプリ
コントローラ
コントロールプレーン
アプリ
プログラマブルAPI
OpenFlowプロトコル
4Copyright©2014 NTT corp. All Rights Reserved.
OpenFlow?
 どういうパケットだったら
 受信ポート番号,パケットヘッダの値(宛先,ソー
ス,各種ID...)
 どういう処理をする
 パケットヘッダの追加,削除,編集
 転送(ユニキャスト,マルチキャスト,ロードバラ
ンシング...)
 コントローラにパケットを転送して処理も可能
OpenFlow コントローラ
コントロールプレーン
OpenFlow
プロトコル
OpenFlow スイッチ
データプレーン
Flow Table
フローパターン アクション
フローパターン アクション カウンター
カウンター
Flow
Table
#2
Flow
Table
#3
Flow
Table
#4
5Copyright©2014 NTT corp. All Rights Reserved.
Lagopus
 OpenFlowスイッチのソフトウェア実装
 汎用x86サーバで動作可能
 高速なパケット処理と幅広いプロトコルに対応
 > 10Gbps
 OpenFlow仕様に幅広く対応
OpenFlow コントローラ
コントロールプレーン
OpenFlow
プロトコル
OpenFlow スイッチ
データプレーン
Flow Table
フローパターン アクション
フローパターン アクション カウンター
カウンター
Flow
Table
#2
Flow
Table
#3
Flow
Table
#4
6Copyright©2014 NTT corp. All Rights Reserved.
ユースケースの例
 SDN Japan 2014での実証実験
 アク セスポイ ント  
■  A Pの識別(V LA N )
■  V ID 毎にQoS制御
PoEスイッチ
インターネット
アクセスポイント
( AP)
La g op u sの役割
7Copyright©2014 NTT corp. All Rights Reserved.
オープンソース
 2014年7月31日に公開
 http://lagopus.github.io/
 開発への参加
 コードの提供 -> GitHub Pull Request
 バグレポート -> GitHub Issues
 議論 -> Developers ML
8Copyright©2014 NTT corp. All Rights Reserved.
Copyright©2014 NTT corp. All Rights Reserved.
Lagopusで試すFirewall
OpenFlow1.3で実現する
FW運用のテストツール試作
2015/09/29
hibitomo
10Copyright©2014 NTT corp. All Rights Reserved.
ところで
 ご覧になったことありますか?
 @stereocatさん, Tremaday #4
http://www.slideshare.net/stereocat55/tremafirewall
11Copyright©2014 NTT corp. All Rights Reserved.
@stereocatさんのスライドです
http://www.slideshare.net/stereocat55/tremafirewall
12Copyright©2014 NTT corp. All Rights Reserved.
@stereocatさんのスライドです
http://www.slideshare.net/stereocat55/tremafirewall
13Copyright©2014 NTT corp. All Rights Reserved.
@stereocatさんのスライドです
http://www.slideshare.net/stereocat55/tremafirewall
14Copyright©2014 NTT corp. All Rights Reserved.
ところで,,,,
 実装はOpenFlow1.0ベース
 RangeはBitmaskでどう表現するの???
 そもそもL4はbitmask掛けれない...
 FWをOpenFlowで表現するのは無理?
 簡単なテストにしか使えない?
Copyright©2014 NTT corp. All Rights Reserved.
Lagopusで試すFirewall
OpenFlow1.3で実現する
FW運用のテストツール試作
Copyright©2014 NTT corp. All Rights Reserved.
Lagopusで試すFirewall
OpenFlow1.3で実現する
FW運用のテストツール試作
ココが違う
17Copyright©2014 NTT corp. All Rights Reserved.
Agenda
 OpenFlow1.3で実現するFirewall
 Range表記のbitmask変換
 TCP/UDPポートのmask適用方法
 実装(テーブル設計)
 FW運用のテストツール試作
 Ryu Certificationの流用
 おまじない
 デモ
18Copyright©2014 NTT corp. All Rights Reserved.
Agenda
 OpenFlow1.3で実現するFirewall
 Range表記のbitmask変換
 TCP/UDPポートのmask適用方法
 実装(テーブル設計)
 FW運用のテストツール試作
 Ryu Certificationの流用
 おまじない
 デモ
19Copyright©2014 NTT corp. All Rights Reserved.
Rangeの表記どうする?
 そもそもTCAMで検索できているはず
 TCAMは{0,1,don’t care}で検索
 RangeもTCAMで検索しているなら,Lagopus
でも検索できるはず.
 再起アルゴリズムで
Range -> Bitmask表記のルールに変換
20Copyright©2014 NTT corp. All Rights Reserved.
例題
0 1
0 1 0 1
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
 0110 ~ 1111 をbitmaskのルールに分割
21Copyright©2014 NTT corp. All Rights Reserved.
例題
0 1
0 1 0 1
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
 0110 ~ 1111 をbitmaskのルールに分割
22Copyright©2014 NTT corp. All Rights Reserved.
Algorithm 簡単(?)に
1. ****が範囲に含まれるかチェック
0 1
0 1 0 1
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
****
23Copyright©2014 NTT corp. All Rights Reserved.
Algorithm 簡単(?)に
2. ****の範囲を2つに分割
0 1
0 1 0 1
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1***0***
24Copyright©2014 NTT corp. All Rights Reserved.
Algorithm 簡単(?)に
3. 1***はRangeに含まれる
0 1
0 1 0 1
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1***0***
25Copyright©2014 NTT corp. All Rights Reserved.
Algorithm 簡単(?)に
2’. 0***を2つに分割
0 1
0 1 0 1
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1***00** 01**
26Copyright©2014 NTT corp. All Rights Reserved.
Algorithm 簡単(?)に
2’’. 01**を2つに分割
0 1
0 1 0 1
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
00** 010* 1***011*
27Copyright©2014 NTT corp. All Rights Reserved.
Algorithm 簡単(?)に
2’’. 01**を2つに分割
0 1
0 1 0 1
0 1 0 1 0 1 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
00** 010* 1***011*
0110 ~ 1111 で表されるレンジは,{011*, 1***}で
表されるルールの集合でちょうどカバー出来る.
28Copyright©2014 NTT corp. All Rights Reserved.
Agenda
 OpenFlow1.3で実現するFirewall
 Range表記のbitmask変換
 TCP/UDPポートのmask適用方法
 実装(テーブル設計)
 FW運用のテストツール試作
 Ryu Certificationの流用
 おまじない
 デモ
29Copyright©2014 NTT corp. All Rights Reserved.
TCP/UDPポートのmask適用方法
 Metadataにコピーする
 しかし,Copy_Fieldは未対応....
Metadata (64bit)L4 srcL4 dst
30Copyright©2014 NTT corp. All Rights Reserved.
TCP/UDPポートのmask適用方法
 単純に書きくだす.
※ルール数が65536 * 2 * 2 = 26万
for i in range(0, 65535):
# SRC
for ip_proto in [6, 17] :
flow = {"table_id":0,"priority":1000,
"actions":[{"type":"WRITE_METADATA","metadata":i << 16,
"metadata_mask":0x00000000FFFF0000}],
"match":{"dl_type":2048,"ip_proto":ip_proto,"tp_src":i}}
mod_flow_entry(datapath, flow, ofproto.OFPFC_ADD)
# DST
...
31Copyright©2014 NTT corp. All Rights Reserved.
Lagopusなら動く
 Lagopusならなんとかしてくれる.
私の戦闘力は
100万です.
32Copyright©2014 NTT corp. All Rights Reserved.
その他の手
 リアクティブに登録しても実現できる
1. TCP/UDPパケットが来たらPacket-In
2. ポート番号のメタデータコピーのルール追加
未登録のPort番号で
あれば,Packet-In
Port番号コピーのルール
+ Packet-Out
コントローラ
スイッチ
データプレーン
コントロールプレーン
33Copyright©2014 NTT corp. All Rights Reserved.
Agenda
 OpenFlow1.3で実現するFirewall
 Rangeの表記どうする?
 TCP/UDPポートどうする?
 実装(テーブル設計)
 FW運用のテストツール試作
 Ryu Certificationの流用
 おまじない
 デモ
34Copyright©2014 NTT corp. All Rights Reserved.
実装
 テーブル設計
 table 0:
 L4 srcポートをmetadataにコピー(32~16bitに)
 table 1:
 L4 dstポートをmetadataにコピー (16~0bitに)
 table 2:
 Range -> Bitmask変換したルール群投入
 マッチしたら落とす or OUTPUT
or Next table (他のアプリケーション)
35Copyright©2014 NTT corp. All Rights Reserved.
実装
 Table 0のルール例
{'priority': 1000, 'table_id': 0,
'match': {'dl_type': 2048, 'ip_proto': 6, 'tp_src': 5},
'actions': [
{'metadata_mask': 4294901760,
‘type': 'WRITE_METADATA',
'metadata': 327680}
]
}
0xFFFF0000
UDP/TCP両方で
ルール登録
0x00050000
36Copyright©2014 NTT corp. All Rights Reserved.
実装
 Table 1のルール例
{'priority': 1000, 'table_id': 1,
'match': {'dl_type': 2048, 'ip_proto': 17, 'tp_dst': 8},
'actions': [
{'metadata_mask': 65535,
'type': 'WRITE_METADATA',
'metadata': 8}
]
}
37Copyright©2014 NTT corp. All Rights Reserved.
実装
 Table 2のルール例
(アドレスに意味はありません)
{"table_id":2,"priority":65535,"cookie":0,
"actions":[],
"match":{
"dl_type":2048,
"ipv4_src":“192.168.1.10/255.255.255.240",
"ipv4_dst":“192.168.1.171/255.255.255.240",
"ip_proto":17,
"metadata":"0x0000000000580050/0x00000000ffffffff"}
}
38Copyright©2014 NTT corp. All Rights Reserved.
その他メリット
 ルールの追加/削除が動的に出来ます.
 priorityをちゃんと考えれば.
 他のアプリと組み合わせられます.
 テーブル設計の競合注意
 QoSも出来る
 ステートは持てない.
 速いかも?(試してない)
39Copyright©2014 NTT corp. All Rights Reserved.
Agenda
 OpenFlow1.3で実現するFirewall
 Rangeの表記どうする?
 TCP/UDPポートどうする?
 実装(テーブル設計)
 FW運用のテストツール試作
 Ryu Certificationの流用
 おまじない
 デモ
40Copyright©2014 NTT corp. All Rights Reserved.
再掲
http://www.slideshare.net/stereocat55/tremafirewall
41Copyright©2014 NTT corp. All Rights Reserved.
再掲
http://www.slideshare.net/stereocat55/tremafirewall
ここまでの内容
ここからの内容
42Copyright©2014 NTT corp. All Rights Reserved.
Ryu Certification
 SDN Framework ‘Ryu’のSwitchテストツール
 スイッチのOpenFlow仕様への準拠の度合いを検証する
 テストパターンはJSONで記述
http://osrg.github.io/ryu-book/ja/html/switch_test_tool.html
43Copyright©2014 NTT corp. All Rights Reserved.
Ryu Certification
 SDN Framework ‘Ryu’のSwitchテストツール
 スイッチのOpenFlow仕様への準拠の度合いを検証する
 テストパターンはJSONで記述
http://osrg.github.io/ryu-book/ja/html/switch_test_tool.html
44Copyright©2014 NTT corp. All Rights Reserved.
Ryu Certification
 SDN Framework ‘Ryu’のSwitchテストツール
 スイッチのOpenFlow仕様への準拠の度合いを検証する
 テストパターンはJSONで記述
http://osrg.github.io/ryu-book/ja/html/switch_test_tool.html
固定
45Copyright©2014 NTT corp. All Rights Reserved.
Ryu Certification
 SDN Framework ‘Ryu’のSwitchテストツール
 スイッチのOpenFlow仕様への準拠の度合いを検証する
 テストパターンはJSONで記述
http://osrg.github.io/ryu-book/ja/html/switch_test_tool.html
固定
または未達検知
46Copyright©2014 NTT corp. All Rights Reserved.
こうか!
Lagopus
FW
補助SW 試験対象SW
Ryu
Certification
テストパターン
ファイル
ACL
(1)パケットインのみの
フローエントリ登録
(2)パケット印加
(3)パケットイン
又は未達検知
47Copyright©2014 NTT corp. All Rights Reserved.
未達検知のおまじない
--- /usr/local/lib/python2.7/dist-packages/ryu/tests/switch/tester.py 2015-
01-16 11:41:22.000000000 +0900
+++ tester.py 2015-09-29 14:26:26.706239312 +0900
@@ -789,11 +789,7 @@
before = before_stats[target_tbl_id]
after = rcv_msgs[target_tbl_id]
if before['lookup'] < after['lookup']:
- lookup = True
- if before['matched'] < after['matched']:
- raise TestFailure(self.state)
- if not lookup:
- raise TestError(self.state)
+ raise TestFailure(self.state)
48Copyright©2014 NTT corp. All Rights Reserved.
テストパターンファイルの記述
 ACCEPT
[
"test1",
{
"description":"allow sample test",
"prerequisite":[
### match -> in_port:1, action -> output:4294967293 ###
],
“tests”:[
{
“ingress”:[ ### テストしたいパケット ### ],
“PACKET_IN”:[ ### ingressと同じ ### ]
}
]
}
]
Packet_In
49Copyright©2014 NTT corp. All Rights Reserved.
テストパターンファイルの記述
 DROP
[
"test1",
{
"description":"allow sample test",
"prerequisite":[
### match -> in_port:1, action -> output:4294967293 ###
],
“tests”:[
{
“ingress”:[ ### テストしたいパケット ### ],
“table-miss”:[ 0 ]
}
]
}
]
Packet_In
50Copyright©2014 NTT corp. All Rights Reserved.
 デモ
51Copyright©2014 NTT corp. All Rights Reserved.
出力
--- Test start ---
waiting for switches connection...
dpid=0000000000000001 : Join target SW.
dpid=0000000000000002 : Join tester SW.
Network Test 1
test1-1
OK
Network Test 2
ACCEPT sample test
OK
DROP sample test
ERROR
Table-miss error: increment in matched_count.
--- Test end ---
--- Test report ---
Table-miss error(1)
Network Test 2 DROP sample test
OK(2) / ERROR(1)
Testログ
Summary
52Copyright©2014 NTT corp. All Rights Reserved.
その他の利点
 同じアーキテクチャで他のNW機器もテスト可
 descriptionを書きましょう(※重要)
 いろいろなプロトコルのテスト可能
 VLAN
 MPLS
 PBB
 転送,破棄以外のテストも可能
 QoS
 Broadcast
53Copyright©2014 NTT corp. All Rights Reserved.
まとめ
 Lagopus (OpenFlow1.3) でL3/L4の
パケットフィルタを実現.
 Ryu Certificationを利用して,パケッ
トフィルタのテストを実現.
54Copyright©2014 NTT corp. All Rights Reserved.
Thank you for your attention
This research is a part of the project for “Research and Development of
Network Virtualization Technology” supported by the Ministry of Internal
Affairs and Communications.

Lagopusで試すFW

  • 1.
    Copyright©2014 NTT corp.All Rights Reserved. Lagopusで試すFirewall OpenFlow1.3で実現する FW運用のテストツール試作 2015/09/29 hibitomo
  • 2.
    1Copyright©2014 NTT corp.All Rights Reserved. はじめに  今回の内容はTremaday#7で発表した 内容+αです.  Tremadayでのリクエストにお応えして, ACLのテスト駆動をデモします.
  • 3.
    2Copyright©2014 NTT corp.All Rights Reserved. Agenda  Lagopus/OpenFlowについて  お約束  TremaDayの内容  聞いたことある人はごめんなさい  テスト駆動なFW  アーキテクチャ  Ryu certificationと おまじない  デモ
  • 4.
    3Copyright©2014 NTT corp.All Rights Reserved. コントローラ SDN?OpenFlow?Lagopus?  レガシーなネットワーク装置 ルータ コントロールプレーン データプレーン ファイアーウォール コントロールプレーン データプレーン ロードバランサ コントロールプレーン データプレーン  SDN スイッチ データプレーン スイッチ データプレーン スイッチ コントロールプレーン データプレーン アプリ コントローラ コントロールプレーン アプリ プログラマブルAPI OpenFlowプロトコル
  • 5.
    4Copyright©2014 NTT corp.All Rights Reserved. OpenFlow?  どういうパケットだったら  受信ポート番号,パケットヘッダの値(宛先,ソー ス,各種ID...)  どういう処理をする  パケットヘッダの追加,削除,編集  転送(ユニキャスト,マルチキャスト,ロードバラ ンシング...)  コントローラにパケットを転送して処理も可能 OpenFlow コントローラ コントロールプレーン OpenFlow プロトコル OpenFlow スイッチ データプレーン Flow Table フローパターン アクション フローパターン アクション カウンター カウンター Flow Table #2 Flow Table #3 Flow Table #4
  • 6.
    5Copyright©2014 NTT corp.All Rights Reserved. Lagopus  OpenFlowスイッチのソフトウェア実装  汎用x86サーバで動作可能  高速なパケット処理と幅広いプロトコルに対応  > 10Gbps  OpenFlow仕様に幅広く対応 OpenFlow コントローラ コントロールプレーン OpenFlow プロトコル OpenFlow スイッチ データプレーン Flow Table フローパターン アクション フローパターン アクション カウンター カウンター Flow Table #2 Flow Table #3 Flow Table #4
  • 7.
    6Copyright©2014 NTT corp.All Rights Reserved. ユースケースの例  SDN Japan 2014での実証実験  アク セスポイ ント   ■  A Pの識別(V LA N ) ■  V ID 毎にQoS制御 PoEスイッチ インターネット アクセスポイント ( AP) La g op u sの役割
  • 8.
    7Copyright©2014 NTT corp.All Rights Reserved. オープンソース  2014年7月31日に公開  http://lagopus.github.io/  開発への参加  コードの提供 -> GitHub Pull Request  バグレポート -> GitHub Issues  議論 -> Developers ML
  • 9.
    8Copyright©2014 NTT corp.All Rights Reserved.
  • 10.
    Copyright©2014 NTT corp.All Rights Reserved. Lagopusで試すFirewall OpenFlow1.3で実現する FW運用のテストツール試作 2015/09/29 hibitomo
  • 11.
    10Copyright©2014 NTT corp.All Rights Reserved. ところで  ご覧になったことありますか?  @stereocatさん, Tremaday #4 http://www.slideshare.net/stereocat55/tremafirewall
  • 12.
    11Copyright©2014 NTT corp.All Rights Reserved. @stereocatさんのスライドです http://www.slideshare.net/stereocat55/tremafirewall
  • 13.
    12Copyright©2014 NTT corp.All Rights Reserved. @stereocatさんのスライドです http://www.slideshare.net/stereocat55/tremafirewall
  • 14.
    13Copyright©2014 NTT corp.All Rights Reserved. @stereocatさんのスライドです http://www.slideshare.net/stereocat55/tremafirewall
  • 15.
    14Copyright©2014 NTT corp.All Rights Reserved. ところで,,,,  実装はOpenFlow1.0ベース  RangeはBitmaskでどう表現するの???  そもそもL4はbitmask掛けれない...  FWをOpenFlowで表現するのは無理?  簡単なテストにしか使えない?
  • 16.
    Copyright©2014 NTT corp.All Rights Reserved. Lagopusで試すFirewall OpenFlow1.3で実現する FW運用のテストツール試作
  • 17.
    Copyright©2014 NTT corp.All Rights Reserved. Lagopusで試すFirewall OpenFlow1.3で実現する FW運用のテストツール試作 ココが違う
  • 18.
    17Copyright©2014 NTT corp.All Rights Reserved. Agenda  OpenFlow1.3で実現するFirewall  Range表記のbitmask変換  TCP/UDPポートのmask適用方法  実装(テーブル設計)  FW運用のテストツール試作  Ryu Certificationの流用  おまじない  デモ
  • 19.
    18Copyright©2014 NTT corp.All Rights Reserved. Agenda  OpenFlow1.3で実現するFirewall  Range表記のbitmask変換  TCP/UDPポートのmask適用方法  実装(テーブル設計)  FW運用のテストツール試作  Ryu Certificationの流用  おまじない  デモ
  • 20.
    19Copyright©2014 NTT corp.All Rights Reserved. Rangeの表記どうする?  そもそもTCAMで検索できているはず  TCAMは{0,1,don’t care}で検索  RangeもTCAMで検索しているなら,Lagopus でも検索できるはず.  再起アルゴリズムで Range -> Bitmask表記のルールに変換
  • 21.
    20Copyright©2014 NTT corp.All Rights Reserved. 例題 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1  0110 ~ 1111 をbitmaskのルールに分割
  • 22.
    21Copyright©2014 NTT corp.All Rights Reserved. 例題 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1  0110 ~ 1111 をbitmaskのルールに分割
  • 23.
    22Copyright©2014 NTT corp.All Rights Reserved. Algorithm 簡単(?)に 1. ****が範囲に含まれるかチェック 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 ****
  • 24.
    23Copyright©2014 NTT corp.All Rights Reserved. Algorithm 簡単(?)に 2. ****の範囲を2つに分割 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1***0***
  • 25.
    24Copyright©2014 NTT corp.All Rights Reserved. Algorithm 簡単(?)に 3. 1***はRangeに含まれる 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1***0***
  • 26.
    25Copyright©2014 NTT corp.All Rights Reserved. Algorithm 簡単(?)に 2’. 0***を2つに分割 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1***00** 01**
  • 27.
    26Copyright©2014 NTT corp.All Rights Reserved. Algorithm 簡単(?)に 2’’. 01**を2つに分割 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 00** 010* 1***011*
  • 28.
    27Copyright©2014 NTT corp.All Rights Reserved. Algorithm 簡単(?)に 2’’. 01**を2つに分割 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 00** 010* 1***011* 0110 ~ 1111 で表されるレンジは,{011*, 1***}で 表されるルールの集合でちょうどカバー出来る.
  • 29.
    28Copyright©2014 NTT corp.All Rights Reserved. Agenda  OpenFlow1.3で実現するFirewall  Range表記のbitmask変換  TCP/UDPポートのmask適用方法  実装(テーブル設計)  FW運用のテストツール試作  Ryu Certificationの流用  おまじない  デモ
  • 30.
    29Copyright©2014 NTT corp.All Rights Reserved. TCP/UDPポートのmask適用方法  Metadataにコピーする  しかし,Copy_Fieldは未対応.... Metadata (64bit)L4 srcL4 dst
  • 31.
    30Copyright©2014 NTT corp.All Rights Reserved. TCP/UDPポートのmask適用方法  単純に書きくだす. ※ルール数が65536 * 2 * 2 = 26万 for i in range(0, 65535): # SRC for ip_proto in [6, 17] : flow = {"table_id":0,"priority":1000, "actions":[{"type":"WRITE_METADATA","metadata":i << 16, "metadata_mask":0x00000000FFFF0000}], "match":{"dl_type":2048,"ip_proto":ip_proto,"tp_src":i}} mod_flow_entry(datapath, flow, ofproto.OFPFC_ADD) # DST ...
  • 32.
    31Copyright©2014 NTT corp.All Rights Reserved. Lagopusなら動く  Lagopusならなんとかしてくれる. 私の戦闘力は 100万です.
  • 33.
    32Copyright©2014 NTT corp.All Rights Reserved. その他の手  リアクティブに登録しても実現できる 1. TCP/UDPパケットが来たらPacket-In 2. ポート番号のメタデータコピーのルール追加 未登録のPort番号で あれば,Packet-In Port番号コピーのルール + Packet-Out コントローラ スイッチ データプレーン コントロールプレーン
  • 34.
    33Copyright©2014 NTT corp.All Rights Reserved. Agenda  OpenFlow1.3で実現するFirewall  Rangeの表記どうする?  TCP/UDPポートどうする?  実装(テーブル設計)  FW運用のテストツール試作  Ryu Certificationの流用  おまじない  デモ
  • 35.
    34Copyright©2014 NTT corp.All Rights Reserved. 実装  テーブル設計  table 0:  L4 srcポートをmetadataにコピー(32~16bitに)  table 1:  L4 dstポートをmetadataにコピー (16~0bitに)  table 2:  Range -> Bitmask変換したルール群投入  マッチしたら落とす or OUTPUT or Next table (他のアプリケーション)
  • 36.
    35Copyright©2014 NTT corp.All Rights Reserved. 実装  Table 0のルール例 {'priority': 1000, 'table_id': 0, 'match': {'dl_type': 2048, 'ip_proto': 6, 'tp_src': 5}, 'actions': [ {'metadata_mask': 4294901760, ‘type': 'WRITE_METADATA', 'metadata': 327680} ] } 0xFFFF0000 UDP/TCP両方で ルール登録 0x00050000
  • 37.
    36Copyright©2014 NTT corp.All Rights Reserved. 実装  Table 1のルール例 {'priority': 1000, 'table_id': 1, 'match': {'dl_type': 2048, 'ip_proto': 17, 'tp_dst': 8}, 'actions': [ {'metadata_mask': 65535, 'type': 'WRITE_METADATA', 'metadata': 8} ] }
  • 38.
    37Copyright©2014 NTT corp.All Rights Reserved. 実装  Table 2のルール例 (アドレスに意味はありません) {"table_id":2,"priority":65535,"cookie":0, "actions":[], "match":{ "dl_type":2048, "ipv4_src":“192.168.1.10/255.255.255.240", "ipv4_dst":“192.168.1.171/255.255.255.240", "ip_proto":17, "metadata":"0x0000000000580050/0x00000000ffffffff"} }
  • 39.
    38Copyright©2014 NTT corp.All Rights Reserved. その他メリット  ルールの追加/削除が動的に出来ます.  priorityをちゃんと考えれば.  他のアプリと組み合わせられます.  テーブル設計の競合注意  QoSも出来る  ステートは持てない.  速いかも?(試してない)
  • 40.
    39Copyright©2014 NTT corp.All Rights Reserved. Agenda  OpenFlow1.3で実現するFirewall  Rangeの表記どうする?  TCP/UDPポートどうする?  実装(テーブル設計)  FW運用のテストツール試作  Ryu Certificationの流用  おまじない  デモ
  • 41.
    40Copyright©2014 NTT corp.All Rights Reserved. 再掲 http://www.slideshare.net/stereocat55/tremafirewall
  • 42.
    41Copyright©2014 NTT corp.All Rights Reserved. 再掲 http://www.slideshare.net/stereocat55/tremafirewall ここまでの内容 ここからの内容
  • 43.
    42Copyright©2014 NTT corp.All Rights Reserved. Ryu Certification  SDN Framework ‘Ryu’のSwitchテストツール  スイッチのOpenFlow仕様への準拠の度合いを検証する  テストパターンはJSONで記述 http://osrg.github.io/ryu-book/ja/html/switch_test_tool.html
  • 44.
    43Copyright©2014 NTT corp.All Rights Reserved. Ryu Certification  SDN Framework ‘Ryu’のSwitchテストツール  スイッチのOpenFlow仕様への準拠の度合いを検証する  テストパターンはJSONで記述 http://osrg.github.io/ryu-book/ja/html/switch_test_tool.html
  • 45.
    44Copyright©2014 NTT corp.All Rights Reserved. Ryu Certification  SDN Framework ‘Ryu’のSwitchテストツール  スイッチのOpenFlow仕様への準拠の度合いを検証する  テストパターンはJSONで記述 http://osrg.github.io/ryu-book/ja/html/switch_test_tool.html 固定
  • 46.
    45Copyright©2014 NTT corp.All Rights Reserved. Ryu Certification  SDN Framework ‘Ryu’のSwitchテストツール  スイッチのOpenFlow仕様への準拠の度合いを検証する  テストパターンはJSONで記述 http://osrg.github.io/ryu-book/ja/html/switch_test_tool.html 固定 または未達検知
  • 47.
    46Copyright©2014 NTT corp.All Rights Reserved. こうか! Lagopus FW 補助SW 試験対象SW Ryu Certification テストパターン ファイル ACL (1)パケットインのみの フローエントリ登録 (2)パケット印加 (3)パケットイン 又は未達検知
  • 48.
    47Copyright©2014 NTT corp.All Rights Reserved. 未達検知のおまじない --- /usr/local/lib/python2.7/dist-packages/ryu/tests/switch/tester.py 2015- 01-16 11:41:22.000000000 +0900 +++ tester.py 2015-09-29 14:26:26.706239312 +0900 @@ -789,11 +789,7 @@ before = before_stats[target_tbl_id] after = rcv_msgs[target_tbl_id] if before['lookup'] < after['lookup']: - lookup = True - if before['matched'] < after['matched']: - raise TestFailure(self.state) - if not lookup: - raise TestError(self.state) + raise TestFailure(self.state)
  • 49.
    48Copyright©2014 NTT corp.All Rights Reserved. テストパターンファイルの記述  ACCEPT [ "test1", { "description":"allow sample test", "prerequisite":[ ### match -> in_port:1, action -> output:4294967293 ### ], “tests”:[ { “ingress”:[ ### テストしたいパケット ### ], “PACKET_IN”:[ ### ingressと同じ ### ] } ] } ] Packet_In
  • 50.
    49Copyright©2014 NTT corp.All Rights Reserved. テストパターンファイルの記述  DROP [ "test1", { "description":"allow sample test", "prerequisite":[ ### match -> in_port:1, action -> output:4294967293 ### ], “tests”:[ { “ingress”:[ ### テストしたいパケット ### ], “table-miss”:[ 0 ] } ] } ] Packet_In
  • 51.
    50Copyright©2014 NTT corp.All Rights Reserved.  デモ
  • 52.
    51Copyright©2014 NTT corp.All Rights Reserved. 出力 --- Test start --- waiting for switches connection... dpid=0000000000000001 : Join target SW. dpid=0000000000000002 : Join tester SW. Network Test 1 test1-1 OK Network Test 2 ACCEPT sample test OK DROP sample test ERROR Table-miss error: increment in matched_count. --- Test end --- --- Test report --- Table-miss error(1) Network Test 2 DROP sample test OK(2) / ERROR(1) Testログ Summary
  • 53.
    52Copyright©2014 NTT corp.All Rights Reserved. その他の利点  同じアーキテクチャで他のNW機器もテスト可  descriptionを書きましょう(※重要)  いろいろなプロトコルのテスト可能  VLAN  MPLS  PBB  転送,破棄以外のテストも可能  QoS  Broadcast
  • 54.
    53Copyright©2014 NTT corp.All Rights Reserved. まとめ  Lagopus (OpenFlow1.3) でL3/L4の パケットフィルタを実現.  Ryu Certificationを利用して,パケッ トフィルタのテストを実現.
  • 55.
    54Copyright©2014 NTT corp.All Rights Reserved. Thank you for your attention This research is a part of the project for “Research and Development of Network Virtualization Technology” supported by the Ministry of Internal Affairs and Communications.