LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   DNS server for local network (https://www.linuxquestions.org/questions/linux-server-73/dns-server-for-local-network-4175543100/)

mackowiakp 05-20-2015 02:25 AM

DNS server for local network
 
I want to configure nameserver for local area network. My registered host in Internet DDNS system is <my_host>.ddns.net

I want to use for my local network usage (not Internet) internal address like:

host1.ddns.net
host2.ddns.net
etc
and of course router as <my_host>.ddns.net

As I wrote I use NO-IP DDNS system to access from internet my router (and the rest of local network by ports) as <my_host>.ddns.net

So my zone definition file looks like this:

Code:

[root@mackowiak named]# cat ddns.net.hosts
$ttl 38400
ddns.net.      IN      SOA    mackowiakp.ddns.net. 192.168.0.7 (
                        1431270668
                        10800
                        3600
                        604800
                        38400 )
ddns.net.      IN      NS      mackowiakp.ddns.net.
mackowiakp.ddns.net.    IN      A      192.168.0.7
tv.ddns.net.    IN      A      192.168.0.121
localhost  IN      A    127.0.0.1

so if I query form local network, local network located nameserver it answers correctly. Just like example below:

Code:

[maciek@piotr ~]$ nslookup tv.ddns.net 192.168.0.7
Server:        192.168.0.7
Address:        192.168.0.7#53

Name:  tv.ddns.net
Address: 192.168.0.121

but if I query about physically existing in ddns.net domain node, but not located in my local network it can not find out it. Just like in example below:

Code:

[maciek@piotr ~]$ nslookup lilith.ddns.net 192.168.0.7
Server:        192.168.0.7
Address:        192.168.0.7#53

** server can't find lilith.ddns.net: NXDOMAIN

This is my named.conf file:

Code:

[root@mackowiak named]# cat /etc/named.conf

options {
        listen-on port 53 { any; };
        directory      "/var/named";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query    { localhost; 192.168.0.0/24; };
        recursion yes;

        dnssec-enable no;
        dnssec-validation no;
        dnssec-lookaside no;

        forwarders {
                208.67.222.222;
                208.67.220.220;
                };
        forward first;
};

logging {
        channel default_debug {
                file "/var/named/data/logi";
                severity dynamic;
                };
};


zone "ddns.net" {
        type master;
        file "/var/named/ddns.net.hosts";
        };

How to set up DNS server to work that way that all queries to local DNS about ddns.net domain will will be forwarded to any public DNS server, if not found in local DNS.
Of course proble is only with ddns.net domain because other domains/hosts are resolved properly. Just like this:

Code:

[maciek@piotr ~]$ nslookup www.playboy.com 192.168.0.7
Server:        192.168.0.7
Address:        192.168.0.7#53

Non-authoritative answer:
www.playboy.com canonical name = g.global-ssl.fastly.net.
Name:  g.global-ssl.fastly.net
Address: 185.31.17.65

Is it possible at all? Any help please!

wildwizard 05-20-2015 05:17 AM

You can not just go adding yourself onto someone else's domain and hope that it will work. It won't.

If you want internal names then you setup your network to use the ".local" domain as that is reserved for local networks.

mackowiakp 05-20-2015 05:38 AM

OK. But I use several apps like OwnCloud located on my home server. At this moment it is necessary to have two configs for each service, first for use when I am outside my home lan and second for internal home usage.
Is it possible to address in both cases (inside or outside my house) as <my_host>.ddns.net. That is using the same domain? If so any example?


All times are GMT -5. The time now is 08:31 AM.