I've setup Bind as my intranet DNS resolving service (running on Ubuntu 16.04.02 LTS).
What I want to achieve: Having a public domain name which points to a server (example: domain.com -> 1.2.3.4) Using the same subdomain name which points to internal machines (example: machine1.domain.com -> 192.168.1.100)
What I've done: (configuration)
File: /etc/bind/named.conf.options
options {
directory "/var/cache/bind";
recursion yes;
allow-recursion { 192.168.2.0/24; };
listen-on {192.168.2.4; };
allow-transfer { none; };
forwarders {
192.168.2.1; #router
8.8.8.8; #public dns
};
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
acl "truested" {
192.168.2.0/24;
192.168.2.4; # ns1
192.168.2.5; # ns2
};
File: /etc/bind/named.conf.local
zone "domain.com" {
type master;
file "/etc/bind/zones/db.domain.com";
allow-transfer { 192.168.2.5;};
};
zone 2.168.192.in-addr.arpa {
type master;
file "/etc/bind/zones/db.2.168.192";
allow-transfer { 192.168.2.5; };
};
File: /etc/bind/zones/db.domain.com
$TTL 604800
@ IN SOA ns1.domain.com. root.domain.com. (
5 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
; name servers - NS Records
IN NS ns1.domain.com.
IN NS ns2.domain.com.
; name servers - A Records
ns1.domain.com. IN A 192.168.2.4
ns2.domain.com. IN A 192.168.2.5
; 192.168.2.0/24 - A Records
server.domain.com. IN A 192.168.2.120
server2.domain.com. IN A 192.168.2.121
ns1.domain.com. IN A 192.168.2.4
ns2.domain.com. IN A 192.168.2.5
File: /etc/bind/zones/db.2.168.192
$TTL 604800
@ IN SOA ns1.domain.com. root.domain.com. (
4 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
; name servers - NS Records
IN NS ns1.domain.com.
IN NS ns2.domain.com.
; PTR Records
4 IN PTR ns1.domain.com.
5 IN PTR ns2.domain.com.
120 IN PTR server.domain.com.
121 IN PTR server2.domain.com.
Problem: When I do a DNS Lookup from a computer (having set as DNS server this server "192.168.2.4) for the IP of domain.com it doesn't return a value. Which consequently doesn't open the webpage of the external server (domain.com).
What do I have to change to have a DNS server working as I want?