[SOLVED] How to specify dns server for a particular host? dnsmasq

Hello. First of all, sorry for bad english.

I am trying to setup dhcp server dnsmasq for setting a diferent dns server ip to a particular host, but I don't achieve it, because I don't know how to write that option in the file /etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.auto'
        option nonwildcard '1'
        option localservice '1'
        list server ''

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option leasetime '12h'
        option limit '10'
        list dhcp-range=set:VIRTUAL,,

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config host
        option name 'VIRTUAL'
        option dns '1'
        option mac '08:00:27:82:0D:B9'
        option tag 'VIRTUAL'
        option ip ''

config tag 'VIRTUAL'
        option dns-server ''

Any idea of what am doing wrong or how to write it? thank you

1 Like

Assign different DHCP options to multiple hosts.
Your syntax is wrong, you need to use dhcp option.

Can you please provide a snippet for syntax example? thank you.

uci set dhcp.VIRTUAL.dhcp_option="6,,"
uci commit dhcp
service dnsmasq restart
1 Like
root@OpenWrt:~# uci set dhcp.VIRTUAL.dhcp_option="6,,"
uci: Invalid argument

I am using dnsmasq-full

This has worked for me:

root@OpenWrt:~# uci set dhcp.@host[0].dhcp_option='6,,'
root@OpenWrt:~# uci commit
root@OpenWrt:~# service dnsmasq restart
Warning: the 'option dhcp_option' syntax is deprecated, use 'list dhcp_option'
udhcpc: started, v1.28.4
udhcpc: sending discover
udhcpc: no lease, failing

Is no possible to make this setup in file dhcp ?


config tag 'VIRTUAL'
	option dhcp_option '6,,'

Only thank you very much.
This works !!


1 Like

If your problem is solved, feel free to mark the relevant post as the solution; and edit the title to add "[SOLVED]" to the beginning (click the pencil behind the topic).


1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.