# [SOLVED] dhclient doesn't set domain-name

## Whissi

Hi,

I have network with an own domain name (intern.example.org for example).

A Debian system is running a dhcpd (isc-dhcpd-4.1.1-P1) and a DNSd.

Everything is working fine:

Other clients (Windows, Debian and Ubunt systems) will get the network configuration by the DHCP. Every client will set the domain-name option for example correctly.

Now I added my first Gentoo system to my network. It's running dhclient (isc-dhclient-V3.1.2p1-Gentoo).

The problem is, that dhclient does not set the domain. For example, after dhclient received the configuration from the dhcpd, my "/etc/resolv.conf" looks like

```
gentoo ~ # cat /etc/resolv.conf

# Generated by dhclient for interface eth0

search intern.example.org

nameserver 192.168.1.2
```

but I expected

```
domain intern.example.org

search intern.example.org

nameserver 192.168.1.2
```

I captured the DHCP request and ACK, I can see that dhclient is requesting the domain-name as configured, and also receiving the domain-name... but it isn't set.

Here are some configuration files:

```
gentoo ~ # cat /etc/conf.d/net

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

config_eth0=( "dhcp" )

module_eth0=( "dhclient" )
```

```
gentoo ~ # cat /etc/dhcp/dhclient.conf

send host-name "gentoo";

request subnet-mask, broadcast-address, time-offset, routers,

        domain-name, domain-name-servers, domain-search, host-name,

        netbios-name-servers, netbios-scope, interface-mtu,

        ntp-servers;
```

----------

## tony-curtis

"search" does the same thing as "domain" here, however search lets you list out multiple names, whereas domain is just a single value.

There's a man page for resolv.conf(5) that shows how this process works.

----------

## Whissi

 *tony-curtis wrote:*   

> "search" does the same thing as "domain" here, however search lets you list out multiple names, whereas domain is just a single value.
> 
> There's a man page for resolv.conf(5) that shows how this process works.

 

No, it doesn't the same thing here: Without "domain",

```
hostname -f
```

won't work for example.

You need both. And remember, Debian and Ubuntu will set both values like expected.

----------

## tony-curtis

Oh, well my brain apparently failed today.  I've never actually encountered that problem (in over 20 years   :Surprised:  )

----------

## Veldrin

check if you have your hostname (without domainname) listed in /etc/hosts.

If you remove it, hostname -f should work again.

cheers

V.

----------

## cwr

I've had a similar problem with a missing local domain name, where the answer was to use eg:

  xxx.xxx.xxx.xxx localhost.localdomain localhost

and not

  xxx.xxx.xxx.xxx localhost localdomain.localdomain

in /etc/hosts.

I can't imagine why this would make a difference, but apparently it does.  It might work

for DHCP as well.

Will

----------

## Whissi

Hi,

 *Veldrin wrote:*   

> check if you have your hostname (without domainname) listed in /etc/hosts.
> 
> If you remove it, hostname -f should work again.

 

Yes, the hostname without the domain-name was listed in the hosts file.

I removed it and hostname -f is now working as expected.

Thank you!

----------

