14 Jun 2019

Generating a network topology from a hosts file

A bash script that parses a standard hosts files and generates an SVG. The script accepts a standard system hosts file format but actually it only cares about the first host or IP on a line – the whole line is used to name the leaf node. In fact any file format may be used as long as each line begins with something that can be pinged.

A bash script that parses a standard hosts files and generates an SVG. The script accepts a standard system hosts file format but actually it only cares about the first host or IP on a line – the whole line is used to name the leaf node. In fact any file format may be used as long as each line begins with something that can be pinged.

127.0.0.1 localhost # for local people
216.58.213.99 - google
silobrighton.com # Zero waste

The image below is regenerated as a daily Travis CI cron job. See the source on GitHub.