# [solved] no domain or search in resolv.conf

## musv

Hi there, 

since the last update of my systems the domain or search entry in /etc/resolv.conf has been gone. I'm using systemd-networkd and systemd-resolved on the client sides and isc-dhcp on my NAS.

Some configs

On my clients:

```
[Match]

Name=eth0

[Network]

DHCP=ipv4

LinkLocalAddressing=no

[DHCP]

UseDomains=true
```

```
lrwxrwxrwx 1 root root 32  6. Nov 2016  /etc/resolv.conf -> /run/systemd/resolve/resolv.conf
```

systemd-networkd and systemd-resolved are started and running. 

On my server:

```
authoritative;

allow booting;

allow bootp;

# Options for all networks

option domain-name "blechnet.de";

option domain-search "blechnet.de";

option domain-name-servers 192.168.109.11, 192.168.109.1;

option routers 192.168.109.1;

option subnet-mask 255.255.255.0;

option broadcast-address 192.168.109.255;

option ntp-servers 192.168.109.1;

option architecture code 93 = unsigned integer 16;

default-lease-time 604800;

max-lease-time 1209600;

ddns-update-style none;

…

```

And the result is:

```
nameserver 192.168.109.11

nameserver 192.168.109.1
```

The domain or search entry is missing. Where's my mistake? Any ideas?Last edited by musv on Wed May 15, 2019 3:48 pm; edited 1 time in total

----------

## musv

Did some investigation with wireshark:

It seems none of my devices (mobile phones, computers) requests the search domain: 

My Oneplus 3 (Android):

```
Option: (55) Parameter Request List

Length: 10

Parameter Request List Item: (1) Subnet Mask

Parameter Request List Item: (3) Router

Parameter Request List Item: (6) Domain Name Server

Parameter Request List Item: (15) Domain Name

Parameter Request List Item: (26) Interface MTU

Parameter Request List Item: (28) Broadcast Address

Parameter Request List Item: (51) IP Address Lease Time

Parameter Request List Item: (58) Renewal Time Value

Parameter Request List Item: (59) Rebinding Time Value

Parameter Request List Item: (43) Vendor-Specific Information

```

My Desktop Machine with Gentoo: 

```
Option: (55) Parameter Request List

Length: 8

Parameter Request List Item: (1) Subnet Mask

Parameter Request List Item: (3) Router

Parameter Request List Item: (12) Host Name

Parameter Request List Item: (15) Domain Name

Parameter Request List Item: (6) Domain Name Server

Parameter Request List Item: (33) Static Route

Parameter Request List Item: (121) Classless Static Route

Parameter Request List Item: (42) Network Time Protocol Servers
```

But instead the "obsolete" domain is requested by all devices. 

If I look into:

```

# This is private data. Do not parse.

ADDRESS=192.168.109.20

NETMASK=255.255.255.0

ROUTER=192.168.109.1

SERVER_ADDRESS=192.168.109.11

NEXT_SERVER=192.168.109.11

T1=302400

T2=529200

LIFETIME=604800

DNS=192.168.109.11 192.168.109.1

NTP=192.168.109.1

DOMAINNAME=blechnet.de

HOSTNAME=hexe

CLIENTID=ff24721ac800020000ab119d8b2240c8dbf6d0
```

Except the missing search entry everything seems to be ok. DOMAINNAME is present and filled with the correct value. 

But it isn't written to the resolv.conf

```
# This file is managed by man:systemd-resolved(8). Do not edit.

#

# This is a dynamic resolv.conf file for connecting local clients directly to

# all known uplink DNS servers. This file lists all configured search domains.

#

# Third party programs must not access this file directly, but only through the

# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,

# replace this symlink by a static file or a different symlink.

#

# See man:systemd-resolved.service(8) for details about the supported modes of

# operation for /etc/resolv.conf.

nameserver 192.168.109.11

nameserver 192.168.109.1
```

I didn't setup any configs in /etc/sytemd/resolved/. This directory doesn't even exist on my machine.

So there are 2 problems: 

My DHCP-Server (dhcp) doesn't seem to offer the search entry generally.

My client requests at least the domain name (15), stores it to the leases file, but doesn't write it to the resolv.conf file for some reason. 

Something seems to be really broken. Or I'm to stupid to read the documentation.

----------

## mike155

Are you affected by this bug: https://github.com/systemd/systemd/issues/8174?

Does the workaround shown in the bug report help?

----------

## musv

Thanks for the hint. Helped to understand at least on more step.

I found this bug report already, but didn't respect it in a appropriate manner. 

 *1. wrote:*   

> I'm using dnsmasq as the DHCP server. If I use dhcp-option-force=option:domain-search,example.com on the server, then DOMAIN_SEARCH_LIST=example.com appears in /run/systemd/netif/leases/2 client lease info. If I use dhcp-option=option:domain-search,example.com, then the lease info file does not contain a DOMAIN_SEARCH_LIST entry (the client did not request this option).

 

I would expect to dhcpd at least offers the domain search list (119). But in Wireshark, there wasn't such an entry. Only the domain name has been offered and requested. 

But then I called:

```
●        State: routable

       Address: 192.168.109.20 on eth0

       Gateway: 192.168.109.1

           DNS: 192.168.109.11

                192.168.109.1

Search Domains: blechnet.de

           NTP: 192.168.109.1
```

And here it is. The search domain is listed. But I did another check and configured a different domain to the domain-search option in dhcpd.conf. It's ignored.

 *2. wrote:*   

> Setting the UseDomains=true network configuration option adds both the domain and the domain-search values to "Search Domains" as reported by networkctl status and "DNS Domain" as reported by systemd-resolve --status and conversely no such search domains are setup when UseDomains is not set (or false).

 

This is an interesting point. If I deactivate UseDomains=true in /etc/systemd/network/eth0.network::DHCP I get

```
●        State: routable

       Address: 192.168.109.20 on eth0

       Gateway: 192.168.109.1

           DNS: 192.168.109.11

                192.168.109.1

           NTP: 192.168.109.1
```

The Search Domain has been removed.

To sum up

The DHCP server doesn't offer domain-search (119) entry to the requesting clients. Only the domain-name (15) is provided.

systemd-resolved receives the domain-name, but doesn't write it to /run/systemd/resolve/resolv.conf.

netctrl status displays the domain-name as Search Domains.

Something seems to be really screwd up in that system.

----------

## mike155

 *musv wrote:*   

> The DHCP server doesn't offer domain-search (119) entry to the requesting clients. Only the domain-name (15) is provided.
> 
> 

 

A DHCP server usually only sends options which were explicitly requested by the client. Do your DHCP clients ask for option 119 (look at Wireshark)?

----------

## UberLord

Test using a dhcp client that actually works maybe?

```
# grep domain /etc/dhcpcd.conf

option domain_name_servers, domain_name, domain_search, host_name

# dhcpcd -qT4 xennet0 | grep domain

new_domain_name=marples.name

new_domain_name_servers=10.73.0.1

new_domain_search='marples.name foo.bar'

old_domain_name=marples.name

old_domain_name_servers=10.73.0.1

old_domain_search='marples.name foo.bar'

```

----------

## musv

https://github.com/systemd/systemd/issues/12531

After applying the patch the search entry in resolv.conf has been created. But the domain entry is missing.

Maybe the gyus from Systemd don't see any reason to test their commits.

----------

