仮想ネットワークを実現するopenvnet
TRANSCRIPT
仮想ネットワークを実現するOpenVNet
株式会社あくしゅ 横川晃
!1
自己紹介
• 名前: 横川 晃(よこかわ あきら)
• 株式会社あくしゅ
• 好きなこと: スポーツ、旅行、語学
• Twitter: @_akira_ @oO_akira_Oo
• Facebook: akira.yokokawa
!2
もくてき
• OpenFlowってどんなものかわかるようになる
• フローがよめるようになる
• OpenVNetの仕組みが大体わかるようになる
!3
・L2とL3の簡単なおさらい ・OpenFlowってなに? * OpenFlowのしくみについて * 周辺技術の紹介 ・OpenVNet開発について - 経緯 - 設計・実装 ・OpenVNetテストについて ・OpenVNet今後の計画
Agenda
!4
OSI参照モデル
物理層
データリンク層
ネットワーク層
トランスポート層
セッション層
プレゼンテーション層
アプリケーション層
IPなど
TCP, UDP
Ethernet, PPPなど
!5
OSI参照モデル
データリンク層
ネットワーク層 IPなど
Ethernet, PPPなど
第2層、第3層に関して 実際のネットワーク機器上ではどんな動きをするのか 軽くおさらいします
のちに説明する、OpenVNetの仕組みを理解する上でも役立ちます
!6
第2層:データリンク層
• Ethernet frameと呼ばれる下記のデータを扱う
Payload FCSEthertypeMAC (source)
MAC (destination)
46~1500バイト 4バイト2バイト6バイト6バイト
!7
L2スイッチの挙動
• MACアドレスとポートの一覧を保持する • 初めはからっぽ
1 2 3 4
IP = X MAC = A
AB
MACアドレス ポート番号
IP = Y MAC = B
!8
L2スイッチの挙動
1 2 3 4
AB
MACアドレス ポート番号
IP = X MAC = A
マシンが繋がるとブロードキャストフレームが届く
!9
L2スイッチの挙動
1 2 3 4
AB
MACアドレス ポート番号
MAC = A Port = 1
フレームのMACアドレスを読み取り、ポート番号と共に記憶
A 1
!10
L2スイッチの挙動
1 2 3 4
AB
MACアドレス ポート番号
A 1
IP = Y MAC = B
他のマシンがスイッチにつながった場合も 同様にしてMACアドレスとポート番号を記憶
B 2
!11
L2スイッチの挙動
1 2 3 4
AB
MACアドレス ポート番号
A 1
MACアドレステーブルの情報に従い フレームを送信するポートを決定する
B 2
!12
第3層:ネットワーク層
Payload FCSEthertypeMAC (source)
MAC (destination)
46~1500バイト 4バイト2バイト6バイト6バイト
PayloadTCP ヘッダ
IP ヘッダ
20バイト 20バイト 40~1460バイト
!13
L3ルータの挙動
1 2 3 4
A B
192.168.1.0/24 192.168.2.0/24
宛先 ルータ ホップ ポート
192.168.1.0 - 0 1
192.168.2.0 - 0 4
• 宛先IPアドレスを読み宛先ネットワークを決定
• ルーティングテーブルを参照し送信先を決定
!14
複数ルータ間の挙動
1 2 3 4
A B
192.168.1.0/24 192.168.2.0/24
宛先 ルータ ホップ ポート
192.168.1.0 - 0 1
192.168.2.0 210.99.47.1 1 4
1 2 3 4130.82.12.1 210.99.47.1
宛先 ルータ ホップ ポート
192.168.2.0 - 0 4
192.168.1.0 130.82.12.1 1 1
ダイナミックルーティングの場合 EGP等で経路情報を交換
!15
まとめ• L2:スイッチではMACアドレスを基に制御
• MACアドレスを知らなかったらARP
• 結果はキャッシュされる
• L3:ルータではIPアドレスを基に制御
• ルーティングテーブルを参照して送信先決定
OpenVNetではARP処理をがんばって 仮想ネットワークを実現しています
つづいてOpenFlowの説明に移ります!16
What is OpenFlow?
• 2009年スタンフォード大での研究が発端
• http://archive.openflow.org/wp/2009/12/openflow-1-0-released/
• ONF(Open Networking Foundation)が管理
• OpenFlowスイッチをプログラムするプロトコル
• 今まで中のソフトウェアは非公開
• ソフトウェアが外出しになってプログラムできる
!17
OpenFlow Versioning History• 1.0 - 2009年12月31日
• 1.1 - 2011年2月28日
• 1.2 - 2011年12月5日
• 1.3 - 2012年6月25日
• 1.4 - 2013年10月15日
OpenVNetは1.3に対応
!18
OpenFlow: プロトコルの説明
OpenFlowスイッチに対してOpenFlowプロトコル でやりとりしスイッチの挙動をプログラム
• セキュアチャンネルでコントローラとスイッチを接続
• OpenFlowバージョンの確認
• スイッチの情報の確認
• パケットの受信
• フローの更新!19
セキュアチャンネルでコントローラとスイッチを接続
抜粋The switch must be able to establish communication with a controller at a user-configurable (but otherwise fixed) IP address, using a user-specified port. If the switch knows the IP address of the controller, the switch initiates a standard TLS or TCP connection to the controller.
出典:OpenFlow Switch Specification version 1.3.0
1 2 3 OpenFlowコントローラ
tcp://192.168.2.102:6379
!20
セキュアチャンネルでコントローラとスイッチを接続
A typical OpenFlow controller manages multiple OpenFlow channels, each one to a different OpenFlow switch. An OpenFlow switch may have one OpenFlow channel to a single controller, or multiple channels for reliability, each to a different controller.
1 2 3 OpenFlowコントローラ2
OpenFlowコントローラ1
1 2 3
出典:OpenFlow Switch Specification version 1.3.0
複数コントローラ、スイッチの構成も可能
!21
OpenFlowバージョンの確認When an OpenFlow connection is first established, each side of the connection must immediately send an OFPT_HELLO message with the version field set to the highest OpenFlow protocol version supported by the sender.
出典:OpenFlow Switch Specification version 1.3.0
1 2 3 OpenFlowコントローラ
バージョン 1.3
バージョン 1.3
サポートしてる最新のバージョンを教えあう
!22
スイッチの情報の確認Features: The controller may request the capabilities of a switch by sending a features request; the switch must respond with a features reply that specifies the capabilities of the switch. This is commonly performed upon establishment of the OpenFlow channel.
出典:OpenFlow Switch Specification version 1.3.0
1 2 3 OpenFlowコントローラ
FEATURE_REQUEST
FEATURE_REPLY
• Datapath ID • ポートの一覧など
Datapath?スイッチとかブリッジと同じと思ってください
!23
パケットの受信When packets are received by the datapath and sent to the controller, they use the OFPT_PACKET_IN message:
出典:OpenFlow Switch Specification version 1.3.0
1 2 3 OpenFlowコントローラ
PACKET_IN
• data … パケットの中身
• reason … なんでpacket_inしたか
• match … どのポートから入ったのかなど
• cookie … フロー毎につけられる!24
フローの更新
1 2 3 OpenFlowコントローラ
FLOW_MOD
PACKET_OUT
フローの更新はFLOW_MODメッセージでやりとり
PACKET_OUTで受け取ったパケットを戻す
フローってどんな感じになってるのか?!25
[root@itest1 ~]# ovs-ofctl dump-flows br0 NXST_FLOW reply (xid=0x4): cookie=0x900000000000000, duration=11102.212s, table=0, n_packets=5551, n_bytes=288652, idle_age=1, priority=1,tun_id=0 actions=drop cookie=0x900000000000000, duration=11102.211s, table=0, n_packets=0, n_bytes=0, idle_age=11102, priority=2,in_port=CONTROLLER actions=write_metadata:0x4040000000000/0x40c0000000000 cookie=0x500000000000003, duration=11101.919s, table=0, n_packets=0, n_bytes=0, idle_age=11101, priority=2,in_port=3 actions=write_metadata:0x700040000000007/0xff000c007fffffff cookie=0x5000000fffffffe, duration=11101.919s, table=0, n_packets=0, n_bytes=0, idle_age=11101, priority=2,in_port=LOCAL actions=write_metadata:0x40000000000/0xc0000000000 cookie=0x900000000000000, duration=11102.211s, table=0, n_packets=0, n_bytes=0, idle_age=11102, priority=0 actions=write_metadata:0x80000000000/0xc0000000000 cookie=0x500000000000296, duration=11102.049s, table=3, n_packets=0, n_bytes=0, idle_age=11102, priority=30,in_port=662 actions=drop cookie=0x900000000000000, duration=11102.212s, table=3, n_packets=0, n_bytes=0, idle_age=11102, priority=0 actions=drop cookie=0x900000000000000, duration=11102.212s, table=4, n_packets=0, n_bytes=0, idle_age=11102, priority=0 actions=drop cookie=0xc00001300000001, duration=11101.729s, table=6, n_packets=0, n_bytes=0, idle_age=11101, priority=30,dl_src=02:01:00:00:00:01 actions=write_metadata:0x700000000000001/0xff0000007fffffff cookie=0x900000000000000, duration=11102.212s, table=6, n_packets=0, n_bytes=0, idle_age=11102, priority=0 actions=drop cookie=0x900000000000000, duration=11102.212s, table=7, n_packets=0, n_bytes=0, idle_age=11102, priority=0 actions=drop cookie=0x900000000000000, duration=11102.212s, table=8, n_packets=0, n_bytes=0, idle_age=11102, priority=0 actions=drop cookie=0x900000000000000, duration=11102.212s, table=9, n_packets=0, n_bytes=0, idle_age=11102, priority=0 actions=drop
!26
cookie=0x500000000000296, duration=11102.049s, table=3, n_packets=0, n_bytes=0, idle_age=11102, priority=30,in_port=662 actions=drop
match action
matchの条件に該当したパケットに対して、 actionで指定されている処理を適用する このフローの場合はパケットを破棄する
!27
フローの例:その1
cookie=0x900000000000000, duration=85917.793s, table=0, n_packets=0, n_bytes=0, priority=2,in_port=2 actions=goto_table:7
match in_port=2
action actions=goto_table:7
2番ポートからパケットが入ってきたら、 7番テーブルへ処理を移す
OpenVNetではテーブルごとに処理したい内容を分けてる!28
フローの例:その2
cookie=0xc00001200000001, duration=85916.453s, table=10, n_packets=42960, n_bytes=2233920, priority=10,metadata=0x700000000000001/0xff0000007fffffff actions=drop
matchmetadata=0x700000000000001/0xff0000007fffffff
actionactions=drop
value mask
!29
フローの例:その3
metadata=0x700000000000001/0xff0000007fffffff
value mask64ビットのレジスタ
metadata & mask == value
Pipeline processing instructions allow packets to be sent to subsequent tables for further processing and allow information, in the form of metadata, to be communicated between tables.
!30
metadata
OpenFlow Switches
• いろんなOpenFlowスイッチ
• ソフトウェア実装
• Open vSwitch
• OpenVNetではこれつかってる
!31
Why OVS?
• 開発がさかんだから
• OpenFlowの中の人がからんでる
• コミュニティが活発。MLでの議論たくさん
!32
How to setup OVS?
• ポートのプロビジョニング
• OVSDB
• フローの設定
• OpenFlowをしゃべるOpenFlowコントローラ
!33
OpenFlow Controller
• OpenFlowをしゃべるプログラム
• OpenVNetでもコントローラを定義
• Tremaというフレームワークをつかっている
!34
Trema
• 開発言語:Ruby
• 開発元:NEC
• GitHub上で管理
• https://github.com/trema/trema
!35
なぜTremaを選んだのか• OpenVNetがRubyで書かれているから
• 比較的少ないコードで機能が実現できるから
!36
# -*- coding: utf-8 -*- !require 'racket' require 'trema/actions' require 'trema/instructions' require 'trema/messages' !module Vnet::Openflow ! class Controller < Trema::Controller include TremaTasks include Celluloid::Logger include Vnet::Constants::Openflow ! def features_reply(dpid, message) info "features_reply from %#x." % dpid ! datapath = datapath(dpid) || raise("No datapath found.") datapath.switch.async.features_reply(message) end !! def port_status(dpid, message) debug "port_status from %#x." % dpid ! datapath = datapath(dpid) datapath.switch.async.port_status(message) if datapath && datapath.switch end ! def packet_in(dpid, message) dp_info = dp_info(dpid) return unless dp_info ! case message.cookie >> COOKIE_PREFIX_SHIFT when COOKIE_PREFIX_INTERFACE dp_info.interface_manager.async.packet_in(message) when COOKIE_PREFIX_TRANSLATION dp_info.translation_manager.async.packet_in(message) when COOKIE_PREFIX_ROUTE_LINK dp_info.router_manager.async.packet_in(message) when COOKIE_PREFIX_SERVICE dp_info.service_manager.async.packet_in(message) when COOKIE_PREFIX_CONNECTION dp_info.connection_manager.async.packet_in(message) end end !37
OpenVNetの設計・実装
!38
What is OpenVNet?
• Spin-off project from Wakame-vdc
• 5 developers
• 2279 commits
• Written in Ruby
• 16512 LOCs (5257 LOCs test codes)
• Started March 2013
���39
Why OpenVNet?
• There are many products offering network virtualization but not free
• Is there any product to freely try out network virtualization?
• Wakame-vdc offers network virtualization
• Extract virtual network functionality from Wakame-vdc to make an independent package
���40
Advantages of OpenVNet
• Users can create complex networks on top of OpenVNet
• Keep the physical networks simple
Reduce the maintaining cost of the physical networks
• Edge-overlay architecture enables creating complex multi-tenant networks
No need expensive network switches
• e.g.) quickly preparing an isolated network for experiment
Freely and easily create/destroy networks
���41
Advantages of OpenVNet
• Virtualizing entire network is difficult
• Why not to start network virtualization from smaller part?
• OpenVNet supports association with legacy network
Seamless network virtualization
���42
Internal Architecture of OpenVNet
���43
Network model of datacenter
Internet
Datacenter network
Physical/Virtual server clusters
DNAT / LB
SNAT DHCP DNS
���44
Network model of datacenter
Internet
Datacenter network
External network
WAN edge network
Datacenter physical network
LAN edge network
Physical/Virtual server clusters
General servers
Appliance servers
Storage servers
Resources
DNAT / LB
SNAT DHCP DNS
���45
Deployment of agent program
Internet
Datacenter network
Physical/Virtual server clusters
DNAT / LB
SNAT DHCP DNS
Deploy agents for packet control
agent agent agent
agent agent agent
���46
Message queue
Internet
Datacenter network
Physical/Virtual server clusters
DNAT / LB
SNAT DHCP DNS
agent agent agent
agent agent agent
Queue
Agents communicate to each other through message queue system
���47
Components of OpenVNetvna (virtual network agent)
vnmgr (virtual network manager)
vnapi (virtual network API)
Agent
other components
• Configure OpenvSwitch (version 1.10.0)
• Include an OpenFlow controller implemented with Trema-edge
• Manage the datacenter network
• Provide database access back-ended by MySQL
• Command vna to do some specific actions e.g.) update flows
• WebAPI to talk to vnmgr
vnctl (virtual network controller)
• Command line interface to use vnapi���48
Components of OpenVNet
Internet
Datacenter network
Servers
vna vna vna
vna vna vna
Queue
vnmgr
vnapivnctl
DB
OpenFlow Controller
(Trema-edge)
vnaOpenFlow Switch
(OpenvSwitch 1.10.0)
OpenFlow 1.3
http
mysql
zeromq
���49
Model of SDN
Control layer
Resource layer
Application layer
Application Application
Network OS
Network device
Network device
Network device
packet forwardingpacket forwarding
APIAPI
OpenFlow protocol
General applications
Control program that manages all the network resources scattered around the datacenter
Resource pool of network device
���50
Model of OpenVNet
Control layer
Resource layer
Application layer
App1 App2
vnmgr
Open vSwitch
APIAPI
OpenFlow protocol
vna vna vnaTrema-edge Trema-edge Trema-edge
Open vSwitch
Open vSwitch
VM VM VM VM VM
} ZeroMQ
via unix socket
���51
Deployment
External network
WAN edge network
Datacenter physical network
LAN edge network
General servers
Appliance servers
Storage servers
Resources���52
Deployment
External network
WAN edge network
Datacenter physical network
LAN edge network
General servers
Appliance servers
Storage servers
Resources
Open vSwitch
eth0 eth1
VM
vna Open vSwitch
eth0 eth1
VM
vna
public line
management line
A dedicated line for management
Packets for the service go through the public line
���53
Packet forwarding in OpenVNet
• MAC2MAC
• Forward packet based on MAC address
• GRE Tunnel
• Over L3 routing
• VNet edge
• Perform VLAN ID translation
• Associate with legacy network
���54
Packet forwarding in OpenVNet
• Security Groups
• Define packet forwarding rules to achieve network isolation
• Virtual Router
• Make it possible to route from vnet to vnet
���55
MAC2MAC
Open vSwitch
eth0 eth1
vnaOpen
vSwitch
eth0 eth1
vna
public line
Suppose that both VM1 and VM2 exist on the same virtual network
VM2VM1
MAC = 00:00:00:00:01 IP = 10.102.0.10
virtual network1
MAC = 00:00:00:00:02 IP = 10.102.0.11
���56
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
virtual network1 !VM1 = 00:00:00:00:01 VM2 = 00:00:00:00:02
both vna know that VM1 and VM2 exist on virtual network1
���57
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
VM1 sends ARP request
src_ip = 10.102.0.10 dst_ip = 10.102.0.11 src_mac = 00:00:00:00:00:01 dst_mac = ff:ff:ff:ff:ff:ff
���58
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
Open vSwitch broadcasts the packet
src_ip = 10.102.0.10 dst_ip = 10.102.0.11 src_mac = 00:00:00:00:00:01 dst_mac = ff:ff:ff:ff:ff:ff
���59
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
The other hosts receive the packet
src_ip = 10.102.0.10 dst_ip = 10.102.0.11 src_mac = 00:00:00:00:00:01 dst_mac = ff:ff:ff:ff:ff:ff
���60
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
Open vSwitch checks the src_mac, then it founds the packet is of virtual network1
!src_mac = 00:00:00:00:00:01
���61
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
Remember src_mac in case of other packets whose destination is 00:00:00:00:00:01
!dst_mac = 00:00:00:00:00:01 ⇛ output:eth0
���62
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
Forward a packet according to the network
src_ip = 10.102.0.10 dst_ip = 10.102.0.11 src_mac = 00:00:00:00:00:01 dst_mac = ff:ff:ff:ff:ff:ff
���63
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
ARP reply comes in the Open vSwitch
src_ip = 10.102.0.11 dst_ip = 10.102.0.10 src_mac = 00:00:00:00:00:02 dst_mac = 00:00:00:00:00:01
���64
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
Open vSwitch knows that the packet should be forwarded to eth0
src_ip = 10.102.0.11 dst_ip = 10.102.0.10 src_mac = 00:00:00:00:00:02 dst_mac = 00:00:00:00:00:01
!dst_mac = 00:00:00:00:00:01 ⇛ output:eth0
���65
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
The packet is forwarded from eth0
src_ip = 10.102.0.11 dst_ip = 10.102.0.10 src_mac = 00:00:00:00:00:02 dst_mac = 00:00:00:00:00:01
���66
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
The another host receives the ARP reply packet
src_ip = 10.102.0.11 dst_ip = 10.102.0.10 src_mac = 00:00:00:00:00:02 dst_mac = 00:00:00:00:00:01
���67
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
Remember the source mac address
dst_mac = 00:00:00:00:00:02 ⇛ output:eth0
���68
MAC2MAC
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
Output the packet to the specific VM
src_ip = 10.102.0.11 dst_ip = 10.102.0.10 src_mac = 00:00:00:00:00:02 dst_mac = 00:00:00:00:00:01
���69
GRE Tunnel
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
Open vSwitch
eth0 eth1
VM3
vna
L3 switch
Prepare GRE tunnels in case of L3 routing required
Use MAC2MAC over GRE tunnels
GRE tunnel
���70
Overall
Open vSwitch
eth0 eth1
VM1
vnaOpen
vSwitch
eth0 eth1
VM2
vna
public line
Open vSwitch
eth0 eth1
VM3
vna
L3 switch
Any complex packet forwarding is done by Open vSwitch
Just normal L2 and L3 switch are required
No need to buy expensive network switches!!
���71
Advantages of OpenVNet
• Virtualizing entire network is difficult
• Why not to start network virtualization from smaller part?
• OpenVNet supports association with legacy network
Seamless network virtualization
���72
VNet edge
Open vSwitch
eth0 eth1
vna
public line
Open vSwitch
eth0 eth1
vna
eth2
Edge server
Legacy L2 switch
legacy line
eth0
Legacy machine
Perform VLAN ID translation
VM1
Network ID 2
• Associate the legacy machine to the virtual network ID 2
• Edge server is responsible for VLAN ID translation
• Legacy machine is connected to the edge server over L2 network
���73
VNet edge
Open vSwitch
eth0 eth1
VM1
vna
public line
Open vSwitch
eth0 eth1
vna
eth2
Edge server
Legacy L2 switch
legacy line
eth0
Legacy machine
Send a packet from a legacy machine• Suppose the legacy machine is associated with VLAN ID 100
���74
VNet edge
Open vSwitch
eth0 eth1
VM1
vna
public line
Open vSwitch
eth0 eth1
vna
eth2
Edge server
Legacy L2 switch
legacy line
eth0
Legacy machine
Open vSwitch forwards the packet to the OF controller
Translates VLAN ID 100 to network ID 2
VLAN vnet100 2
���75
VNet edge
Open vSwitch
eth0 eth1
VM1
vna
public line
Open vSwitch
eth0 eth1
vna
eth2
Edge server
Legacy L2 switch
legacy line
eth0
Legacy machine
After the translation, the packet is forwarded by MAC2MAC
VLAN vnet100 2
���76
VNet edge
Open vSwitch
eth0 eth1
VM1
vna
public line
Open vSwitch
eth0 eth1
vna
eth2
Edge server
Legacy L2 switch
legacy line
eth0
Legacy machine
VLAN vnet100 2
The legacy machine can participate in the virtual network
���77
VNet edge
Open vSwitch
eth0 eth1
VM1
vna
public line
Open vSwitch
eth0 eth1
vna
eth2
Edge server
Legacy L2 switch
legacy line
VLAN vnet100 2
VM1 sends/receives the packet as if the Legacy machine is in the same L2 network
���78
eth
Legacy
Security Groups
L3レベルでパケットのフォワーディングルールを 設定できる。
• ユーザによるルールの設定
• コネクショントラッキング
• リファレンスを用いたルール指定
OpenVNetで実装されているファイヤーウォール
!79
ユーザによるルールの設定
プロトコル、ポート、IPアドレスを指定する
tcp:22:10.1.0.0/24
udp:53:192.168.2.100
icmp:-1:0.0.0.0
• 10.1.0.0/24のネットワークからtcp22番ポートのアクセスを受け付ける
• 192.168.2.100からudp53番ポートのアクセスを受け付ける
• 全てのicmpパケットを受け付ける(ポート番号はなんでもいい)!80
ユーザによるルールの設定
インスタンスのNICに対してuuidを指定する
tcp:22:10.0.0.0/24
udp:53:192.168.2.100
icmp:-1:0.0.0.0
VM1eth0VM2
eth0
同じセキュリティグループに 所属する
sg-test1
!81
ユーザによるルールの設定
ルールはフローとしてdatapathに設定される
tcp:22:10.0.0.0/24
udp:53:192.168.2.100
icmp:-1:0.0.0.0
VM1eth0
VM2eth0
Open vSwitch
eth0 eth1
vna
同じグループ間は 通信可能
!82
コネクショントラッキング
tcp:22:10.0.0.0/24
udp:53:192.168.2.100
icmp:-1:0.0.0.0
VM1eth0
VM2eth0
10.0.0.10 10.0.0.11
sg-test2sg-test1
ルールなし
ssh49617 22
!83
コネクショントラッキング
VM1eth0
VM2eth0
10.0.0.10 10.0.0.11
Open vSwitch
vna
tcp,dl_src=00:18:51:e5:33:66 actions=CONTROLLER:65535 udp,dl_src=00:18:51:e5:33:66 actions=CONTROLLER:65535
datapathにはTCP, UDPパケットを検知したら コントローラにパケットを送るフローが設定されてる
!84
コネクショントラッキング
VM1eth0
VM2eth0
10.0.0.10 10.0.0.11
Open vSwitch
vna
コントローラで2つのフローを作成する
tcp,dl_src=00:18:51:e5:33:66,nw_src=10.0.0.10,nw_dst=10.0.0.11,tp_src=49617,tp_dst=22 actions=goto_table:TABLE_NETWORK_SRC_CLASSIFIER(20)
tcp,metadata=TYPE_INTERFACE(0x1),dl_dst=00:18:51:e5:33:66,nw_src=10.0.0.11,nw_dst=10.0.0.10,tp_src=22,tp_dst=49617 actions=goto_table:TABLE_OUT_PORT_INTERFACE_INGRESS(90)
10.0.0.10から11への接続を許可するフロー
10.0.0.11から10への接続を許可するフロー
!85
リファレンスを用いたルール指定• IPアドレスの代わりにUUIDを指定
VM1eth0
VM2eth0
sg-test2
• 指定セキュリティグループに所属するNICからのフォワーディングルールを一括指定
VM3eth0
sg-test3
tcp:22:sg-test2
udp:53:192.168.2.100
icmp:-1:sg-test2
TCP22番へのアクセスと ICMPは許可される
!86
Virtual Router
• 仮想ネットワーク間でのルーティングを実現
• 主に3つのレイヤに分かれている
• ルート層
• ルートリンク層
• データパスルートリンク層
• 複雑です
• できるだけ噛み砕いて説明します!87
ルーティング概略図
データパスルートリンク層
ルートリンク層
ルート層
仮想ネットワークA 仮想ネットワークB
ネットワークから伸びてる経路を管理
ルート間のつながりを管理
どの物理ポートに送信するか管理
!88
ルーティング概略図
仮想ネットワークA 仮想ネットワークB
Route A Route B
RouteLink AB
DPRL 1 DPRL 2
!89
ルート層
仮想ネットワークA 仮想ネットワークB
Route A Route B
Routeオブジェクトを作成する
仮想ネットワークを基点にして ルーティング経路分のオブジェクトを作成
!90
ルート層
仮想ネットワークA 仮想ネットワークB
Route A Route B
Routeオブジェクトを作成する
別ネットワークへのルーティングが必要な場合 それに応じてRouteオブジェクトを作成する
仮想ネットワークC
Route ACRoute CA
!91
Routeと仮想ネットワークの関係
仮想ネットワークA
Route A
仮想ネットワークにはGWを表すオブジェクトがいる !Routeが持っている関係 ・GW ・RouteLink ← 後で説明します
Route AC
GW
!92
ルートリンク層
仮想ネットワークA 仮想ネットワークB
Route A Route B
RouteLink AB
• RouteLinkオブジェクトを作成 • Routeオブジェクトのつながりを管理
!93
ルートリンク層
RouteLink AB
• RouteLinkオブジェクトを作成 • 繋げたいRouteのペア分オブジェクトを作成する
仮想ネットワークA 仮想ネットワークB
Route A Route B
仮想ネットワークC
Route ACRoute CA
RouteLink AC
!94
RouteLinkの中身
RouteLink AB
• 擬似的なMACアドレスが入っています • OpenVNetの世界でのみ合意が取れている
• MACアドレスでRouteLinkが識別できる
仮想ネットワークA 仮想ネットワークB
Route A Route B
仮想ネットワークC
Route ACRoute CA
RouteLink AC
!95
データパスルートリンク層
• ここまでで仮想的な経路は表現できた • 仮想と物理とのマッピングを表現する
DatapathRouteLink
• 仮想的なルーティング経路(RouteLink)が実際どのdatapath上に存在するのかを表現
• 同様に擬似的なMACアドレスを使って区別する
!96
データパスルートリンク層
eth0 eth0
仮想ネットワークA 仮想ネットワークB
RouteA RouteB
RouteLinkAB
DatapathRouteLink1 DatapathRouteLink2
mac = 00:00:00:00:00:02mac = 00:00:00:00:00:01
!97
OpenVNetのテストについて• インスタンス同士の疎通確認がしたい
• openvnet-testspec • RSpecで記述
• https://github.com/axsh/openvnet-testspec
!98
OpenVNetのテストについて
• ymlによるDBの管理
• シナリオベースでの疎通確認
• 同datapathにいるインスタンス同士
• remote datapathにいる場合
• L3を超える場合とそうでない場合
• vnet同士のルーティング
• セキュリティグループ
• VNetEdge!99
Jenkinsでのジョブ管理
!100
ジョブの流れ
Jenkins Master
Slave3
Slave2
Slave1 br0 br1
VM1 VM2 VM3
Unit test rpmbuild
create repo
integration test
ssh
GRE tunnel
!101
!102
HipChat Notification• 社内で使っているChatツール - https://www.hipchat.com
• Jenkinsがジョブの結果を通知
OpenVNet今後の予定
• WAN Edge機能の強化
• 高可用性
• Wakame-vdcとの連携
!103
Information• 公式Webページ - http://openvnet.com
• チャット - http://tinyurl.com/openvnet