DNS stands for Domain name system used for resolving hostname to ip address or ip address to hostname
server (IP --> 192.168.10.59)
-->install the 'bind' software
# yum install bind
--> to find out the configuration file of bind
# rpm -qc bind
--> prepare a backup of configuration file
# cp /etc/named.conf /etc/named.conf.bak
--> empty the configuration file
# >/etc/named.conf
# vim /etc/named.conf
options {
directory "/var/named" ;
};
zone "test.com" IN {
type master ;
file "myfile" ;
};
# cd /var/named
# cp named.localhost myfile
# vim myfile
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
AAAA ::1
www.test.com. IN A 192.168.10.2
try CNAME www
hello.test.com. IN A 10.10.10.10
# chown named:named myfile
# systemctl restart named
# systemctl enable named
Client (IP --> 192.168.10.60)
# vim /etc/resolv.conf
search test.com
nameserver 192.168.10.59
# nslookup www.test.com
# nslookup try.test.com
# host try
# host www
# nslookup hello.test.com
server (IP --> 192.168.10.59)
-->install the 'bind' software
# yum install bind
--> to find out the configuration file of bind
# rpm -qc bind
--> prepare a backup of configuration file
# cp /etc/named.conf /etc/named.conf.bak
--> empty the configuration file
# >/etc/named.conf
# vim /etc/named.conf
options {
directory "/var/named" ;
};
zone "test.com" IN {
type master ;
file "myfile" ;
};
# cd /var/named
# cp named.localhost myfile
# vim myfile
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 127.0.0.1
AAAA ::1
www.test.com. IN A 192.168.10.2
try CNAME www
hello.test.com. IN A 10.10.10.10
# chown named:named myfile
# systemctl restart named
# systemctl enable named
Client (IP --> 192.168.10.60)
# vim /etc/resolv.conf
search test.com
nameserver 192.168.10.59
# nslookup www.test.com
# nslookup try.test.com
# host try
# host www
# nslookup hello.test.com
No comments:
Post a Comment