dougbw / coredns_omada

CoreDNS plugin for TP-Link Omada SDN
Apache License 2.0
90 stars 9 forks source link

Is it possible to add A and CNAME records #12

Closed mhuca closed 1 year ago

mhuca commented 1 year ago

Firstly, thank you for doing what TP-Link could not... great work.

QUESTION. How do I add a A or CNAME record.

I have a couple of services I need to define and I've not managed to work out how to do it.

Freely admit I have no idea what I'm doing... but I do appreciate your work.

dougbw commented 1 year ago

At the moment there is no great way to simply add a static A/CNAME record, as the Omada controller has no concept of static DNS entries so there is nowhere appropriate to store/retrieve them from.

I had an idea in mind about retrieving the static DHCP entries as these have an IP address and a "description" field which could be used as the record name which would probably do the job for static A records. There would be some limitations (e.g they can only be created for addresses inside your LAN subnet) but I don't think this would be too difficult to implement as an optional config property.

Another option would be to leverage another coredns plugin such as file or hosts as coredns can chain plugins together.

Example corefile with hosts:

. {
    health :8080
    log
    debug
    hosts my-host-file
    omada {
        controller_url https://...
        site .*
        username ...
        password ...
        refresh_minutes 1
    }
    forward . 10.0.0.1
}

my-host-file content:

192.168.1.10    example.com
mhuca commented 1 year ago

Many thanks once again... the hosts option with /etc/hosts did the job... I'm findind a little "flakiness" with appleTV not able to consistently reach the CoreDNS server... but I'll do a little more digging.