0

Let's say I own the domain example.com, and have a website hosted on an external server at http://example.com, which is also accessible from http://www.example.com.

I want to run my local OwnCloud instance at http://cloud.example.com, which should be accessible both locally and remotely. To make this accessible via LAN in my own network, I set up a local BIND server which resolves cloud.example.com to the local IP address of the server. However, since this is the only server, browsing to http://example.com resolves to the same machine and not to the remote website.

How could I set up my BIND server to do the following?

  • Accessing cloud.example.com from the LAN should resolve to a local IP
  • Accessing cloud.example.com through the Internet should work (will use dynamic DNS for this)
  • Browsing to http://example.com or http://www.example.com from LAN or Internet should display the externally hosted website

I am fairly new to DNS implementations so happy to RTFM if needed. Thanks.

1

you need the views functionality in BIND. as you are happy, here is the isc knowledge base article with examples:

# named.example02.conf

acl trusted { 192.168.7.0/24; localhost; };
acl guest   { 192.168.8.0/24; };

view trusted {
    match-clients { trusted; };

    allow-recursion { any; };

    zone "myzone.example" {
        type master;
        file "trusted/db.myzone.example";
    };
    zone "7.168.192.in-addr.arpa" {
        type master;
        file "trusted/db.192.168.7";
    };
};

view guest {
    match-clients { guest; };

    allow-recursion { any; };

    zone "myzone.example" {
        type master;
        file "guest/db.myzone.example";
    };
};

as you can see above myzone.example will be readed from trusted/db.myzone.example for 192.168.7.0/24 and localhost, but for 192.168.8.0/24 zone will be readed from another file.

  • I would suggest summarizing the link in your answer. This makes your answer more helpful when looking at it, but also keeps the information on super user in the (unlikely) event the remote site goes down. :) – prateek61 Apr 22 '16 at 23:43
  • suggest accepted, summarize done. – raven428 Apr 23 '16 at 5:26
  • This is not really helpful because I don't have different subnets in my LAN and I'm not exposing the local DNS server to the Internet. – Rodrigo López Dato Apr 23 '16 at 16:01
0

I solved this by copying the same A records on my remote DNS to my local DNS server. Not 100% ideal since there's some duplication, but it's very likely that those records will never change.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.