Skip to content

BrettRD/hostname_generator

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

hostname_generator

A deterministic generator of random hostnames.

A trivial rule and a seeded random number generator allow a human-readable hostname to be associated with a given physical machine, or a given (re)deployment of VMs

The Birthday Problem is unkind to very large deployments, pull requests welcome to expand the lists or expand the name space.

The python script reports probability of hostname collision with a given deployment size, then prints some examples.

The shell scripts will generate a host from a given seed (like a mac address).
The script will hash the seed (md5), which allows any unique data source to be used and still effectively span a huge namespace.

Installation

This is intended for single board computers that get imaged and dropped into new machines.

Clone this repo into /usr/local/sbin/
Copy hostname_generator.service into /etc/systemd/system
Call systemctl enable hostname_generator.service

Without installation

To just name your system once off, run change_hostname.sh $(./name_gen.sh $(cat /sys/class/net/eth0/address))

About

A deterministic generator of random hostnames

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published