# can't correctly set my hostname and domain name [SOLVED]

## gnychis

Hi,

I am having a problem setting my hostname and domain name.

I keep getting errors like:

```

THORIUM-INI hedpe # /etc/init.d/apache2 restart

 * Starting apache2 ...

apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName          [ !! ]

```

```

THORIUM-INI hedpe # hostname --fqdn

hostname: Unknown host

```

--

And now for the information, any help would be greatly appreciated!

thorium-ini.ini.cmu.edu (128.2.140.234)

```

THORIUM-INI hedpe # ifconfig

eth0      Link encap:Ethernet  HWaddr 00:12:3F:98:04:D6  

          inet addr:128.2.140.234  Bcast:128.2.141.255  Mask:255.255.254.0

          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1018608 errors:0 dropped:0 overruns:0 frame:0

          TX packets:241723 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:291348124 (277.8 Mb)  TX bytes:23077397 (22.0 Mb)

          Interrupt:16 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:19217 errors:0 dropped:0 overruns:0 frame:0

          TX packets:19217 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:2990115 (2.8 Mb)  TX bytes:2990115 (2.8 Mb)

```

```

THORIUM-INI hedpe # cat /etc/hosts

# /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

# 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

```

```

THORIUM-INI hedpe # cat /etc/conf.d/domainname 

OVERRIDE=1

DNSDOMAIN="ini.cmu.edu"

```

```

THORIUM-INI hedpe # cat /etc/conf.d/hostname 

HOSTNAME="thorium-ini.ini.cmu.edu"

```

Last edited by gnychis on Wed Sep 14, 2005 1:30 am; edited 3 times in total

----------

## bitwise

/etc/conf.d/hostname shouldn't have the hostname+domain name, just set it as thorium-ini, and set /etc/conf.d/domainname as what you have it. then in /etc/hosts add thorium-ini and thorium-ini.ini.cmu.edu after "127.0.0.1 localhost"

----------

## gnychis

got it working

everything seemed to be case sensitive??

for instance i had localhost as THORIUM-INI, when it should have been thorium-ini

i'm not sure

it works now though  :Smile: 

----------

## huh_dude

While this thread is still here, trying to set up fqdn I got the following output:

```

<localhost> /# dnsdomainname iprimus.com.au

dnsdomainname: You can't change the DNS domain name with this command

Unless you are using bind or NIS for host lookups you can change the DNS

domain name (which is part of the FQDN) in the /etc/hosts file. 
```

What I don't know is how to change the DNS domain name in the /etc/hosts file. So far the only input it accepts is the localhost hostname: 127.0.0.1   <xxx>

If I put the domain name after it:

127.0.0.1   <xxx> iprimus.com.au

It just returns "unknown host". 

If I enter #hostname --fqdn 

that command only returns the localhost part of the string: 

<xxx>

If I enter: #hostname <xxx>.iprimus.com.au

it only returns "unknown host".

----------

## gnychis

i'm not sure, i'll atleast take my [SOLVED] off to get you some more looks until you figure that out

----------

## huh_dude

I got #hostname --fqdn by setting a name in /etc/conf.d/hostname    

"<xxx>@domainname" (no quotes)

and entering: (#nano -w /etc/hosts)

127.0.0.1  <xxx> <any alias for xxx>

ip address <xxx@domainname>

also doing 

#hostname <xxx>.domainname

#rc-update add eth0 default

#rc

Though I don't have a registered net domain name it does connect the service. Had to do some work in #/etc/init.d first (I think "multi on"as I have more than one nameserver address). 

Thanks hepte   :Very Happy: 

----------

