Issue
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 **A.A.A.A**
second machine, fresh install, second vm, php apache all running. DNS is not.
IP is **A.A.A.B**
The External IPV40. ISP Router.
IP is **X.X.X.X**
So the Goal is simple:
On thisdomain.com
it has a localIP of **A.A.A.A**
but on the Second Server it has the IP **A.A.A.B**
IP A.A.A.A Serves the domain and the website for www.thisdomain.com and thisdomain.com.`
I wish to have ls.thisdomain.com
serve IP **A.A.A.B**
TheDNS
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 = **A.A.A.A**
:
$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 **A.A.A.A**
instead of the second servers
**A.A.A.B** Apache Website.
What i want is it to be like this
ls.thisdomain.com
hits
public ip X.X.X.X
then searches
NS1
on
IP A.A.A.A
then send user to webpage on server
LS
which is A.A.A.B
.
How would one Achieve this to be so that it does happen?
Solution
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 X.X.X.X, while another 50% will resolve it to A.A.A.B. 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 A.A.A.* is perhaps a private IP network. If the intent is to allow external users to access A.A.A.B 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 X.X.X.X 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).
Answered By - Josip Rodin