Linux のネットワーク設定情報を取得し、描画するツール "plotnetcfg" のインストール方法や描画サンプル。
"How to" for installing / using "plotnetcfg" which scans networking config of Linux machine and plots a diagram of the configuration hierarchy.
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
3.
How to use“plotnetcfg” | 使用方法
• JSON Format | JSON形式
$ sudo ./plotnetcfg
// generated by plotnetcfg v0.4.1-6-gae5d43b on Mon Nov 23 19:17:50 2015
digraph {
node [shape=box]
"/lo" [label="lo (loopback)n127.0.0.1/8n::1/128",style=filled,fillcolor="darkolivegreen1"]
"/eth0" [label="eth0
(e1000)n10.0.2.15/24nfe80::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
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
Introduction to "plotnetcfg" | 2015/11/23 4
5.
(1/2) net namespaceexample | net namespace の例
Introduction to "plotnetcfg" | 2015/11/23 5
1. $ sudo ip netns add host0
$ sudo ip netns add host1
2. $ sudo ip link add veth0 type veth peer name veth1
3. $ sudo ip link set veth0 netns host0
$ sudo ip link set veth1 netns host1
1. Create 2 namespaces, host0, host1
2. Create veth0, veth1
3. 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
6.
(2/2) net namespaceexample | net namespace の例
Introduction to "plotnetcfg" | 2015/11/23 6
# ip netns exec host0 ip link set veth0 up
veth0 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 up
veth0 / veth1 change to Green (Link up)
veth0 / veth1 を Link up させると Green に
7.
bond, bridge, VLANexamples | bond, bridge, VLAN の例
Introduction to "plotnetcfg" | 2015/11/23 7
From: https://twitter.com/ttaniguti/status/668734592971476993
Thanks to @ttaniguti
8.
Links to moreinformation | 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