# problem with DHCP & unknown_domain [solved]

## oli_f

Ok, I'm aware that there have been lots of posts on such a topic and I've browsed through many of them. But either the discussion doesn't apply to my situation or I just plainly don't understand it as my network-knowledge is somewhat limited.

My issue is the following: My PC is connected to a ethernet broadband router (IP 192.168.0.1) which provides DHCP. At startup the machine correctly receives an IP (e.g. 192.168.0.167) and Internet for example works fine, but at login I get "pandora.unknown_domain" (and I think this non existing domain causes trouble with cups?!)

some querys yield:

hostname -> pandora

dnsdomainname -> Unknown host

domainname -> (none)

My config files however read

/etc/conf.d/hostname

```

HOSTNAME="pandora"

```

/etc/conf.d/domainname

```

OVERRIDE=1

DNSDOMAIN="HOMENETWORK"

#NISDOMAIN=""

```

/etc/hosts

```

127.0.0.1      localhost

127.0.0.2      pandora.HOMENETWORK pandora

...

```

(somewhere I found such settings for a dynamically assigned IP...)

domainname is part of the default runlevel, my baselayout is baselayout-1.11.13.

So I'm pretty confused - which settings do I need. What's going wrong?Last edited by oli_f on Fri Aug 19, 2005 9:09 am; edited 1 time in total

----------

## Nil_Spaar

Looks good to me except the /etc/hosts part. I've never before seen 127.0.0.2 used anywhere. I would recommend

```

127.0.0.1       pandora.HOMENETWORK pandora localhost.localdomain localhost

```

instead.

----------

## magic919

DHCPCD does not take the hostname from DHCP by default, so that shouldn't cause it.

You are using the later method of setting hostname and domainname.  You might want to check that the old /etc/hostname /etc/domainname /etc/dnsdomainname files are not there.

----------

## oli_f

As to Nil_Spaar's suggestion, that doesn't do the trick I'm afraid.

The old files such as /etc/hostname are not present on my system - I forgot to mention that in my original post. And by the way there is no file "nsswitch.conf" either, which is mentioned in some other discussions concerning this issue. But as I get it that file is part of the "old style" as well, isn't it?

----------

## oli_f

And one other thing I haven't mentioned so far. Apart from dhcp I also gave static IP-assignment a try making my /etc/hosts look like:

```

127.0.0.1           localhost

192.168.0.167    pandora.HOMENETWORK pandora

```

the result was the same... (pandora.unknown_domain)

----------

## magic919

That's not the way to do the static IP.  It's in  /etc/conf.d/net .

----------

## oli_f

yes, right, I remember... I'll have a look at this in the evening.

But anyway I would prefer getting dhcp to work properly as my next near-future project would be getting linux to run on my laptop. But there I would definitely need dynamically assigned IP addresses...

----------

## the_mgt

In /etc/resolv.conf:

```
nameserver 192.168.0.1

search HOMENETWORK

domain HOMENETWORK
```

Should do the trick, i hope. Its long time ago, i set up my LAN here. I have a DNS server running, so maybe the fact my computers get a domain is related to that. But, then i have my laptop which is in a different subnet due to bluetooth pan, and its in my domain, too. At least according to "dnsdomainname".

----------

## oli_f

Thanks for all your suggestions, but unfortunately it still isn't working.

Editing resolv.conf the way the_mgt proposed doesn't work as resolv.conf is automatically overwritten with

```

nameserver 81.210.131.2

nameserver 81.210.131.8

search HOMENETWORK.foo

domain HOMENETWORK.foo

```

These nameservers are the ones listed in the setup menus of my ethernet router (D-Link DI-604), so this information is passed on correctly. I've also tried configuring my router to treat the PC as a static DHCP client - giving it the same IP all the time. With this I tried setting /etc/hosts, /etc/conf.d/net in serveral ways - static IP, DHCP w/ and w/o "nodns" and so on. Nothing worked....

Furthermore I entered the domainname in the router setup and I tried without a domain name (I just want any to get a FQDN). No success either.

And I have used /etc/hosts configurations as listed on http://gentoo-wiki.com/TIP_Setup_Your_FQDN..

So has anyone some ideas left on where I'm messing things up? Maybe somebody has experience with the same ethernet broadband router I'm using?

----------

## m_sqrd

set your /etc/hosts file up like you had it.

127.0.0.1           localhost

192.168.0.167    pandora.HOMENETWORK pandora 

and make sure your router is set that way too (alwas give you that address or reserve it)

then copy /usr/portage/sys-libs/glibc/files/nsswitch.conf  to /etc/nsswitch.conf 

"with out it you use system defaults  see man nsswitch.conf "

then check that the line shows

 hosts:        files dns

(that should be the default.)

then check your /etc/host.conf line  shows

order  hosts, bind

(that should be the default.)

fix your /etc/resolv.conf 

search HOMENETWORK

domain HOMENETWORK

nameserver 81.210.131.2

nameserver 81.210.131.8 

then edit your /etc/conf.d/net 

(and make your address static.)  or tell it not to overwrite your resovl.conf with "nodns"  option.

then after that all fixed do a hostname -vf

----------

## oli_f

Thank you so much - it works now!

Just one thing, there was no /etc/host.conf on my system. I found a file of that name in /usr/portage/sys-libs/glibc/files/2.3.4/host.conf and copied it over to /etc/. The desired line "order hosts, bind" is present but additionally there is other stuff such as "mdns off" and my system complains

```

/etc/host.conf: line 24: bad command 'mdns off'

```

But it seems as it is working without that host.conf file altogether! Maybe that's obsolete??

And btw my resolv.conf get overwritten despite a static IP configuration in /etc/conf.d/net and becomes

```

nameserver 81.210.131.2

nameserver 81.210.131.8

search

domain HOMENETWORK

```

So finally it looks as if only the nsswitch.conf makes the difference! I really think that should be mentioned in the documentation somewhere (at least I haven't found a word on it), as this kind of problems are probably not that unusual.

----------

