Skip to content

setting the hostname #1

@sdarwin

Description

@sdarwin

Let's say you have a server whose shortname is oak, and fully qualified name is oak.trees.com, as in this forum thread: http://ubuntuforums.org/showthread.php?t=1984993

The file /etc/hostname should be:
oak

The file /etc/hosts should be:
127.0.0.1 localhost
127.0.1.1 oak.trees.com oak

The command:
hostname -f
would show:
oak.trees.com

The command:
hostname
would show:
oak

On the other hand, what appears to be happening with this playbook:

  • The command hostname incorrectly results in:
    oak.trees.com
  • In file /etc/hosts , 127.0.0.1 is being modified instead of 127.0.1.1
  • it is not computing the shortname correctly, which would be to remove everything after the first dot, so that a.b.c.d.e would become just a.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions