1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

faucetのAccess Control Listsを試す

Posted at

概要

前回の続きで、Faucetからパケットの流れを制御するAccess Control Lists(ACL)機能を使います。
具体的には、パケットの禁止・許可、action(output)の変更を行います。

詳細

環境構築

  • まず、前回に加えて、host3(faucet-host3/veth-host3)とhost4(faucet-host4/veth-host4)のNETNSを追加します。例えば下記のような感じで。
> create_ns host3 192.168.0.3/24
> create_ns host4 192.168.0.4/24
  • そしてovsのブリッジにもポートを追加します。
> sudo ovs-vsctl add-port br0 veth-host3 -- set interface veth-host3 ofport_request=3 \
              -- add-port br0 veth-host4 -- set interface veth-host4 ofport_request=4

faucetにpingをブロックするACLを作る

output

  • mirrorの先にactionのoutputの説明
  • 指定したフィールドを書き換えてパケットを送ったりできます。例ではmacアドレスを書き換えています。
    • また、output先のportの指定やvlan_idの指定なども例示されています
      • vlan_id付与時はフレームフォーマットがIEEE 802.1Qに変更されます

mirror

  • ポートを指定してそこにパケットをそのままミラーリングします。
  • outputも同じですが、パケットの許可・禁止にかかわらずミラーリングは行われます。
  • outputも同じですが、出力先に指定されたポート(例だとhost4)には通信できなくなります。
    • dump-flowsを見ると下記のような感じでした。
port指定前
> sudo ovs-ofctl dump-flows br0 | grep in_port=4
 cookie=0x5adc15c0, duration=26.211s, table=0, n_packets=5, n_bytes=378, idle_age=9, priority=20480,in_port=4 actions=resubmit(,1)
 cookie=0x5adc15c0, duration=26.211s, table=1, n_packets=5, n_bytes=378, idle_age=9, priority=9000,in_port=4,vlan_tci=0x0000/0x1fff actions=mod_vlan_vid:100,resubmit(,2)
 cookie=0x5adc15c0, duration=14.872s, table=2, n_packets=3, n_bytes=238, hard_timeout=278, idle_age=9, priority=8191,in_port=4,dl_vlan=100,dl_src=a6:fe:b8:79:3b:a0 actions=resubmit(,3)
port指定後
> sudo ovs-ofctl dump-flows br0 | grep in_port=4
 cookie=0x5adc15c0, duration=5.516s, table=1, n_packets=0, n_bytes=0, idle_age=5, priority=9099,in_port=4 actions=drop

感想

  • faucetを使うとコントローラーを簡単に作れそうなことがわかりました
  • ただfaucetとovsをごちゃごちゃいじってると時々ovsが期待と違う状態になったりするっぽい感じがしました。それともnetnsのせい? よくわからん。
  • ところでqiitaのopenflowの記事ってすごい少ないですね
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?