Hostname in Fedora 17

How can you change the hostname of your server running Fedora 17? The answer may not be as easy as it initially seems.

The two places where you need to have your hostname present are /etc/hosts and /etc/sysconfig/network files.

In /etc/hosts you need to have a line with the following format: shorthostname

In /etc/sysconfig/network you need to have a line with the following format:

Here you need to provide the FQDN, not just a short hostname, according to the Fedora 17 documentation.

After making the change in /etc/sysconfig/network run the following command and then log out and log back in to see the change.

su -c 'systemctl restart NetworkManager.service'

The Question

After going through this process you need to make sure your hostname is now correct. So you run hostname command. But wait! Instead of showing you shorthostname it shows And you get the same output if you run hostname --fqdn. Why is that? Does Fedora treat an FQDN as hostname now? Is there no difference anymore?

The mystery is solved by looking at the manpage for hostname. If you use hostname --short it’ll give you shorthostname and hostname --domain will give you In this situation if hostname gives the FQDN by default then that should be just fine, as long as us users understand the difference.

One Response to Hostname in Fedora 17

  1. Aurelyen D. says:

    it seems that one also can use the single line
    sudo hostname -v NewName

    seems to work fine for me ( Fedora 17), assuming I don’t work in a network using domain name,
    and that i’m not running Fedora server

%d bloggers like this: