Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[openwrt] Allow configure DNS resolvers without the need of defining interfaces #117

Open
nemesifier opened this issue Sep 30, 2018 · 3 comments

Comments

@nemesifier
Copy link
Member

In OpenWRT, dns settings are configured at interface level, you need to define some interfaces to make this config effective on OpenWRT.

Eg:

{
    "interfaces": [
       { ...something here... }
    ]
    "dns_servers": [
        "8.8.8.8",
        "8.8.4.4"
    ]
}

But this is not very good. There should be a way to make the DNS configuration work also when interfaces are not defined.

@NoumbissiValere
Copy link
Contributor

I have gone through the codebase and found out that the dns converters are defined within the interface converters. so if there is no interface in the netjson config dict the interface converters won't be executed and consequently the dns converter. I think this issue can be fixed by defining the dns converter out of the interface converter but it should still be display under the network package.

NoumbissiValere added a commit to NoumbissiValere/netjsonconfig that referenced this issue Mar 8, 2019
interfaces openwisp#117

Fixed the issue by defining two additional classes (DnsServer and
DnsSearch) in the interfaces
converter. These additional classes are to convert the dns configs when
an interface is not provided in the netjson. when an interface is provided, the default
converters in the Interface class is used to convert the dns to native
config. this was left so because when an interface is defined, other
options like DHCP servers might be available and the Interface class
handles that very well.
Test cases were added to test for these features and also to increase
the coverage.

Fixes openwisp#117
NoumbissiValere added a commit to NoumbissiValere/netjsonconfig that referenced this issue Mar 8, 2019
…openwisp#117

Fixed the issue by defining two additional classes (DnsServer and
DnsSearch) in the interfaces
converter. These additional classes are to convert the dns configs when
an interface is not provided in the netjson. when an interface is provided, the default
converters in the Interface class is used to convert the dns to native
config. this was left so because when an interface is defined, other
options like DHCP servers might be available and the Interface class
handles that very well.
Test cases were added to test for these features and also to increase
the coverage.

Fixes openwisp#117
@NoumbissiValere
Copy link
Contributor

I went through the openwrt documentation and it seems that dns configuration on openwrt can be done only in two places , i.e under the DHCP and DNS and Interface options under Network. under the DHCP and DNS option one can set a DNS forwarding which enables openwrt to send requests to a dns server for a particular domain name. but this is not the functionality raised by the issue. The second option will be to make use of the Interface option.
https://openwrt.org/docs/guide-user/base-system/dns_configuration
https://openwrt.org/docs/guide-user/base system/dns_configuration#enabling_dns_without_enabling_dhcp .
With these, i don't think i have seen a possibility of making the dns settings as stated in the issue available on the openwrt device without using an interface.
Please i will love to be corrected if am wrong so that i correct my mistake and learn.

@Blackyfff
Copy link

As far as I understand, the option to use the Interface is the recommended one.

Setting it in DHCP and DNS is only a setting for the package dnsmasq. If dnsmasq is installed it will have an effect, because OpenWRT will set the resolv.conf to 127.0.0.1 and DNS lookups are forwarded to local dnsmasq.
But with 'dump' APs you may not need dnsmasq, and then OpenWRT will set the DNS-Servers from the interfaces in the resolv.conf, so this option has no effect.

Another option is to directly manipulate the resolv.conf, but that may undermine some OpenWRT mechanisms and may break other things, but can be done at own risk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To do (Python & Django)
Development

Successfully merging a pull request may close this issue.

3 participants