# [SOLVED] DNS Search Suffix list from DHCP Server

## RazielFMX

I am trying to get dhcpcd to respect the DNS search list sent by the DHCP server. Currently, local dns resolution only respects the dnsdomainname on my Gentoo box. However, running an ipconfig /all on my Windows 7 machine lists the full 'DNS Suffix Search List' as it should.

Any ideas how I get this to work short of manually overriding the domain entry in /etc/resolv.conf?Last edited by RazielFMX on Thu Aug 14, 2014 6:45 pm; edited 1 time in total

----------

## UberLord

Uh, the dhcp client needs to ask for it first. The default dhcpcd.conf shipped should. Here is the config entry:

```
# A list of options to request from the DHCP server.

option domain_name_servers, domain_name, domain_search, host_name

option classless_static_routes
```

The key part is domain_search.

You can see what the DHCP server actually sent by doing

```
dhcpcd -U4 eth0
```

----------

## RazielFMX

Awesome.

I do not see the search list coming back even though I am asking for it (but it magically works on Windows). Is there something different that can be requested (or that Windows is doing) to get this list? 

```

# dhcpcd -U4 eno1

broadcast_address=XXX.XXX.XXX.XXX

dhcp_lease_time=691200

dhcp_message_type=5

dhcp_rebinding_time=604800

dhcp_renewal_time=345600

dhcp_server_identifier=XXX.XXX.XXX.XXX

domain_name=this.is.my.domain.com

domain_name_servers='AAA.AAA.AAA.AAA BBB.BBB.BBB.BBB CCC.CCC.CCC.CCC

ip_address=XXX.XXX.XXX.XXX

network_number=XXX.XXX.XXX.XXX

routers=XXX.XXX.XXX.XXX

subnet_cidr=24

subnet_mask=255.255.255.0

```

My dhcpcd.conf:

```
# A sample configuration for dhcpcd.

# See dhcpcd.conf(5) for details.

# Inform the DHCP server of our hostname for DDNS.

hostname

# Use the hardware address of the interface for the Client ID.

#clientid

# or

# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.

duid

# Persist interface configuration when dhcpcd exits.

persistent

# Rapid commit support.

# Safe to enable by default because it requires the equivalent option set

# on the server to actually work.

option rapid_commit

# A list of options to request from the DHCP server.

option domain_name_servers, domain_name, domain_search, host_name

option classless_static_routes

# Most distributions have NTP support.

option ntp_servers

# Respect the network MTU.

# Some interface drivers reset when changing the MTU so disabled by default.

#option interface_mtu

# A ServerID is required by RFC2131.

require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones

slaac private

# A hook script is provided to lookup the hostname if not set by the DHCP

# server, but it should not be run by default.

nohook lookup-hostname

```

----------

## UberLord

Why don't you install wireshark on the windows host, listen to the interface then do

```
ipconfig /renew
```

And inspect the bootp packet to see what options it's sending. Then simply request the same options in dhcpcd.conf - and optionally write a hook script to handle them if the default ones don't. I can help with that.

Otherwise, there must be another mechanism Windows is using for this.

----------

## RazielFMX

Unfortunately wireshark is not an option (corporate controlled windows desktop). Based on MSDN, it looks like Option 119.

Looking through the code for dhcpcd, I find 119 enumerated as DHO_DNSSEARCH, but the only reference I find is in the IPv6 code... which isn't really a reference but rather a compatibility struct

```
~/tmp/dhcpcd-6.4.3 $ find . -type f -exec grep DHO_DNSSEARCH {} /dev/null \;

./dhcp.h:       DHO_DNSSEARCH              = 119, /* RFC 3397 */

./dhcp6.c:      { DHO_DNSSEARCH,        D6_OPTION_DOMAIN_LIST },
```

Unless of course this is handled in the resolve.conf hook, then I'm barking up the wrong tree.

----------

## UberLord

you're already asking for that option  :Smile: 

Put wireshark on your machine to verify.

As you're looking at the source, you can read dhcpcd-definitions.conf for the exact breakdown.

Hint - I don't handle many options directly in the C code.

----------

## RazielFMX

I wasn't sure how to force a renew using dhcpcd, so I did a release and restarted the service.

I see in the request, under option 55 (Paramater Request List), I have 119 (Domain Search). I do not see it in the ACK or the OFFER, so I'm going to have to assume it something specific in the domain controller that allows approved Windows machines access to this information but not other systems.

Thanks for the help, this has been a fun learning experience!

----------

## UberLord

 *RazielFMX wrote:*   

> I wasn't sure how to force a renew using dhcpcd

 

```
dhcpcd -n $interface

# or for all interfaces

dhcpcd -n
```

 *Quote:*   

> 
> 
> , so I did a release and restarted the service.
> 
> I see in the request, under option 55 (Paramater Request List), I have 119 (Domain Search). I do not see it in the ACK or the OFFER, so I'm going to have to assume it something specific in the domain controller that allows approved Windows machines access to this information but not other systems.
> ...

 

No problem!

If you install openresolv, you have options to add a custom search list if needed.

----------

