Wiki source for OpenNIC Topology Graphics


Show raw source

**Script for creating a live topology graphic of current OpenNIC DNS Network using Graphviz and DNS data from NS0.**

== Graph Example ==
{{image url="http://www.abload.de/img/opennicdax7y.png" title="OpenNIC Topology" alt="text"}}

== Script ==
%%(bash)
#!/bin/bash
# 2012, Falk


NS0="ns0.opennic.glue"

t1=`dig axfr opennic.glue @${NS0} | egrep "^ns[1-9]{1,2}.opennic.glue" | awk '{ print $1}' | uniq | sort`
t2=`dig axfr dns.opennic.glue @${NS0}| egrep '.dns.opennic.glue. [0-9]{1,6} IN' | cut -d " " -f 1 | uniq`

# Static graph root
echo 'digraph OpenNIC {
ns0 [label="ns0.opennic.glue",fillcolor=greenyellow,style=filled];
node[shape=record];
rankdir=RL;'

# subgraph for alle T1s
echo 'subgraph Tier1 {
node[style=filled,fillcolor=green3];'

for server in ${t1}
do
echo "\"${server%?}\" -> ns0;"
done
echo '}'

# subgraph for all T2s
echo 'subgraph Tier2 {
node [style=filled];
color=lemonchiffon1;
edge [color=gray84];'
for server in ${t2}
do
for uplink in ${t1}
do
echo "\"${server%?}\" -> \"${uplink%?}\";"
done
done
echo '}'
echo '}'
%%

== Usage ==
Requirement: You need ""GraphViz"" for this to work!
%%(bash)
./opennic-topology.bash > opennic.dot
dot -Tpng -o opennic.png opennic.dot
%%
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki