OpenWrt Forum Archive

Topic: which nameservers am I using?

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

Hi, how can I know which nameservers am I using?
This is not very helpful:

root@wr841n:~# cat /etc/resolv.conf
search lan
nameserver 127.0.0.1

Does this really replace dns servers provided by my ISP by dhcp, or does it add specified one as another?

config interface 'wan'
        option ifname 'eth0'
        option proto 'dhcp'
        option dns '88.86.108.7'

Thanks..

(Last edited by nozombian on 31 Dec 2013, 19:05)

the nameserver in /etc/resolv.conf defines the dns server used by the sytem and it points to 127.0.0.1
on 127.0.0.1 runs dnsmasq and that is used to resolve the request.

by default dnsmasq uses the file /tmp/resolv.conf.auto this file also gets updated by the dhcp client and would contain the dns servers gotten via dhcp from the provider.
The file used by dnsmasq for the lookup can be changed under /etc/config/dhcp

The option dns would get written to /tmp/resolv.conf.auto that is defined under /etc/config/network under an inteface.
However it gets appended to the dns settings it gets trough dhcp

So you are better of creating a new resolv file, /etc/resolv.conf.manual for example and change the setting in /etc/config/dhcp . via the uci command: uci set dhcp.@dnsmasq[0].resolvfile='/etc/resolv.conf.manual'; uci commit dhcp
Or you could of course edit the file as well

(Last edited by FriedZombie on 31 Dec 2013, 20:14)

Or simply set "option peerdns 0" to suppress the dhcp dns servers.

Thank you, but where is the info about currently used dns servers stored? On windows, there's ipconfig /all, what about in openwrt? Into which config file/section does that option peerdns belong?

What I'm trying to achieve is to use openwrt as dns server, but openwrt should reject isp dns server (option peerdns seems nice) and use opennic servers (without logging) and yet filter out ads using hosts block list for the network.

Btw. some time ago I have seen online tool, which printed out, from which dns server(s) came the request and if is the dns is hijacked by isp. Don't you know th link?

Thanks and happy NY wink

nozombian wrote:

Thank you, but where is the info about currently used dns servers stored? On windows, there's ipconfig /all, what about in openwrt? Into which config file/section does that option peerdns belong?

How about using ubus:

ubus call network.interface.wan status

written_direcon wrote:

ubus call network.interface.wan status

Nice, thank you.

And into which config file/section does that option peerdns belong?

nozombian wrote:

And into which config file/section does that option peerdns belong?

It goes into the file: /etc/config/network

config interface 'wan'
        option ifname 'eth0'
        option proto 'dhcp'
        option dns '88.86.108.7'
        option peerdns 0

Seems I have missed the info about peerdns tongue , but it is right in the wiki

(Last edited by FriedZombie on 2 Jan 2014, 14:24)

The discussion might have continued from here.