Custom DNS Not Working (OpenWRT/LEDE Backend)

152 views
Skip to first unread message

Aaron Hamilton

unread,
Sep 13, 2018, 8:04:22 PM9/13/18
to OpenWISP
I'm attempting to incorporate custom DNS entries in a configuration template for LEDE/OpenWrt, but the configuration preview is missing the DNS entries despite them being in the raw JSON.

If someone could point me in the direction of where to look, I could check this out and create a patch for it possibly. I'm very new to OpenWISP and only know the basics, so not sure where the netjson is getting converted to UCI. 

Federico Capoano

unread,
Sep 14, 2018, 3:12:11 AM9/14/18
to open...@googlegroups.com
Hi Aaron and welcome,

could you please send the NetJSON configuration you're mentioning, removing sensitive or not relevant parts?

Federico

On Fri, Sep 14, 2018 at 2:04 AM Aaron Hamilton <aaron.h...@atlaslabs.io> wrote:
I'm attempting to incorporate custom DNS entries in a configuration template for LEDE/OpenWrt, but the configuration preview is missing the DNS entries despite them being in the raw JSON.

If someone could point me in the direction of where to look, I could check this out and create a patch for it possibly. I'm very new to OpenWISP and only know the basics, so not sure where the netjson is getting converted to UCI. 

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aaron Hamilton

unread,
Sep 14, 2018, 4:39:24 AM9/14/18
to open...@googlegroups.com
Thanks Federico. This is what the netjson config looks like when previewing the template:

{
    "dns_servers": [
        "8.8.8.8",
        "8.8.4.4"
    ]
}

To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+unsubscribe@googlegroups.com.

Federico Capoano

unread,
Sep 14, 2018, 5:12:52 AM9/14/18
to open...@googlegroups.com
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"
    ]
}

(I looked for a different way to implement that but couldn't find one. If anyone has suggestions these are very welcome)

On Fri, Sep 14, 2018 at 10:39 AM Aaron Hamilton <aaron.h...@atlaslabs.io> wrote:
Thanks Federico. This is what the netjson config looks like when previewing the template:

{
    "dns_servers": [
        "8.8.8.8",
        "8.8.4.4"
    ]
}
On Fri, Sep 14, 2018 at 12:11 AM, Federico Capoano <federico...@gmail.com> wrote:
Hi Aaron and welcome,

could you please send the NetJSON configuration you're mentioning, removing sensitive or not relevant parts?

Federico

On Fri, Sep 14, 2018 at 2:04 AM Aaron Hamilton <aaron.h...@atlaslabs.io> wrote:
I'm attempting to incorporate custom DNS entries in a configuration template for LEDE/OpenWrt, but the configuration preview is missing the DNS entries despite them being in the raw JSON.

If someone could point me in the direction of where to look, I could check this out and create a patch for it possibly. I'm very new to OpenWISP and only know the basics, so not sure where the netjson is getting converted to UCI. 

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+u...@googlegroups.com.

Aaron Hamilton

unread,
Sep 21, 2018, 4:12:39 AM9/21/18
to open...@googlegroups.com
Thanks Federico. Is there a way to map it to the dnsmasq config file?  For example, the spot I'm hoping to populate is in the file /etc/config/dhcp.  Here's an example of the section:

config dnsmasq
        option domainneeded '1'
        option boguspriv '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'
        list server '8.8.8.8'
        list server '8.8.4.4'

On Fri, Sep 14, 2018 at 2:12 AM, Federico Capoano <federico...@gmail.com> wrote:
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"
    ]
}

(I looked for a different way to implement that but couldn't find one. If anyone has suggestions these are very welcome)
On Fri, Sep 14, 2018 at 10:39 AM Aaron Hamilton <aaron.h...@atlaslabs.io> wrote:
Thanks Federico. This is what the netjson config looks like when previewing the template:

{
    "dns_servers": [
        "8.8.8.8",
        "8.8.4.4"
    ]
}
On Fri, Sep 14, 2018 at 12:11 AM, Federico Capoano <federico...@gmail.com> wrote:
Hi Aaron and welcome,

could you please send the NetJSON configuration you're mentioning, removing sensitive or not relevant parts?

Federico

On Fri, Sep 14, 2018 at 2:04 AM Aaron Hamilton <aaron.h...@atlaslabs.io> wrote:
I'm attempting to incorporate custom DNS entries in a configuration template for LEDE/OpenWrt, but the configuration preview is missing the DNS entries despite them being in the raw JSON.

If someone could point me in the direction of where to look, I could check this out and create a patch for it possibly. I'm very new to OpenWISP and only know the basics, so not sure where the netjson is getting converted to UCI. 

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+unsubscribe@googlegroups.com.

Federico Capoano

unread,
Sep 21, 2018, 6:28:08 AM9/21/18
to OpenWISP
Yes, go into NetJSON advanced mode, the syntax is explained here:

eg:

{
   
"dhcp": [
       
"config_name": "dnsmasq",
       
"config_value": "dnsmasq",
       
"domainneeded": true,
       
"server": ["8.8.8.8", "8.8.4.4"],
       
// etc .....
   
]
}

Fed

Federico Capoano

unread,
Sep 30, 2018, 7:31:42 AM9/30/18
to OpenWISP
BTW I created an issue for improving the DNS configuration: https://github.com/openwisp/netjsonconfig/issues/117

I think this area can be improved.
If someone can suggest a solution we could create a Google Code-In task to fix this.

Federico
Reply all
Reply to author
Forward
0 new messages