plotnetcfg入門 | Introduction to plotnetcfg

8
“plotnetcfg” 入入 Introduction to "plotnetcfg“ Twitter: @ebiken | [email protected] Introduction to "plotnetcfg" | 2015/11/23 1

Transcript of plotnetcfg入門 | Introduction to plotnetcfg

Page 1: plotnetcfg入門 | Introduction to plotnetcfg

“plotnetcfg” 入門Introduction to "plotnetcfg“

Twitter: @ebiken | [email protected]

Introduction to "plotnetcfg" | 2015/11/23 1

Page 2: plotnetcfg入門 | Introduction to plotnetcfg

What is “plotnetcfg”• Linux のネットワーク設定情報を取得し、描画するツール•軽量&リモートでも動作 ( scp 経由で設定情報を取得)• net namespace に対応•フロントエンドを変更する事で複数の描画フォーマットに対応• JSON 形式( default )• graphviz ( pdf, png … )

Introduction to "plotnetcfg" | 2015/11/23 2

From: https://github.com/jbenc/plotnetcfg/blob/master/README

Page 3: plotnetcfg入門 | Introduction to plotnetcfg

How to use “plotnetcfg” | 使用方法• JSON Format | JSON 形式$ sudo ./plotnetcfg

// generated by plotnetcfg v0.4.1-6-gae5d43b on Mon Nov 23 19:17:50 2015digraph {node [shape=box]"/lo" [label="lo (loopback)\n127.0.0.1/8\n::1/128",style=filled,fillcolor="darkolivegreen1"]"/eth0" [label="eth0 (e1000)\n10.0.2.15/24\nfe80::a00:27ff:fe45:ff7a/64",style=filled,fillcolor="darkolivegreen1"]}

• pdf , png format | pdf , png 形式$ sudo ./plotnetcfg | dot -Tpdf > protnetcfg-output.pdf$ sudo ./plotnetcfg | dot -Tpng > protnetcfg-output.png

Introduction to "plotnetcfg" | 2015/11/23 3

Page 4: plotnetcfg入門 | Introduction to plotnetcfg

Introduction to "plotnetcfg" | 2015/11/23 4

How to install |インストール手順 ( Ubuntu 14.04 )• Jansson library is required, version 2.3 or newer:

$ sudo apt-get install libjansson-dev pkg-config

• github to get source code$ sudo apt-get install git

• “graphviz” for “dot” command$ sudo apt-get install graphviz

• Clone source code and make!!$ git clone https://github.com/jbenc/plotnetcfg.git$ cd plotnetcfg/~/plotnetcfg$ make

Page 5: plotnetcfg入門 | Introduction to plotnetcfg

(1/2) net namespace example | net namespace の例

Introduction to "plotnetcfg" | 2015/11/23 5

1. $ sudo ip netns add host0 $ sudo ip netns add host12. $ sudo ip link add veth0 type veth peer name veth13. $ sudo ip link set veth0 netns host0 $ sudo ip link set veth1 netns host1

1. Create 2 namespaces, host0, host12. Create veth0, veth13. Attach veth0/1 to namespace host0/1

1. namespaces を作成 ( host0, host1 )2. veth0, veth1 を作成3. veth0/1 を namespace host0/1 へ割り当て

$ sudo ./plotnetcfg | dot -Tpng > plot-vethpair.png

Page 6: plotnetcfg入門 | Introduction to plotnetcfg

(2/2) net namespace example | net namespace の例

Introduction to "plotnetcfg" | 2015/11/23 6

# ip netns exec host0 ip link set veth0 upveth0 change to Pink (Up but other end down)

veth1, lo is Gray (link down)

veth0 を up させると Pink に ( 接続先が down)veth1, lo は down なので Gray のまま

# ip netns exec host1 ip link set veth1 upveth0 / veth1 change to Green (Link up)

veth0 / veth1 を Link up させると Green に

Page 7: plotnetcfg入門 | Introduction to plotnetcfg

bond, bridge, VLAN examples | bond, bridge, VLAN の例

Introduction to "plotnetcfg" | 2015/11/23 7

From: https://twitter.com/ttaniguti/status/668734592971476993Thanks to @ttaniguti

Page 8: plotnetcfg入門 | Introduction to plotnetcfg

Links to more information | Link 集• GitHub• https://github.com/jbenc/plotnetcfg

• Video/ Slides presented by author. (作者によるプレゼンテーション)• “Untangle complex network setups”• @ OVS Conference November 2015. Rashid Khan, Jiri Benc • http://openvswitch.org/support/ovscon2015/16/1505-khan.pdf• https://www.youtube.com/watch?v=V1xHyOfbx2g

Introduction to "plotnetcfg" | 2015/11/23 8