How to Create CoreDNS in Linux
[root@example ~]# wget https://github.com/coredns/
[root@example ~]# tar -xvf coredns_1.11.1_linux_amd64.tgz
[root@example ~]# mkdir /opt/CoreDNS
[root@example ~]# mv coredns /opt/CoreDNS
[root@example ~]# cd /opt/CoreDNS
[root@example ~]# cd /opt/CoreDNS
[root@example CoreDNS ]# vim corefile
raju.com {
file db.raju.com
}
rajeev.com {
file db.rajeev.com
}
[root@example CoreDNS ]# vim db.raju.com
$ORIGIN raju.com.
@ 3600 IN SOA ns1.raju.com. root.raju.com. (
2017042745 ; serial
7200 ; refresh (2 hours)
3600 ; retry (1 hour)
1209600 ; expire (2 weeks)
3600 ; minimum (1 hour)
)
3600 IN NS ns1.raju.com.
@ IN A 192.168.122.90
host1 IN A 192.168.122.91
ns1 IN A 192.168.122.90
ns1 IN A 192.168.122.90
[root@example CoreDNS ]# vim db.rajeev.com
$ORIGIN rajeev.com.
@ 3600 IN SOA ns1.rajeev.com. root.rajeev.com. (
2017042745 ; serial
7200 ; refresh (2 hours)
3600 ; retry (1 hour)
1209600 ; expire (2 weeks)
3600 ; minimum (1 hour)
)
3600 IN NS ns1.rajeev.com.
7200 ; refresh (2 hours)
3600 ; retry (1 hour)
1209600 ; expire (2 weeks)
3600 ; minimum (1 hour)
)
3600 IN NS ns1.rajeev.com.
@ IN A 192.168.122.100
host2 IN A 192.168.122.101
ns1 IN A 192.168.122.100
[root@example CoreDNS ]# nohup ./coredns -conf corefile &
ns1 IN A 192.168.122.100
[root@example CoreDNS ]# nohup ./coredns -conf corefile &
[root@example CoreDNS ]# vim /etc/resolv.conf
nameserver 127.0.0.1
[root@example CoreDNS ]# nslookup raju.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: raju.com
Address: 192.168.122.90
[root@example CoreDNS ]# nslookup host1.raju.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: host.raju.com
Address: 192.168.122.91
Comments
Post a Comment