Ever wanted to name a server with amazon-ec2 naming convention?
I hope not!
If anyone wondered what is the max length of hostname you can use (solutions and guess over the internet already), but just itching to write down how to find out. Here’s how..
krish@lin-hyd-dsk-07:~> getconf HOST_NAME_MAX
This is defined in file
krish@lin-hyd-dsk-07:~> grep HOST_NAME_MAX /usr/include/bits/local_lim.h
#define HOST_NAME_MAX 64
The Single Unix Specification version 2 (SuSv2) guarantees ‘Host names are limited to 255 bytes’. POSIX 1003.1-2001 guarantees ‘Host names (not including the terminating NULL) are limited to HOST_NAME_MAX bytes’.