# Problems setting my hostname

## mattheweast

Hi there, I have some slight problems with this. I followed the guide at https://forums.gentoo.org/viewtopic.php?t=276942.

I get my IP for my server via dhcp. Here is my setup:

I use dyndns for my ip resolution, and the name is mdke.mine.nu

/etc/hosts:

```

127.0.0.1 euthathios.mdke.mine.nu euthathios localhost
```

/etc/hostname:

```
:

euthathios
```

/etc/domainname:

```

mdke.mine.nu
```

So everything is as in the guide. I have rebooted.

However I get this error with one of the commands that you specified to check the setup:

```

matt@eustathios matt $ hostname

eustathios

matt@eustathios matt $ hostname --fqdn

hostname: Unknown host
```

Further, Proftpd and tetrix fail to start, the errors being, respectively:

```

root@eustathios matt # /etc/init.d/tetrix start

 * Starting TetriNET Server...

Hostname self-lookup failed.                                              [ !! ]
```

```

root@eustathios matt # /etc/init.d/proftpd start

 * Starting proftpd...

 - getaddrinfo 'eustathios' error: Name or service not known

 - warning: unable to determine IP address of 'eustathios'

 - error: no valid servers configured

 - Fatal: error processing configuration file '/etc/proftpd/proftpd.conf  [ !! ]
```

I would appreciate some help with this!! I've never got my hostname/hosts/domainname set up exactly right on this network...

Thanks in advance!! Matt

----------

## iarwain

 *mattheweast wrote:*   

> 
> 
> /etc/domainname:
> 
> ```
> ...

 

 *Quote:*   

> 3) /etc/dnsdomainname should contain localnetwork
> 
> Code:
> 
> echo localnetwork > /etc/dnsdomainname

 

Have you created dnsdomainname?

----------

## mattheweast

Hi, thanks for your reply!!

```
root@eustathios matt # cat /etc/dnsdomainname

mdke.mine.nu
```

I also sym linked nisdomainname to this, and made sure the service was running and started upon boot.

M

----------

## mattheweast

Having said this, there is obviously something wrong with it, because:

```
matt@eustathios matt $ dnsdomainname

dnsdomainname: Unknown host
```

As i mentioned, mdke.mine.nu is the name I use with dyndns to resolve my IP. Does anyone have any suggestions?

Thanks again. M

----------

## Lajasha

make sure that you have those entered into your hosts file too...

----------

## comprookie2000

here is mine

```
# /etc/hosts:  This file describes a number of hostname-to-address

#              mappings for the TCP/IP subsystem.  It is mostly

#              used at boot time, when no name servers are running.

#              On small systems, this file can be used instead of a

#              "named" name server.  Just add the names, addresses

#              and any aliases to this file...

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/hosts,v 1.8 2003/08/04 20:12:25 azarah Exp $

#

127.0.0.1        localhost

192.168.1.97        abbottdavid.localnetwork  abbottdavid

# IPV6 versions of localhost and co

::1 ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts

```

----------

## bone

/etc/hostname and /etc/domainname are deprecieated. Use /etc/conf.d/hostname and /etc/conf.d/domainname.

Note: Using these will not cause the problem, I am just stating that they are deprecieated.

jt

----------

## Braempje

 *bone wrote:*   

> /etc/hostname and /etc/domainname are deprecieated. Use /etc/conf.d/hostname and /etc/conf.d/domainname.

 

Do you have any references for that? I haven't found any information on it, neither in my files (they don't exist) nor in the documentation.

----------

## duderonomy

me too. (i.e. I would be interested in the reference too)

----------

## Cintra

 *Quote:*   

> After updating baselayout to 1.11.8 i get messages on boot of the form:
> 
> Stop using /etc/dnsdomainname and use /etc/conf.d/domainname
> 
> same with domain, clock and keymaps. 

 

Took a while to find this but thats where it came from.. surprised you haven't seen the messages.

mvh

----------

## cjt007

dnsdomainname is sym linked to hostname on Fedora Core 14.

The use od dnsmasq with the -s option means that the /etc/hosts file

and the /etc/resolv.conf file are both brought into play.

192.168.7.2 mrepo cobbler.localdomain

will fail - WHY? because the usual semantics of DNS are used

IP address  followed by FQDN followed by alias(s).

Which means that 192.168.7.2 is the IP address it might find inside /etc/hosts

mrepo is supposed to be the FQDN - but how can it be - really.

The dnsmasq application will not complain about this entry.

The hostname command comes back with the right name iff

the /etc/sysconfig/network entry has the correct name and they

agree that /etc/hosts has the same info - at least for that hostname.

So the dnsdomainname is trying to pull apart mrepo into its 

short hostname and dnsdomainname parts. This is not possible

because there is no DOT FQDN available.

What should happen is  the entry should be re-ordered to

192.168.7.2 cobbler.localdomain mrepo

Now Cobbler is happy because it has a dnsmasq entry for mrepo

and dnsdomainname is happy because it splits the cobbler.localdomain

(FQDN) up with the DOT syntax as

short hostname: cobbler

dnsdomainname: localdomain

----------

