在OEL5中,有一个 dnsmasq,可以适合小型的实验性的dns设置。
如果可以看到类似如下的内容,说明dnsmasq已经设置好了。
[root@dnssvr ~]# rpm -qa dnsmasq dnsmasq-2.45-1.1.el5_3 [root@dnssvr ~]#
然后,可以设置dns解析的内容:
[root@dnssvr ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 dnssvr.gao dnssvr localhost.localdomain localhost #::1 localhost.localdomain localhost 192.168.56.201 scan.oracle11g.jp scan 192.168.56.202 scan.oracle11g.jp scan 192.168.56.203 scan.oracle11g.jp scan [root@dnssvr ~]#
然后,启动dns服务:
[root@dnssvr ~]# service dnsmasq status dnsmasq is stopped [root@dnssvr ~]# service dnsmasq start Starting dnsmasq: [ OK ] [root@dnssvr ~]# service dnsmasq status dnsmasq (pid 3045) is running... [root@dnssvr ~]#
此时,客户端作如下配置:
[root@dnscl etc]# cat /etc/resolv.conf nameserver 10.20.20.1 [root@dnscl etc]#
其中,10.20.20.1 是前面运行dns服务的机器的IP 地址。
实际测试:
[root@dnscl etc]# nslookup scan.oracle11g.jp Server: 10.20.20.1 Address: 10.20.20.1#53 Name: scan.oracle11g.jp Address: 192.168.56.203 Name: scan.oracle11g.jp Address: 192.168.56.201 Name: scan.oracle11g.jp Address: 192.168.56.202 [root@dnscl etc]# nslookup scan.oracle11g.jp Server: 10.20.20.1 Address: 10.20.20.1#53 Name: scan.oracle11g.jp Address: 192.168.56.201 Name: scan.oracle11g.jp Address: 192.168.56.202 Name: scan.oracle11g.jp Address: 192.168.56.203 [root@dnscl etc]#
简易的DNS已经成功设置。