简体   繁体   中英

Debian DNS Jessie - Subdomain to secondary server

Ok, so here i have one box

Windows Host (Debian Linux 8 VM - Oracle) -Set up. A Live Working Machine, DNS apache php...etc..

IP is **AAAA**

second machine, fresh install, second vm, php apache all running. DNS is not.

IP is **AAAB**

The External IPV40. ISP Router.

IP is **XXXX**

So the Goal is simple:

On thisdomain.com it has a local IP of **AAAA** but on the Second Server it has the IP **AAAB**

IP AAAA Serves the domain and the website for www.thisdomain.com and thisdomain.com.`

I wish to have ls.thisdomain.com serve IP **AAAB**

The DNS Records `are like so:


    $TTL    38400
    thisdomain.com. IN  SOA ls.thisdomain.com. webmaster.thisdomain.com. (
                        5       ; Serial
                        1d      ; Refresh
                        60m     ; Retry
                        7d      ; Expire
                        6h )        ; Negative Cache TTL
    ; ### this is the forward zone of IP 2 A.A.A.B (ls.thisdomain.com)
    thisdomain.com. IN  A   X.X.X.X
    thisdomain.com. IN  NS  ls.thisdomain.com.
    ls.thisdomain.com.  IN  A   X.X.X.X
    ls.thisdomain.com.  IN  A   A.A.A.B
    ;
    www     IN  CNAME   thisdomain.com.
    ;

on the main server that serves domain IP 2 = **AAAA** :


    $TTL    38400
    thisdomain.com. IN  SOA ns1.thisdomain.com. webmaster.thisdomain.com. (
                        5       ; Serial
                        1d      ; Refresh
                        60m     ; Retry
                        7d      ; Expire
                        6h )        ; Negative Cache TTL
    ;
    thisdomain.com.      IN A   X.X.X.X
    ns1.thisdomain.com. IN  A   X.X.X.X
    ns2.thisdomain.com. IN  A   X.X.X.X
    ls.thisdomain.com.  IN  A   X.X.X.X
    thisdomain.com.     IN  NS  ls.thisdomain.com.
    ls.thisdomain.com.  IN  A   A.A.A.B
    thisdomain.com.     IN  NS  ns1.thisdomain.com.
    thisdomain.com.     IN  NS  ns2.thisdomain.com.
    ;
    www     IN  CNAME   thisdomain.com.
    ;

and whats this issue? well, it seems that even though i think there good to go, the ls.

Subdomain still only shows the first servers Apache website **AAAA**
instead of the second servers **AAAB** Apache Website.

What i want is it to be like this ls.thisdomain.com
hits public ip XXXX then searches NS1 on IP AAAA then send user to webpage on server LS which is AAAB .

How would one Achieve this to be so that it does happen?

Well, there are several apparent errors above. First, the whole idea of having two different zones for the same name is meaningless because it requires an unnecessary level of DNS recursion - you should serve a single consolidated DNS zone, and if you need two servers for redundancy, then make one of them master and the other one slave (a verbatim copy of the master).

Second, the second zone lists adds two additional NS records compared to the first zone, but all of those in turn point to the same IP address. This is also meaningless.

Third, the name ls.thisdomain.com is defined as a round-robin DNS entry, meaning 50% of the clients will resolve it to XXXX, while another 50% will resolve it to AAAB Each of those clients will then cache that result for 38400 seconds and then repeat the query, after which point they again have a 50:50 chance of getting either result.

It's unclear from the question whether AAA* is perhaps a private IP network. If the intent is to allow external users to access AAAB which is in a private network, then DNS is simply not the solution. DNS is a Layer 7 protocol which doesn't care which kind of IPs its results will contain, but the external users can't route via Layer 3 to external private networks. HTTP traffic can only arrive at the public XXXX IP, typically at port 80, and then the router can pass it on (NAT it) to an HTTP server. This HTTP server in turn can pass the results on to two separate virtual hosts or even two separate machines (proxying).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM