Creating network diagrams with dia

Posted by Steve on Mon 25 Jul 2005 at 13:16

There are many times when you'll want to create network diagrams, or other simple diagrams using a combination of linked images and straight lines. The dia application is perfect for this.

dia describes itself as an editor for diagrams, graphics, and charts. That's pretty much what it is, a simple layout and diagram generator stocked with a collection of themed image sets.

When installed you're presented with a toolbox containing the image sets, along with a blank canvas to start drawing with.

It's operation is very intuitive. As expected simply selecting one of the tools upon the toolbox allows you to drop it upon the canvas with a simple click. Moving objects once they are in place is likewise supported, as are the other common operations such as multiple selection, copying and pasting.

In addition to the collections of images, you also have a variety of line drawing tools, which can be anchored to images - so when the image moves the line does too.

When you've finished producing your masterpiece you can save it as a .dia file, (which is really a compressed XML document), or you can use the "Export" option to export the diagram into other formats.

Available output formats include, .png, .svg, and formats relating to editing with other packages.

dia can also be used upon Microsoft Windows, if you need to allow other people to edit your work - or if you have a mixed environment. A binary distribution allows simple installation, along with all dependencies for Windows.

To install it upon Debian you can use apt-get as root, by running:

apt-get install dia

As a sample of the kind of images you can produce here's a copy of my current home setup:

My home network setup

Because the .dia files are nothing more than simple XML files which have been compressed with the standard gzip encoding you can generate them programmatically if you wish.

Generating programmatic input is very useful when combined with the scriptable output dia supports. The conversion of an input file to an output file can be generated using some of the optional command line options.

For example we can take a previously drawn file and convert this to a .png file with the following example command line:

dia --export=blah.png -t png -s 200x600 Diagram1.dia 

Here we have exported the input file Diagram1.dia to an output file blah.png using the png format (which was set with "-t png"). The image output size was set to 200x600 pixels with the -s flag.

The command line generation doesn't require the use of a valid X11 display - although if you do run it without X11 you'll get a warning:

could not import gtkcons.py

This warning appears to be harmless.

For a description of the available command line options, and the format strings to pass to the -t option please consult the man page via:

man dia

 

 


Posted by ska (81.225.xx.xx) on Mon 25 Jul 2005 at 17:50
[ Send Message ]
Dia is a really nice tool to use, it's very easy to get started with and can also create quite nice-looking figures (even for those which are not very skilled, as myself!).

One tip which at least I find very valuable is to enable the "Snap to grid" functionality, which makes it easier to align lines (I think I see a slightly misaligned line in Steve's diagram ;-) ).

Exporting to other formats directly from the command line is a great way of integrating Dia figures into the build processes for e.g., LaTeX documents, if you use Makefiles - this is another reason why I really, really like Dia.

// Simon

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Mon 25 Jul 2005 at 19:47
[ Send Message | View Steve's Scratchpad | View Weblogs ]

Yes the snap to grid functionality is very nice - and you're right about misaligned things in that sample image. It was a quick job to update the diagram I had when the previous setup was replaced.

I'm very happy with dia - and the command line export is a wonderful addition to it. (I'll not tell anybody how long it took me to realise it was possible to use it that way ;)

Steve
-- Steve.org.uk

[ Parent | Reply to this comment ]

Posted by Anonymous (62.252.xx.xx) on Tue 26 Jul 2005 at 08:46
Nice article, I never knew about the command-line export before (although being a graphical app I haven't really had cause to use it). There are some nice colour icons provided by Cisco, converted for Dia here.
I used them to create the diagram on my Linux clustering page and I'm pretty happy with the result. The icons are public domain, so hopefully they'll make their way into the main dia distribution soon.

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Tue 26 Jul 2005 at 14:32
[ Send Message | View Steve's Scratchpad | View Weblogs ]

Good link - thanks for sharing.

It would be very nice to get some colour into the pictures :)

Steve
-- Steve.org.uk

[ Parent | Reply to this comment ]

Posted by ska (194.47.xx.xx) on Tue 26 Jul 2005 at 09:00
[ Send Message ]
I use Dia to create "animations" for presentations etc as well. OK, the animations are not of the type "something flies in from the right, transforming into ..." of course, but I find Dia very useful when creating animations of the type "step 1, step 2, step 3" etc. An example is on

http://www.ipd.bth.se/ska/astar.pdf

where all animations (and all figures which are not simply screenshots) are created with Dia. For the animations, I use layers where the different steps are visible and then export EPS files with a subset of the layers visible.

The CVS version of Dia contains a --show-layers= option so that you can specify the layers on the command line (for integration into Makefiles), but personally I use the Debian package with local patches.

// Simon

[ Parent | Reply to this comment ]

Posted by Arnaud (131.254.xx.xx) on Tue 26 Jul 2005 at 14:21
[ Send Message | View Weblogs ]
I often have to draw figures that will be included in scientific papers.

I used to draw all of them with dia but after two or three months, little details irritated me.
I (re)discovered Inkscape and I now draw everything with it. It is a vectorial drawing editor I found excellent for all purposes. I agree it does not the same things as Dia and that it may be a "too much" if you just want to draw a quick diagram.
But I think it worths a try !

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Tue 26 Jul 2005 at 14:31
[ Send Message | View Steve's Scratchpad | View Weblogs ]

Thanks for the recommendation - I've used inkscape in the past a few times, but I usually come back to dia for simple layouts.

As you say it's a different tool, and I can generally use dia to produce an image much quicker, so its something I recommend a lot.

Steve
-- Steve.org.uk

[ Parent | Reply to this comment ]

Posted by Anonymous (205.250.xx.xx) on Tue 26 Jul 2005 at 14:25
Am I the only one that finds 'Mystery' 'Scratchy' 'Recurring' funny?

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Tue 26 Jul 2005 at 14:29
[ Send Message | View Steve's Scratchpad | View Weblogs ]

Probably not - they make me laugh!

I used to have a more coherant naming policy, which had sun, moon, earth, etc.

Then I retired machines and was left with mystery - because I decided I didn't want to continue the previous naming policy.

scratchy comes from my workplace, which previously had all machines named after characters from The Simpsons - it's been a name I've used a few times for "scratch" machines.

recurring is a literal name; the machine in question has been almost completely scrapped and rebuilt several times. That together with my almost complete abandonment of Windows at home, and the recent rebuild + installation of 2000 made the name recurring seem appropriate.

... if you look back over the much older articles you'll see a variety of different hostnames used in examples - most of them no longer used, but still remembered.

(My first Linux hostname was mice, I belive. Though it's been a long time ...)

Steve
-- Steve.org.uk

[ Parent | Reply to this comment ]

Posted by forrest (208.42.xx.xx) on Thu 28 Jul 2005 at 04:04
[ Send Message | View Weblogs ]
This is getting offtopic, but what are everyone else's hostnames? I'm posting this now from gemini, so named because it's a dual-processor machine.

My first linux box I named jacquard, becuase I had this idea at the time to make a loom and weave non-repeating patterns using fractal algorithms. (Maybe one day I'll still do that, but building a computerized loom is beyond me.)

jacquard eventually morphed into junkyard as it was old and slow to start with, and swapped in hard disks and things from other peoples' throwaway machines.

Then came garbarek, named after one of my favorite musicians, which is currently my mailserver.

My Mac OS X Powerbook is named banana, and I made my wife name her own machine (running the dreaded MS Windows OS), and she chose dragon.

So, I haven't been able to keep a "theme" going here either.

(BTW, Lappy and Recurring have the same IP address.)

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Thu 28 Jul 2005 at 07:30
[ Send Message | View Steve's Scratchpad | View Weblogs ]

Interesting question - mostly I've stuck with the ideas of RFC-1178: Choosing a name for your computer, that is a handy reminder when you have more than four or five machines to manage. But for my home I am more relaxed.

(BTW, Lappy and Recurring have the same IP address.)

True, and I never thought that was strange until you commented. They are never turned on on at the same time, so it works out OK for the moment .. probably should be fixed though.

Steve
-- Steve.org.uk

[ Parent | Reply to this comment ]

Posted by Excds (212.75.xx.xx) on Thu 28 Jul 2005 at 08:33
[ Send Message ]
I'm posting this from grillvante (oven mitt), my computer at work. Otherwise I've had no consistency at all with names.
  • hybris, fastest at home
  • guinness, file/web-server
  • evil, laptop
  • baronbosse, retired gateway (name comes from a Swedish comic named "Assar")
  • botong, Sparcstation2 (also name from "Assar")
  • asimov, named 5 am
  • ostron, (oyster) also named 5 am
  • pingu
  • ture, my (now dead) cat
  • razor, SS5 at old workplace (also named from "Assar")
--
Ever noticed something? Unix comes with compilers. Windows comes with
Solitaire.

[ Parent | Reply to this comment ]

Posted by Anonymous (65.172.xx.xx) on Fri 29 Jul 2005 at 02:08

This is getting offtopic, but what are everyone else's hostnames?

I name mine with characters from the works of my favorite poet, William Blake, so they have names like vala, thel, edom, urizen.

[ Parent | Reply to this comment ]

Posted by Anonymous (69.68.xx.xx) on Wed 27 Jul 2005 at 20:07
Don't forget graphviz, which lets you create diagrams using simple text language.

[ Parent | Reply to this comment ]

Posted by kamaraju (24.58.xx.xx) on Fri 29 Jul 2005 at 06:05
[ Send Message ]
I use xfig. It is very intuitive to use this app. It is very powerful and I have had good results with it.

[ Parent | Reply to this comment ]

Posted by Anonymous (81.3.xx.xx) on Wed 10 Aug 2005 at 05:14
For network diagrams you can use Mila Netwhistler.

[ Parent | Reply to this comment ]

Posted by dkg (216.254.xx.xx) on Sat 1 Apr 2006 at 18:01
[ Send Message | View dkg's Scratchpad | View Weblogs ]
consider also lanmap which just recently made it into debian unstable. It does automated generation of graphs by listening on a network.

[ Parent | Reply to this comment ]

Posted by danny0085 (200.87.xx.xx) on Tue 10 Aug 2010 at 03:40
[ Send Message ]
You should could use packet Tracer for linux to diagram http://tips-linux.net/en/content/cisco-packet-tracer-5 or Cartoreso to automatic generated a map http://tips-linux.net/en/content/cartoreso-network-mapper

[ Parent | Reply to this comment ]

Sign In

Username:

Password:

[Register|Advanced]

 

Flattr

 

Current Poll

Which init system are you using in Debian?






( 1037 votes ~ 6 comments )