All I want is to setup a master and slave DNS server under one domain. so If master server was irresponsible slave server would work. For this I need to create ns1 on server1 and ns2 on server2. (different subnets). But parent domain is configured with server1.
Put the exact same zone file on both servers. The zone file should include both
NS records and
A records for each nameserver as well. Ideally, the slave should just pull the zone file from the master. Like this:
mydomain.com IN SOA ns1.mydomain.com. hostmaster.mydomain.com.
( 1 3600 1100 2000000 8400 )
IN NS ns1.mydomain.com.
IN NS ns2.mydomain.com.
ns1.mydomain.com. IN A 18.104.22.168
ns2.mydomain.com. IN A 22.214.171.124
Tell your registrar about both nameservers. If the nameservers are inside the domain they server, make sure glue records are added.