読者です 読者をやめる 読者になる 読者になる

labunix's blog

labunixのラボUnix

「dot」コマンドの「shape=record」でLANポート図を作成してみる。

■「dot」コマンドの「shape=record」でLANポート図を作成してみる。
 途中SSG5の先を雑(?)というか従来の「dot」図として作ってみました。

■「shape=record」の使い方はマニュアルを参照。

 Node Shapes
 http://www.graphviz.org/doc/info/shapes.html

■テキスト

$ cat LANport.log
digraph Router {
  graph [rankdir=TB];
  //graph [rankdir=LR];
  node [shape=record];

  subgraph Modem {
    UP_NW		[label="UP_NW"];
  }
  // UP-Router
  R1			[label="<f0>WAN|<f1>LAN1|<f2>LAN2|<f3>LAN3|<f4>LAN4"];
  FGT80C		[label="<f0>WAN1|<f1>WAN2|<f2>DMZ|<f3>LAN1|<f4>LAN2|<f5>LAN3|<f6>LAN4|<f7>LAN5"];
  FGT80C_Cold		[style=dotted];
  {rank=same;FGT80C;FGT80C_Cold;};

  UP_NW    -> R1:f0		[label="Router"];
  R1:f1    -> FGT80C:f0 	[label="Fortigate-80C"];
  R1:f2    -> FGT80C_Cold;
  R1:f3;				// Link Down
  R1:f4;				// Link Down

  XTM25			[label="<f0>eth0|<f1>eth1|<f2>eth2|<f3>eth3|<f4>eth4"];
  XTM25_Cold		[style=dotted];
  {rank=same;XTM25;XTM25_Cold;};
  Wifi_Router		[label="<f0>WAN|<f1>WLAN0|<f2>LAN1|<f3>LAN2|<f4>LAN3|<f5>LAN4"];

  // VMHost
  vSphere6_1		[label="<f0>vmnic0|<f1>vmnic1"];
  vSphere6_2		[label="<f0>vmnic0|<f1>vmnic1"];
  {rank=same;vSphere6_1;vSphere6_2;};

  vSphere6_1:f1 -> vmjessie1:f0		[label="vmjessie1"];
  vSphere6_2:f1 -> vmjessie2:f0 	[label="vmjessie2"];

  vmjessie1		[label="<f0>eth0|<f1>eth1|<f2>eth2"];
  vmjessie2		[label="<f0>eth0|<f1>eth1|<f2>eth2"];

  Jessie_Test		[label="<f0>eth0|<f1>eth1|<f2>eth2"];

  vmjessie1:f1 -> vmWinTest1;
  vmjessie2:f1 -> vmWinTest2;
  vmjessie1:f2 -> vmRouterTest1;
  vmjessie2:f2 -> vmRouterTest2;

  Jessie_SV		[label="<f0>eth0|<f1>eth1|<f2>eth2"];

  SSG5			[label="<f0>ISDN|<f1>0/0|<f2>0/1|<f3>0/2|<f4>0/3|<f5>0/4|<f6>0/5|<f7>0/6"];
  SSG5_Cold		[style=dotted];
  {rank=same;SSG5;SSG5_Cold;};

  FGT80C:f1;				// Link Down
  FGT80C:f2 -> Wifi_Router:f0   	[label="Wifi_NAT"];
  FGT80C:f3 -> vSphere6_1:f0		[label="vSphere6_1"];
  FGT80C:f4 -> vSphere6_1:f1;
  FGT80C:f5 -> vSphere6_2:f0		[label="vSphere6_2"];
  FGT80C:f6 -> vSphere6_2:f1;
  FGT80C:f7;				// Link Down

  Jessie_SV:f1 -> XTM25:f0		[label="XTM-25"];
  Jessie_SV:f2 -> XTM25_Cold;

  XTM25:f1 -> jessie_eth0		[label="jessie_Client"];
  XTM25:f2 -> Win10_LAN			[label="Win10_Client"];
  XTM25:f3 -> SSG5_Cold;
  XTM25:f4 -> SSG5:f1			[label="SSG-5"];

  Cisco892_Test				[style=dotted];
  Cisco892_TestCold			[style=dotted];

  C2960_Test				[style=dotted];
  C2960_TestCold			[style=dotted];
  SRX100_1				[style=dotted];
  SRX100_2				[style=dotted];
  NetGear				[style=dotted];

  SSG5:f0;				// Link Down
  SSG5:f2  -> Cisco892_Test;
  SSG5:f3  -> Cisco892_TestCold;
  SSG5:f4  -> C2960_Test;
  SSG5:f5  -> C2960_TestCold;
  SSG5:f6  -> SonicWall;
  SSG5:f7  -> Jessie_Test:f2		[label="Jessie_Test"];

  Cisco892_Test     -> SRX100_1;
  Cisco892_TestCold -> SRX100_2;
  C2960_Test        -> Jessie_Test:f1;
  SRX100_1          -> NetGear;
  NetGear           -> Jessie_Test:f0;

  Wifi_Router:f0 -> android_tab		[label="android_tab"];
  Wifi_Router:f1;			// Link Down
  Wifi_Router:f2 -> Jessie_SV:f0	[label="Jessie-Proxy"];
  Wifi_Router:f3;			// Link Down
  Wifi_Router:f4;			// Link Down
  Wifi_Router:f5;			// Link Down

}

■SVGへの変換と画像の確認

$ dot -Tsvg LANport.log -o LANport.svg && gthumb  LANport.svg&

■PNGへの変換と画像の確認

$ dot -Tpng LANport.log -o LANport.png && gthumb  LANport.png&

f:id:labunix:20161111033402p:plain