I'm trying to build a DHCP and DNS server. I check that client ip is ok to capture (11.11.0.1),
ping server ip (11.11.0.9) is ok, but ping domain name (example.com) is not ok.
On the server, ping IP is ok, ping domain name (example.com) is also ok.
The following is my trying steps, I don't know how to make it work, please tell me if anything wrong. thank you.
On CentOS Server side:
- config of "dhcpd.conf" as below:
dhcpd_interfaces="eth0"; default-lease-time 84600; max-lease-time 864000; ddns-update-style none; subnet 11.11.0.0 netmask 255.255.255.0{ option routers 11.11.0.254; option domain-name "example.com"; option domain-name-servers "11.11.0.9"; }; range 11.11.0.1 11.11.0.99;
DNS building Step:
1. "named.conf" as below:
options {
listen-on port 53 { 127.0.0.1; 11.11.0.9; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
zone "example.com" IN {
type master;
file "fwd.example.com";
allow-update { none; };
};
zone "9.0.11.11.in-addr.arpa" IN {
type master;
file "rev.example.com";
allow-update { none; };
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
- create "fwd.example.com" in /var/named/
$TTL 86400
@ IN SOA dns.example.com. root.example.com. (
2011071001 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
@ IN NS dns.example.com.
@ IN NS dnstwo.example.com.
@ IN A 11.11.0.9
@ IN A 11.11.0.39
dns IN A 11.11.0.9
dnstwo IN A 11.11.0.39
- create "rev.example.com" in /var/named/
$TTL 86400
@ IN SOA dns.example.com. root.example.com. (
2011071001 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
@ IN NS dns.example.com.
@ IN NS dnstwo.example.com.
@ IN PTR example.com.
dns IN A 11.11.0.9
dnstwo IN A 11.11.0.39
9 IN PTR dns.example.com.
39 IN PTR dnstwo.example.com.
service named restart
domain-name probe:
dig dns.example.com
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> dns.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6170
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 1
;; QUESTION SECTION:
;dns.example.com. IN A
;; ANSWER SECTION:
dns.example.com. 86400 IN A 11.11.0.9
;; AUTHORITY SECTION:
example.com. 86400 IN NS dnstwo.example.com.
example.com. 86400 IN NS dns.example.com.
;; ADDITIONAL SECTION:
dnstwo.example.com. 86400 IN A 11.11.0.39
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Jun 8 18:34:06 2015
;; MSG SIZE rcvd: 97
dig -x 11.11.0.9
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> -x 11.11.0.9
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47882
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; QUESTION SECTION:
;9.0.11.11.in-addr.arpa. IN PTR
;; ANSWER SECTION:
9.0.11.11.in-addr.arpa. 86400 IN PTR example.com.
;; AUTHORITY SECTION:
9.0.11.11.in-addr.arpa. 86400 IN NS dns.example.com.
9.0.11.11.in-addr.arpa. 86400 IN NS dnstwo.example.com.
;; ADDITIONAL SECTION:
dns.example.com. 86400 IN A 11.11.0.9
dnstwo.example.com. 86400 IN A 11.11.0.39
;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Jun 8 18:33:05 2015
;; MSG SIZE rcvd: 133
ping 11.11.0.1 is ok
ping dns.example.com is ok
[root@localhost ~] nslookup example.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: example.com
Address: 11.11.0.39
Name: example.com
Address: 11.11.0.9
On Windows Client side:
C:>ipconfig -all 連線特定 DNS 尾碼 . . . . . . . . : example.com ~~~ IPv4 位址 . . . . . . . . . . . . : 11.11.0.1(偏好選項) 子網路遮罩 . . . . . . . . . . . .: 255.255.255.0 ~~~ 預設閘道 . . . . . . . . . . . . .: 11.11.0.254 DHCP 伺服器 . . . . . . . . . . . : 11.11.0.9 ~~~ DNS 伺服器 . . . . . . . . . . . .: fec0:0:0:ffff::1%1 fec0:0:0:ffff::2%1 fec0:0:0:ffff::3%1 NetBIOS over Tcpip . . . . . . . .: 啟用
ping 11.11.0.9 is ok
ping dns.example.com couldn't find dns.exmaple.com