OpenWrt Forum Archive

Topic: dnsmasq and cname

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

Hello. I spent much time, but i can't understand. I read many tutorials. I need to cname one domain name to other domain nane(domain/home).

And i have i problem i config etc/dchp

config cname
    option cname 'domain1'
    option target 'domain2'

I don't see error, but it does not work.
If i make next, than it work:

config domain
    option ip 'some ip'
    option name 'domain1'

But i need redirect to link, not ip adress.
Can somebody help me?

(Last edited by kostaz on 30 Nov 2017, 22:04)

from the dnsmasq authors webpages config example

http://www.thekelleys.org.uk/dnsmasq/do … nf.example

# Provide an alias for a "local" DNS name. Note that this _only_ works
# for targets which are names from DHCP or /etc/hosts. Give host
# "bert" another name, bertrand
#cname=bertand,bert

I think cname was a poor choice for this directive name.....

What you really want to do is a re-write rule because unless domain1 is a local domain, it will pass the query up the chain as opposed to doing anything to it locally.  I think thats why it works with an ip address because you for all intents and purposes make it a locally resolved name.

I don't know if there is an openwrt package that does dns re-write rules or not.  guess I'm not much help, but maybe you can see more at the site provided.

You need to supply the full domain name for both cname and target, as in e.g. "domain1.lan" and "domain2.lan".

a "local" DNS name.

Oh, i didn't see it, i try not local name.  Thank you for information, but i need new solution.
I need to my TV make redirect to link when i try to go to domain.

For example i open example.com but router redirect me to target.net/2.5

Do you know smth what can help me?

(Last edited by kostaz on 1 Dec 2017, 02:43)

I didn't consider it because in this tutorial: wiki.openwrt.org/doc/uci/dhcp  use ussualy domain name, it doesn't seems as local DNS name.

Ah i see that cname rr section (rr meaning rewrite)  that should work but it does need FQDN it can only do hosts, not like the CNAME record in dns where it is a true alias domain.

CNAME RR

A Canonical Name record specifes that a domain name is an alias for another domain, the "canonical" domain. To specify that the web server also doubles as the FTP server, one might use:

config 'cname'
    option cname 'ftp.example.com'
    option target 'www.example.com'

Note that it is necessary to use fully qualified domain names.

(Last edited by WWTK on 1 Dec 2017, 05:26)

I resolved this problem, but  where i want to post it forum said "Too more links in message. Allowed 0 links. Reduce number of links and post it again.". But i used 0 links.
May be it is becouse i used words "redirect" and name of openwrt apps.

(Last edited by kostaz on 3 Dec 2017, 07:28)

Hello Kostas,

I'm curious to see your cname solution.  Can you post a picture of the solution? (if the forum rules are making it not post text for '0 links')?

Can you write good services for pictures, which will not delete my picture after some days?

The discussion might have continued from here.