OpenWrt Forum Archive

Topic: Change default DNS server for one DHCP client

The content of this topic has been archived on 29 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm using openwrt for a while and l'm loving it. Just today I needed to do some DNS testing and changed the systems dns server (from 8.8.8.8 to custom dns). For one of the clients it's not the solution, so I for this system we need to change the used DNS server. The client uses DHCP, so I made a reservation in the GUI, works fine.

using vi I have been modifying the /etc/config/dhcp file, but none of the modifications change's the used DNS server to what I'm putting in the /etc/config/dhcp file. What is the correct option to change the used DNS server just for this one client with dhcp static lease ?

Have you tried in your host section:

list 'dhcp_option' '6,8.8.4.4'

and then

/etc/init.d/dnsmasq reload (or reboot router)

(Last edited by WWTK on 29 Oct 2017, 18:23)

Yes, but this doesn't do the job, I've tried the following options

option 'dhcp_option' '6,8.8.4.4'
list 'dhcp_option' '6,8.8.4.4'
option dhcp_option '6,8.8.4.4'

Non of them are successful, is there any documentation about the options of the dhcp service in Openwrt ?

boumacor wrote:

Yes, but this doesn't do the job, I've tried the following options

option 'dhcp_option' '6,8.8.4.4'
list 'dhcp_option' '6,8.8.4.4'
option dhcp_option '6,8.8.4.4'

Non of them are successful, is there any documentation about the options of the dhcp service in Openwrt ?

yes, but i'm guessing you read this already...

https://wiki.openwrt.org/doc/uci/dhcp

http://www.networksorcery.com/enp/proto … ptions.htm

(Last edited by WWTK on 4 Nov 2017, 00:26)

option dns in static lease stanza?

I'm also not sure what options aren't there in the stripped down dnsmasq.....   You may need a build with dnsmasq-full

something like this may also work (or not LOL)

# Assign alternate DNS for select hosts
# Set Specific Clients to be affected
dhcp-mac=set:altdns,XX:XX:XX:XX:XX:XX #PC 1
dhcp-mac=set:altdns,YY:YY:YY:YY:YY:YY #PC 2

# Set Alternate DNS
dhcp-option=tag:altdns,option:dns-server,208.122.23.22,208.122.23.23

The discussion might have continued from here.