hostname without dot and after

Hello,

When I set in Virtualmin -> Webmin -> Networking -> Network Configuration -> Hostname and DNS Client, Hostname name with dot and something after, it won’t showup in box after saving it.

ex. I set example.com it will only shows example (without dot and after).

but in Virtualmin’s System Information, System hostname is providing name right, with dot (example.com).

Does your hosts file have something funny going on? (What’s in /etc/hosts?)

OS: Debian 5.0 Lenny

/etc/hosts:

[code:1]127.0.0.1 localhost
127.0.1.1 example.com

The following lines are desirable for IPv6 capable hosts

::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts[/code:1]

So this is a little bit funny: "127.0.1.1 example.com"

What do you get from the following two commands:

hostname

hostname -f

You probably actually want a real IP address, rather than a loopback, and you also want two names on the example.com line. For example:

70.86.4.238 virtualmin.com virtualmin

This explains the display weirdness.

As for the 127.0.1.1 thing, Debian/Ubuntu have started doing this to deal with a reality of mostly dynamic IP addresses…but it’s a funky solution to the problem, with some odd side effects. Anyway, in a server, you want a regular static IP (even if it’s just a private one, like 192.168.1.1) and not a second lo address.

My server’s IP is static.
I have changed my /etc/hosts/ with:

[code:1]192.168.0.1 example-domain.com example-domain[/code:1]
but problem still remains (hostname without dot and after in panel).
When I type hostname, it’s the same like hostname -f, and it just shows example-domain.com.
My domain is with dash in name, maybe it’s the problem?

I show you the rest of hostname commands:
uname -n -> example-domain.com
hostname -a -> example-domain
hostname -s -> example-domain
hostname -d -> com
hostname -f -> example-domain.com
hostname -> example-domain.com

This is actually a bug in Webmin 1.480 - on that Hostname and DNS Client page, it always shows the short hostname. However, it will save whatever fully-qualified hostname you enter.

This will be fixed in Webmin 1.490.