Search This Blog

Showing posts with label diagram. Show all posts
Showing posts with label diagram. Show all posts

Monday, December 30, 2013

Physical network diagram generated from dot config language

Is there a good and easy solution to automatically generate logical or physical network diagrams? Trying answer this question I've been playing today with the dot configuration language to test it in the field.

Automatically generated diagram


The DOT config file 

graph physical_net_topology {
 
legend [ label="{ legend | {red | public} |{blue| v1002 inside} | {green | v105 dmz} }", shape=record];


subgraph cluster_sp {
    label="pub switch";

    graph [ fillcolor="burlywood", style="filled"]
    node [shape=record,fillcolor="white", style="filled"]
    edge[style=invis];
    
    node [label="3"] p3 ;
    node [label="2"] p2 ;
    node [label="1"] p1 ;

    { rank=same; p1; p2; p3}
    p1 -- p2 -- p3;
}

subgraph cluster_si {
    label="Internal switch";

    edge[style=invis];
    node [shape=record ];

    node [label="1"] e1 ;
    node [label="2"] e2 ;
    node [label="3"] e3 ;
    node [label="4"] e4 ;
    node [label="5"] e5 ;
    node [label="6"] e6 ;

    { rank=same; e1; e2; e3; e4; e5; e6;}
    e1 -- e2 -- e3 -- e4 -- e5 -- e6;
}

subgraph cluster_fw1 {
    label="FW1 ports";

    graph = [ style = rounded]
    edge[style=invis]
    
    node [shape=record ];
    node [label="1"] f1 ;
    node [label="2"] f2 ;
    node [label="3"] f3 ;
    node [label="4"] f4 ;

  { rank=same; f1; f2; f3; f4; }

  f1 -- f2 -- f3 -- f4'
}

p2 -- f1 [color="red"]
f2 -- e1 [color="blue"]
f3 -- e2 [color="green"]

e3 -- server1 [color="green"]
e4 -- server2 [color="green"]
e6 -- server3 [color="blue"]

}

Results discussion

It took me a good couple of hours to write this config. Even after that I still have only a very basic understanding of how flexible the dot language is. The coding was very laborious. It required a lot of trying and testing if the new generated graph is what you are looking for.

Often the options I was trying didn't have any effect.

The documentation I found and read wasn't explaining all the details so trying and intuition was often your only friend.

References

http://sandbox.kidstrythisathome.com/erdos/
http://graphviz-dev.appspot.com/
http://www.graphviz.org/

http://rtomaszewski.blogspot.co.uk/search/label/diagram

Sunday, December 15, 2013

ASCII diagram tells more than a full page of text

Before anyone can help you they need to understand you first. Below is an example why a single picture is worth more than than full page of text.

Problem

How long would it take to explain to somebody that:
  • VLAN1 is used ONLY for inter VM communication
  • VMs in VLAN2 and 3 are in isolated network segments that have internet access
  • VMs in VLAN2 and 3 can talk to each other (using the FW as its default gateway to route traffic)
Solution

ASCII diagram:
                                               +---+------------+
                                               |   |            |
          ^                                    | v |------------|
          | internet                           | m |  vm2       |
          |                         vlan1      | 1 |------------|
      +---+---+         +-------+   vlan2      |   |  vm3       |
      | FW    | <-------|switch1| ------------ |----------------|
      +-------+   vlan3 +-------+   vlan3      |virt1 |virt2 |  |
                  vlan2     ^                  |switch|switch|  |
                            |                  |------+------+--|
                            |                  | Hypervisor1    |
                            | trunk            +----------------+
                            | vlan1
                            |
                            |
                            +
                       +-----------+  vlan1            
                       |aggregation|  vlan2    +-------------+
                       |-----------+<--------- | vm1 vm2     |
                       | switch    |  trunk    |-------------|
                       +-----------+           | Hypervisor2 |
                                               +-------------+

References

http://www.asciiflow.com/#Draw
http://www.streamwave.com/web-development/ascii-diagram-tools/
http://nedbatchelder.com/blog/200911/ditaa_diagrams_through_ascii_art.html

Monday, April 15, 2013

Howto generate simple network diagrams

A picture is worth more than 1000 words one of the proverbs says. This is absolute truth when you  troubleshoot and need to understand a customer network environmental  Below is a very simple recipe (unfortunately) how to generate a network diagram with a tool called nwdiag.

Instalation
 
aptitude install python-dev
pip install nwdiag

# will generate a png file diag1.png
nwdiag  diag1.conf

Example 1: FW with one segment
 
{
  public [shape = cloud];
  public -- firewall;

  network inside {
      address = "192.168.100.x/24"

      firewall [address = "192.168.100.1"];
      web01 [address = ".11"];
      cachesrv [address = ".51"];
      db1 [address = ".101"];
  }
}

Example 2: FW with dmz and inside segment
 
{
  public [shape = cloud];
  public -- firewall;

  network dmz {
      address = "192.168.200.x/24";

      firewall [address = "192.168.200.1"];
      web01 [address = ".11"];
      cachesrv [address = ".51"];
  }
  network inside {
      address = "192.168.100.x/24"

      firewall [address = "192.168.100.1"];
      db1 [address = ".101"];
  }
}