Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] DNS Search Suffix list from DHCP Server
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
RazielFMX
l33t
l33t


Joined: 23 Apr 2005
Posts: 835
Location: NY, USA

PostPosted: Wed Aug 13, 2014 2:10 pm    Post subject: [SOLVED] DNS Search Suffix list from DHCP Server Reply with quote

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
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Thu Aug 14, 2014 11:34 am    Post subject: Reply with quote

Uh, the dhcp client needs to ask for it first. The default dhcpcd.conf shipped should. Here is the config entry:
Code:
# 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
Code:
dhcpcd -U4 eth0

_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
RazielFMX
l33t
l33t


Joined: 23 Apr 2005
Posts: 835
Location: NY, USA

PostPosted: Thu Aug 14, 2014 2:02 pm    Post subject: Reply with quote

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?

Code:

# 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:

Code:
# 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
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Thu Aug 14, 2014 2:11 pm    Post subject: Reply with quote

Why don't you install wireshark on the windows host, listen to the interface then do
Code:
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.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
RazielFMX
l33t
l33t


Joined: 23 Apr 2005
Posts: 835
Location: NY, USA

PostPosted: Thu Aug 14, 2014 2:37 pm    Post subject: Reply with quote

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

Code:
~/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.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Thu Aug 14, 2014 2:43 pm    Post subject: Reply with quote

you're already asking for that option :)

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.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
RazielFMX
l33t
l33t


Joined: 23 Apr 2005
Posts: 835
Location: NY, USA

PostPosted: Thu Aug 14, 2014 5:36 pm    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6737
Location: Blighty

PostPosted: Thu Aug 14, 2014 5:59 pm    Post subject: Reply with quote

RazielFMX wrote:
I wasn't sure how to force a renew using dhcpcd


Code:
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.

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


No problem!
If you install openresolv, you have options to add a custom search list if needed.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum