Programming network switches and routers using TeX

I’m a network engineer, and a part of my job is configuring switches, routers and firewalls. I usually work with projects that have some thousands switches each: some core switches, server switches, many distribution switches, and a large amount of small access switches for users. I mainly make networks for cruise ships – just imagine a cruise ship with about 3000 passengers and 1000 crew: each cabin gets network access for IP-TV, IP telephone, air condition, programmable door lock, computer port. Not to forget let’s say 1000 WiFi access points, 300 CCTV cameras, cash machines, vending machines, office computers everywhere, even in the Spa, IP clocks, engine and nautical workstations, broadcast center and of cause redundant data centers with racks full of servers. For security reasons, there are hundreds of VLANs (virtual networks) in several (virtual) security domains.

How to configure and to manage all of this?

Let’s take a look at configurations:

Continue reading

Crossing lines

Sometimes it’s not possible in diagrams or charts, that a line goes over another one. To not let this crossing look like a real connection of the two lines, we can let the top line go over a gap in the bottom line. It would require to calculate the intersection of the lines.

However, there’s an easy way: draw the firsts line normally, then draw the top line with a bit whitespace around. Or the top line first thicker and white (or background color), then again thin and black (foreground color).

The probably easiest way in TikZ is: draw a “double” line (TikZ manual, 15.3.4 Graphic Parameters: Double Lines and Bordered Lines). Originally, it gives two parallel lines with space in-between filled by a color. But we want to get a single line. Solution: a double line in white, the gap between them filled in black. This results in a black line with white space around.

Many words, short and simple code example:

This way, double distance is the width of the actual black line, while line width stands for the white space on each side.

Use it such as:

It can look like:




Flipping images

When I defined an image as a TikZ node, I easily create and use a flipped version: I define a mirror style that does a reflection for me:

As my original style was defined this way

I simply override the image style by adding the mirror style:

This way I can get a diagram with a focus to its center:


Images as TikZ nodes

In diagrams, I need to include images, such as symbolic icons or photos of actual hardware. I defined a generic TikZ style with two arguments: the name of the image, and the desired width. The height comes automatically with the same aspect ratio.

For the final node style, I apply this style plus adjustments such as actual node width and x or y separation:

All style definitions above go into a \tikzset command, separated by comma, plus many more global styles I need:

This way I get photos with annotations for larger physical diagrams: