Get DNS server from DHCP options without lease

2

I'm configuring dnsmasq, and need to know the IPs for the upstream nameservers. The DHCP server does set them via option 6 for DHCP clients, but the dnsmasq server does not use this DHCP server.

Is there a way that I can programmatically query the DHCP server for the list of DNS servers it would set? Right now I'm trying to craft a raw packet for use with netcat/socat, but this seems like something the DHCP client could do, if I could find the right set of parameters. The dnsmasq server is running Amazon Linux 4.9.51-10.52.amzn1.x86_64 with dhclient 'Internet Systems Consortium DHCP Client 4.1.1-P1'.

Josh Cooley

Posted 2018-03-26T19:47:57.157

Reputation: 87

It's 6 years old, but perhaps something like this ?

– Timmy Browne – 2018-04-02T05:46:41.030

Can you add it as an answer? I actually tried this, but the DHCP server is NAKing the requests. – Josh Cooley – 2018-04-02T17:55:43.900

Answers

0

It's 6 years old, but perhaps something like this

He forked dhclient and created DHCProbe to request a lease and dump the results.

Timmy Browne

Posted 2018-03-26T19:47:57.157

Reputation: 430