# Host name: "unknown_domain" again! [INVALID]

## VinzC

Hi.

I've just upgraded a couple of system packages (OpenRC 0.3.0-r1 and dhcpcd 4.0.2). The fully qualified domain name is again not set: when local starts and the logon prompt appears I see "solo.unknown_domain" instead. Before, I had dhcpcd 3.2.3 and OpenRC 0.2.5 and that problem did not occur.

Note I don't know if this relates to dhcpcd or OpenRC. Here's the reason.

The company I'm working at is located in two countries, Belgium and Luxemburg hence there are two domains: lu.company.local and be.company.local. When my laptop boots, dhcpcd correctly updates /etc/resolv.conf:

```
# Generated by resolvconf(8)

search lu.company.local

nameserver 10.11.4.15

nameserver 10.10.4.21

nameserver 10.10.4.20
```

But then my laptop's fully qualified domain name is unknown:

```
hostname: Unknown host.
```

```
solo
```

If I change the search line as follows in /etc/resolv.conf:

```
# Generated by resolvconf( 8 )

search company.local

...
```

then

```
company.local
```

```
solo
```

Looks like the domain name component cannot have more than 2 parts  :Shocked:  . I'm puzzled. Is the bug in baselayout or OpenRC?

----------

## z3rgl1ng_z

Take a look at this:

```
http://www.gentoo.org/doc/en/openrc-migration.xml
```

----------

## UberLord

Did you emerge dhcpcd with the compat USE flag?

Does /etc/dhcpcd.duid exist?

----------

## bunder

 *Quote:*   

> chris@shell ~ $ hostname
> 
> shell
> 
> chris@shell ~ $ hostname -d
> ...

 

using a normal stable portage configuration (no openrc, no baselayout-2, etc)

not sure if this helps at all.   :Embarassed: 

cheers

----------

## z3rgl1ng_z

"normal" will be deprecated soon imho  :Smile: 

Normal that is old versions of baselayout loads gentoo a lot slower.

----------

## bunder

 *z3rgl1ng_z wrote:*   

> "normal" will be deprecated soon imho 
> 
> Normal that is old versions of baselayout loads gentoo a lot slower.

 

when it happens, it happens.   :Wink: 

----------

## VinzC

 *UberLord wrote:*   

> Did you emerge dhcpcd with the compat USE flag?

 

I did but then my laptop couldn't get its reserved IP address from our Windows 2003 DHCP server. It got an IP address from the DHCP range instead. I couldn't figure out what command line option to specify. So I emerged dhcpcd without compat USE flag and my laptop now gets its reserved IP address as expected. Curiously enough, I had to emerge dhcpcd-3.* with compat USE flag set to get my reserved IP address.

 *UberLord wrote:*   

> Does /etc/dhcpcd.duid exist?

 

Yup!

----------

## VinzC

Update

Now I'm back to Belgium where domain name is company.local and I still get the "unknown_domain" message...  :Shocked: 

```
# Generated by resolvconf(8)

search company.local

nameserver 10.10.4.21

nameserver 10.10.4.20
```

```
hostname: Unknown host.
```

```
solo
```

Wth??

----------

## VinzC

 *z3rgl1ng_z wrote:*   

> Take a look at this:
> 
> ```
> http://www.gentoo.org/doc/en/openrc-migration.xml
> ```
> ...

 

I had already migrated to OpenRC.

----------

## z3rgl1ng_z

Can you post the content of /etc/hosts  ?

I think here is your problem.

----------

## UberLord

 *VinzC wrote:*   

>  *UberLord wrote:*   Did you emerge dhcpcd with the compat USE flag? 
> 
> I did but then my laptop couldn't get its reserved IP address from our Windows 2003 DHCP server. It got an IP address from the DHCP range instead. I couldn't figure out what command line option to specify. So I emerged dhcpcd without compat USE flag and my laptop now gets its reserved IP address as expected. Curiously enough, I had to emerge dhcpcd-3.* with compat USE flag set to get my reserved IP address.
> 
>  *UberLord wrote:*   Does /etc/dhcpcd.duid exist? 
> ...

 

Try enabling duid in /etc/dhcpcd.conf

man dhcpcd.conf for details

----------

## VinzC

 *UberLord wrote:*   

> Try enabling duid in /etc/dhcpcd.conf
> 
> man dhcpcd.conf for details

 

When I enable duid, I don't get my reserved IP but one from the standard range instead. But then my laptop has its domain name set! Huh? As a dirty trick, I enabled DUID, killed dhcpcd, ran it again, disabled DUID, killed dhcpcd again then ran it once more. Domain name is kept...  :Laughing: 

Note in Belgium (where I currently am) DHCP is Windows 2000. In Luxembourg it's a Windows 2003.

----------

## UberLord

OK, you need to release the DHCP lease with the duid (start dhcpcd with duid enabled then issue dhcpcd -k eth0). This in turn will release the DNS name associated with the IP.

Then disable duid and start dhcpcd again - it should register correctly in DNS with the IP you want.

----------

## VinzC

 *UberLord wrote:*   

> OK, you need to release the DHCP lease with the duid (start dhcpcd with duid enabled then issue dhcpcd -k eth0). This in turn will release the DNS name associated with the IP.
> 
> Then disable duid and start dhcpcd again - it should register correctly in DNS with the IP you want.

 

I've done that but my laptop still doesn't get its reserved IP but one of the pool. Does the DUID have something to do with the reservations? Should I indicate the DUID as the reservation name?

FYI reservations with Windows DHCP, besides the MAC address of the host, require a reservation name, which we usually filled with <hostname>.company.local, without knowing if it was good or bad. Fact is it always worked and even with Linux hosts... until Gentoo came with dhcpcd-4* on my laptop.

----------

## UberLord

 *VinzC wrote:*   

>  *UberLord wrote:*   OK, you need to release the DHCP lease with the duid (start dhcpcd with duid enabled then issue dhcpcd -k eth0). This in turn will release the DNS name associated with the IP.
> 
> Then disable duid and start dhcpcd again - it should register correctly in DNS with the IP you want. 
> 
> I've done that but my laptop still doesn't get its reserved IP but one of the pool. Does the DUID have something to do with the reservations? Should I indicate the DUID as the reservation name?

 

OK, every DHCP host+interface is identified by the ClientID.

dhcpcd-3 uses a DUID + if_index by default

dhcpcd-4 uses the interface MAC address by default

You said you aren't using the compat USE flag, so the above is true.

So, you have registered in DNS an IP address with the hostname and in DHCP the ClientID with the IP address.

The DNS server won't update the DNS record unless the old one is released first - i think this is what is happening.

 *Quote:*   

> 
> 
> FYI reservations with Windows DHCP, besides the MAC address of the host, require a reservation name, which we usually filled with <hostname>.company.local, without knowing if it was good or bad. Fact is it always worked and even with Linux hosts... until Gentoo came with dhcpcd-4* on my laptop.

 

DHCP reservation is purely done via ClientID as described above.

You could reserve by more options, but that depends purely on the DHCP server setup and not the client.

----------

## VinzC

So if I get "Unknown host" when I type hostname -d, this is only because the DHCP did not update the DNS record dynamically, have I understood? Hence I should set option fqdns both, am I right?

----------

## VinzC

But wait a minute...

 *UberLord wrote:*   

> So, you have registered in DNS an IP address with the hostname and in DHCP the ClientID with the IP address.
> 
> The DNS server won't update the DNS record unless the old one is released first - i think this is what is happening.

 

In fact, no, this is not what's happening, IMHO.

I made a reservation in our Windows DHCP server for my laptop's wireless interface, IP 10.10.2.222. If I run dhcpcd with option duid set, I get 10.10.1.17 instead (for instance). Meanwhile my DNS domain name is set. If I comment out duid option I get my reserved IP address, 10.10.1.222 but my host domain name is not set. So there are two problems here.

EDIT: And the DHCP server is configured to dynamically update the DNS (which is on the same Windows host).

----------

## UberLord

 *VinzC wrote:*   

> So if I get "Unknown host" when I type hostname -d, this is only because the DHCP did not update the DNS record dynamically, have I understood?

 

Almost right.

hostname -d just looks up the FQDN of the machine in DNS and then removes the hostname part.

Nothing to do directly with DHCP, but DHCP can obviosuly affect the result.

 *Quote:*   

>  Hence I should set option fqdns both, am I right?

 

Yes.

Infact a lot of badly configured Windows DHCP servers require the FQDN option to be set whereas they could work just off the hostname dhcpcd sends.

----------

## UberLord

 *VinzC wrote:*   

> I made a reservation in our Windows DHCP server for my laptop's wireless interface, IP 10.10.2.222. If I run dhcpcd with option duid set, I get 10.10.1.17 instead (for instance). Meanwhile my DNS domain name is set. If I comment out duid option I get my reserved IP address, 10.10.1.222 but my host domain name is not set. So there are two problems here.
> 
> EDIT: And the DHCP server is configured to dynamically update the DNS (which is on the same Windows host).

 

OK, disable duid and manually remove all leases your laptop has in the DHCP and DNS servers and try again.

As you can make the reservation, you should be able to do this.

----------

## VinzC

Ok, I disabled duid, removed all my leases and DNS entries (deleting my leases also deleted my reservations so I had to restore them) and reran dhcpcd; the problem still persists. Downgrading to version 3* with vram USE flag set does work however (USE flag compat is forced disabled by portage).

----------

## UberLord

OK, could you open a ticket at http://roy.marples.name/projects/dhcpcd/newticket

And attach a wireshark trace of dhcpcd-3 working and dhcpcd-4 failing please.

----------

## VinzC

It's even worse than that: now at home my laptop doesn't even get an IP anymore with version 3.2.3  :Shocked:  ! On the server dnsmasq spews out lines like this:

```
Oct 19 12:19:07 athena dnsmasq[14150]: DHCPDISCOVER(br0) 00:1b:77:23:a0:48

Oct 19 12:19:07 athena dnsmasq[14150]: DHCPOFFER(br0) 192.168.45.109 00:1b:77:23:a0:48

Oct 19 12:19:23 athena dnsmasq[14150]: DHCPDISCOVER(br0) 00:1b:77:23:a0:48

Oct 19 12:19:23 athena dnsmasq[14150]: DHCPOFFER(br0) 192.168.45.109 00:1b:77:23:a0:48

Oct 19 12:19:23 athena dnsmasq[14150]: DHCPDISCOVER(br0) 00:1b:77:23:a0:48

Oct 19 12:19:23 athena dnsmasq[14150]: DHCPOFFER(br0) 192.168.45.109 00:1b:77:23:a0:48

Oct 19 12:19:26 athena dnsmasq[14150]: DHCPDISCOVER(br0) 00:1b:77:23:a0:48

Oct 19 12:19:26 athena dnsmasq[14150]: DHCPOFFER(br0) 192.168.45.109 00:1b:77:23:a0:48
```

Trying version 4 again...

----------

## VinzC

Version 4 gives me no IP address either. I plugged a cable into the Ethernet port and *poof* I got an IP address. I downgraded dhcpcd to version 3 again and I got the same IP address.

EDIT: With dnsmasq 2.45 on my home server, dhcpcd 3* and 4* on my laptop *and* using an Ethernet cable everything is Ok, i.e. I get an IP address and my laptop's host and domain names are both set.

Conclusions: only wireless is giving me a hard time now. Don't know if it relates to OpenRC or dhcpcd or whatever  :Sad:  .

----------

## VinzC

Ok, don't ask...

I powered off and on my wireless access point at home, booted my laptop with PC Linux OS and WiFi worked. Back in Gentoo with dhcpcd 3.2.3, it works. Upgraded dhcpcd to 4.0.2, it works too!

Don't ask, I told you...

I'll check it further when I'm back to work tomorrow.

----------

## VinzC

I think I've nailed the error down: I've taken a look at the DHCP server at work and I noticed my hostname is weirdly registered in the reservations. I'm 100% sure I named it solo.company.local and now it appears with a square character in front of the name. The character is actually an <EOT> (ASCII code 4): <EOT>solo.company.local. I don't know if the EOT was transmitted by dhcpcd or if this is a bug in our Windows DHCP server.

I'm almost sure this is the reason why my laptop's got no domain name: the illegal character in the host name was probably rejected by the DNS server, hence my laptop's FQDN is *not* registered in the DNS system. I'm trying to set the host name from the DHCP server.

EDIT: Proof is there...

```
\004solo.company.local. from server 10.10.x.y in 2 ms.
```

which doesn't happen with dhcpcd-3*. I'll file that bug, Roy  :Wink:  .

----------

## VinzC

Culprit found: Microsoft DHCP server.

Till now, the only applicable workaround is to downgrade dhcpcd to version 3* if your Gentoo machine messes around with M$ Windows DHCP servers. Sadly...

----------

