# server.unkown_domain???why

## arachn1d

I typed

echo server > /etc/hostname

echo wtf-dude.com > /etc/dnsdomainname

yet i get this

server.unkown_domain?? why??

----------

## ank

Try to add in /etc/hosts

192.168.2.101	server.wtf-dude.com	server

You must type your IP address of course.

----------

## Ateo

Check the file /etc/dnsdomainname to verify the change was made. If it wasn't, add your domain directly to the file.

 *ank wrote:*   

> Try to add in /etc/hosts
> 
> 192.168.2.101	server.wtf-dude.com	server
> 
> You must type your IP address of course.

 

This is for name resolution, not setting your local hostname/domain. Your host file is what is checked first before hitting the name servers you have specified, if the domain is not found in hosts.

----------

## arachn1d

hmm its like i said

server / domainname

wtf-dude.com / dnsdomainname

----------

## Ateo

I am not sure I understand your last post, but nonetheless, what happens if you do this:

```
echo server > /etc/hostname

echo wtf-dude.com > /etc/dnsdomainname

echo server.wtf-dude.com > /etc/nisdomainname
```

----------

## arachn1d

still get server.unkown_domain ( blah blah blah )

when its starting up it looks fine it says setting to >>>

but Because of this error I can't install mysql_db 

which makes apache2 not able to run  :Sad: 

----------

## arachn1d

 *ank wrote:*   

> Try to add in /etc/hosts
> 
> 192.168.2.101	server.wtf-dude.com	server
> 
> You must type your IP address of course.

 

this did it.

But that means everytime i reboot i gotta edit that ip address  :Sad: 

Funny... I didn't have to do this last time I installed gentoo. Why this time?

weird.

When I edit the hosts file in reboot, how do I apply changes without rebooting again for changes to take place?

----------

## Ateo

Strange. I only have one entry in my hosts file:

```
127.0.0.1 localhost
```

 and I have no issues with my hostname.

Also, you will have to edit the IP if you are being assigned a dynamic IP. I suggest assigning a static IP to servers.

If you decide to use a dynamic IP, after changing the IP in hosts, restart domainname.

```
/etc/init.d/domainname restart
```

However, I would suggest not adding domainname to your startup scripts. Just start domainname manually after editing the file.... Of course, this is entirely up to you.

----------

## arachn1d

can i assign static local ips?

that is under a dynamic global ip.

----------

## Chris W

The /etc/hostname file is only used during system startup to set the system host name (see /etc/init.d/hostname and man hostname).   Changing the file after boot will not have an effect unless you re-run the hostname command: 

```
# /bin/hostname server

OR

# /bin/hostname $(< /etc/hostname)
```

A similar arrangement exists for /etc/dnsdomainname (/etc/init.d/domainname).  The domain part of your server name comes from a reverse lookup of the host name either through DNS or the /etc/hosts file.  Set your DNS domain in /etc/resolv.conf thus: 

```
domain wtf-dude.com
```

 and include any DNS servers you use.  If you do not have DNS servers then also add the entry to /etc/hosts: 

```

127.0.0.1 server.wtf-dude.com server
```

 (or the like).

You should now get: 

```
# hostname 

server

# hostname --fqdn

server.wtf-dude.com
```

----------

## arachn1d

thanks

----------

## Ateo

 *arachn1d wrote:*   

> can i assign static local ips?
> 
> that is under a dynamic global ip.

 

Yes, you can assign static IPs using local network IPs. However, if this IP you assign to your server is in the dynamic range that your dhcp server hands out, you might run into IP conflicts.

I suggest assigning a static IP that is outside of your local dhcp range.

----------

## arachn1d

how do i do this

*EDIT**EDIT*oh you mean so if my dhcp router sends ip from 0/24 to make my local ip 25.. for example?

----------

## Ateo

When you configure a dchp server, whether it be a hardware router or dhcpcd for linux, you configure a range of IP addresses to hand out.

Example:

Your network is 192.168.1.0/24. You configure your dhcp server to reserve a range of IPs, let's say, 192.168.1.50 - 192.168.1.100. Since the dhcp server will only hand out those reserved IP addresses, you can use the following IPs however you wish:

192.168.1.1 - 192.168.1.49 && 192.168.1.101 - 192.168.1.254, Remember that x.x.x.0 && x.x.x.255 cannot be used as they are reserved for your network identification and broadcast.

To specifically answer your question, yes, you can use .25 if your dhcp server hands out 1-24.

----------

## arachn1d

ah ok thx

----------

## Shadows

No folks, you don't have to edit /etc/hosts at all if you just want to configure your domain name.

Domain name configuration is done in /etc/resolv.conf (look at the man pages for that file and read the section that describes the keyword domain). /etc/init.d/domainname takes your domain name specified in /etc/dnsdomainname and creates an appropriate entry in /etc/resolv.conf. Now, /etc/init.d/domainname misses a dependency in his depend-function at the beginning of the script.

Add the line "after net.eth0" to /etc/init.d/domainname:

That's what it looks like before our change:

```
depend() {

        need checkroot hostname

        before bootmisc

}
```

Now add the entry mentioned above:

```
depend() {

        need checkroot hostname

        before bootmisc

        after net.eth0

}
```

Note:

If your NIC which uses dhcp isn't net.eth0, then change it to the appropriate one

Explanation:

Now, while having static IP-Addresses, there is no problem. /etc/init.d/domainname changes or creates /etc/resolv.conf and everything is fine -> domain name will be shown correctly like expected. But when you configure at least one NIC to have dhcp, then, because of the missing dependency, /etc/init.d/domainname will first setup /etc/resolv.conf. But if you have configured your dhcp-client to retrieve DNS-Servers from your ISP, it will simply overwrite your old resolv.conf, which leads to a resolv.conf missing the local domain entry.

And, on most old installations, the domainname-script isn't included in the runlevels at all. So you need to add it to the default runlevel (or whatever runlevel your NIC-startup-scripts with dhcp configured belong to):

```
rc-update add domainname default
```

Greetz

Shad

----------

## donesteban

Hi all,

no one of the mentioned solutions do work for me. I seem everybody finds a something strange solution (I do not understand what /etc/host has to do with the domainname settings of a linux system) but for me nothing works.

Could it be the DHCP-Server? The /etc/resolv.conf looks fine after the modifications from Shadows. Like this:

domain my.domain

nameserver router-ip-address

search my.domain

But the domainname comand still shows (none)

This thing drives me nuts. I double checked alle entries and followed the hints in alle threads in the forum. Nix.

I would be happy about any help.

Thanks

Stefan

----------

## Shadows

I don't know why, but my networking got fucked up again after doing a few changes to my system, too, and even this issue here occured again.

I'm not sure, if it was:

- the change from kernel 2.6.7-r8 -> 2.6.7-r11 (both gen-dev-sources), or

- the change from linux-headers-2.6.7-r? -> linux26-headers-2.6.7-r3 in combination with recompiling glibc, gcc and the kernel

But I think, it has something to do with one of these. I have ~x86 and nptl activated. After changing kernel / headers, recompiling glibc / gcc / kernel many times and finally doing a world-update, things got messed up. Not only the unknown_domain-thing, but another strange behaviour occured:

After logging in with my display manager, it takes a few seconds / minutes, till I can resolve names. Usually, when I quit my KDE-Session, I leave with a bunch of Konqueror windows open with at least 10 tabs each. And when logging in again, everything will be restored and all the pages reloaded into the Konqueror windows / tabs. Now, I can't resolve the dns-names, so every page-request on startup results in an error, i.e.:

```
The process for the http://forums.gentoo.org protocol died unexpectedly.
```

Then I have to wait a few seconds, and when I try to load the page again, it just works.

Well, maybe, this has nothing to do with the unknown_domain-thing, but I'm curious if you'll experience the same strange behaviour.

At the moment, the unkown_domain-thing has no priority to me, so I didn't try to lock down the error yet. Maybe, you should downgrade your kernel to something around r8 or lower, and if it's still broken try a downgrade of your linux-headers to a 2.6.6 version (and recompile at least your glibc).

Good luck

Greetz

Shad

----------

## donesteban

Hello again,

I did find my own realy stupid mistake. I guess it was that stupid, that not even double-checking helped. Somehow I managed creating a "host" file instead of using the "hosts" file. Than using the command history and...

Sorry and thanks for the help anyway.

Stefan

----------

## madhat

Go to http://gentoo-wiki.com/FAQ_Setting_up_your_FQDN it worked for both of my computers.

Hope this helps

----------

## JeliJami

wow madhat,

checking old threads that don't have [solved] in the subject, are you?   :Wink: 

----------

