I have two replicated LAMP servers, one as slave and the other as master:
Master: Name = master.kimsufi.com - IP = 5.5.5.1
Slave: Name = slave.kimsufi.com - IP = 5.5.5.2
(as you can see, both are registered with kimsufi)
With these servers and without an additional IP address, my purpose is host a www.domain.com with Master and in case it fails transfer the control to the slave (I know there is software like Heartbeat that allows this but needs a virtual IP, it is, an additional IP address and Kimsufi doesn't allow that ).
I was thinking in this problem and "found" a possible solution that I'm sure is not valid because I haven't found it published anywhere (and my network knowledge is low). May be you can help me to see the problem.
The idea is to add a DNS server in each server and configure the slave as a backup server in case Master cannot resolve. More or less the idea is to setup in the register domain.com something like this:
Primary DNS: Master (5.5.5.1)
Secondary DNS: Slave (5.5.5.2)
Then, the Master server will be configured as usual, pointing his bind9 service to the Master server:
$TTL 86400
@ IN SOA master.kimsufi.com. user.gmail.com. (
2014011302 ; serial, todays date + todays serial #
28800 ; refresh, seconds
7200 ; retry, seconds
604800 ; expire, seconds
86400 ) ; minimum, seconds
;
domain.com. 86400 A 5.5.5.1
domain.com. NS master.kimsufi.com.
domain.com. NS slave.kimsufi.com.
www 86400 A 5.5.5.1
And the slave:
$TTL 86400
@ IN SOA slave.kimsufi.com. user.gmail.com. (
2014011304 ; serial, todays date + todays serial #
28800 ; refresh, seconds
7200 ; retry, seconds
604800 ; expire, seconds
86400 ) ; minimum, seconds
;
domain.com. 86400 A 5.5.5.2
domain.com. NS master.kimsufi.com.
domain.com. NS slave.kimsufi.com.
www 86400 A 5.5.5.2
So if you try a dig with this you'll get something like:
ivan@local:~$ dig domain.com NS
; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> domain.com NS
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33268
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;domain.com. IN NS
;; ANSWER SECTION:
domain.com. 86400 IN NS master.kimsufi.com.
domain.com. 86400 IN NS slave.kimsufi.com.
;; Query time: 87 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Wed Jan 14 15:30:11 2015
;; MSG SIZE rcvd: 78
The idea is that as Master is the primary name server, it will process any query for domain.com but if it is offline, Slave do the job.
I haven't tested it, it's just an idea (currently I only own a server at kimsufi). Is it possible? What are the fail in this scheme?