OpenWrt Forum Archive

Topic: Adding a dnsserver to DNSMASQ

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

hi,

It is not specially OpenWrt related however, I will take a shot wink

I have a OpenWrt router with a few hosts with a fixed DHCP reservations.
Other hosts have a dynamic reservation.

The fixed ones may use a VPN tunnel. So for those hostst I want to have
a different dnsserver then for the dynamic ones.

I tried in /etc/config/dhcp.conf:
config 'host'
     option 'dnsserver' 'x.x.x.x'

But that did not work.

Any ideas?

I don't think that will work.

You said that these machines have fixed IPs, therefor they will not use the DHCP server to assign an ip address or DNS servers.

In windows when you set the IP address of an machine with a fixed ip, you also are supposed to set the address of the primary and optional the secondary DNS. I am not sure if this is true with other OPSYS.

You might be able to achieve both by using the static lease option, this way the machines should get the same IP every time while being serviced by the DHCP server. I would set up using the MAC addresses of the machines as this is least likely to change.

I have not tried this myself so take the advice and use with caution. If you experiment please let us know how it went.

wvdakker wrote:

hi,

It is not specially OpenWrt related however, I will take a shot wink

I have a OpenWrt router with a few hosts with a fixed DHCP reservations.
Other hosts have a dynamic reservation.

The fixed ones may use a VPN tunnel. So for those hostst I want to have
a different dnsserver then for the dynamic ones.

I tried in /etc/config/dhcp.conf:
config 'host'
     option 'dnsserver' 'x.x.x.x'

But that did not work.

Any ideas?

Have wanted to do this (multiple dns server (instances)) too.

It should be doable, though a bit hackish, to make an startup script or init entry, which calls dnsmasq using its command line options. As far as I know, whatever can be done in the dnsmasq OpenWrt config can be done on the command line (and I think more!).

It would be awesome to have this supported out of the box/natively, though. OpenWrt is *almost* there when it comes to multiple networks...

(Last edited by hhm1 on 7 May 2013, 12:57)

Not sure if I'm following you here, but would it be possible to segment the hosts into different networks and use different DNS servers per-network?  I'm not sure how the VPN comes into it though.

OpenWrt already supports that properly, see the example below.

config host
    option name 'j400'
    option mac '00:21:63:75:aa:17'
    option ip '10.11.12.14'
    option tag 'vpn'  # assign tag "vpn" to this host

config tag 'vpn'  # match tag "vpn"
    list dhcp_option '6,8.8.8.8,8.8.4.4'  # assign arbritary extra dhcp options to this tag
jow wrote:

OpenWrt already supports that properly, see the example below.

finally I've found this post, now it works, thanks !

the example from wiki http://wiki.openwrt.org/doc/uci/dhcp#cl … l.options1 is not working for me.
Who should be asked to add this to wiki?

I've added the information to wiki by myself, didn't know that anybody can edit it without any approval.

jow wrote:

OpenWrt already supports that properly, see the example below.

config host
    option name 'j400'
    option mac '00:21:63:75:aa:17'
    option ip '10.11.12.14'
    option tag 'vpn'  # assign tag "vpn" to this host

config tag 'vpn'  # match tag "vpn"
    list dhcp_option '6,8.8.8.8,8.8.4.4'  # assign arbritary extra dhcp options to this tag

would I use this type of config to make a specific computer to only use those DNS servers?

Here's what I'd like to do:
I have OpenDNS configured by default for my entire network on my router.
I'd like to have my windows computer to NOT use the OpenDNS servers and ONLY use the Google DNS servers.
My computer already has a static dhcp lease

Thanks

The discussion might have continued from here.