Parece que você está tendo alguma dificuldade, então aqui estão dois (esperançosamente) exemplos de trabalho para você. Observe que a primeira opção ( .com
zone) provavelmente evitará a resolução normal de .com
domains (por exemplo, google.com
). A segunda opção (a dns1.com
zone) não tem essa desvantagem.
Exemplo .com
Arquivos da zona
ex. /etc/bind/named.conf.local
; "db.com.tld" is a random name - use whatever you like.
; The same goes for "db.rev.192".
;
; Likewise, you can adjust your "allow-transfer" settings,
; etc. as needed.
zone "com." IN {
type master;
file "/etc/bind/zones/db.com.tld";
allow-transfer { none; };
};
zone "56.168.192.in-addr.arpa" IN {
type master;
file "/etc/bind/zones/db.rev.192";
allow-transfer { none; };
};
ex. /etc/bind/zones/db.com.tld
; BIND data file for TLD ".com"
;
; This will likely break real ".com" websites (i.e. anything not listed here).
$TTL 3600
@ IN SOA com. admin.com. (
2018040501 ; Serial
604800 ; Refresh period
86400 ; Retry interval
2419200 ; Expire time (28 days... later)
604800 ) ; Negative Cache TTL (1 week)
; Name Servers - NS records
@ IN NS ns1.com. ; This is required
@ IN NS ns2.com. ; You should have two name servers
; Name Servers - A records
ns1 IN A 192.168.56.3 ; This is required
ns2 IN A 192.168.56.3 ; You should have two name servers
; Our domains/sub-domains
dns1 IN A 192.168.56.3 ; dns1.com
host1.dns1 IN A 192.168.56.7 ; host1.dns1.com
host2.dns1 IN A 192.168.56.8 ; host2.dns1.com
Note que não há problema em usar um período como este, embora seja redundante neste caso:
;ok.period.com. IN A 192.168.56.3 ; ok.period.com -> FQDN
E isso é o que você deve evitar:
;no.period. IN A 192.168.56.3 ; Don't use periods for sub-domains
;no.period.com IN A 192.168.56.3 ; While this works, this is actually accessed as no.period.com.com!
ex. /etc/bind/zones/db.rev.192
; BIND reverse data file.
; The domain, etc. used should be a listed 'zone' in named.conf.
$TTL 86400
@ IN SOA com. admin.com. (
2018040501 ; Serial
10800 ; Refresh
3600 ; Retry
604800 ; Expire
86400 ) ; Minimum
; In this case, the number just before "PTR" is the last octet
; of the IP address for the device to map (e.g. 192.168.56.[3])
; Name Servers
@ IN NS ns1.com.
@ IN NS ns2.com.
; Reverse PTR Records
3 IN PTR dns1.com.
7 IN PTR host1.dns1.com.
8 IN PTR host2.dns1.com.
Observe que a configuração acima provavelmente limita suas opções no que diz respeito a que suas máquinas acessem .com
domínios diferentes daqueles que você criou (ou seja, eles provavelmente não poderão acessá-los). Se você deseja que eles acessem% .com
domínios estrangeiros, você pode tentar a abordagem mais estreita abaixo.
Exemplo dns1.com
Arquivos da zona
ex. /etc/bind/named.conf.local
; "db.dns1.com" is a random name - use whatever you like.
;
; Likewise, you can adjust your "allow-transfer" settings,
; etc. as needed.
zone "dns1.com" IN {
type master;
file "/etc/bind/zones/db.dns1.com";
allow-transfer { none; };
};
Você pode usar a mesma entrada de zona inversa named.conf.local
como acima.
ex. /etc/bind/zones/db.dns1.com
; BIND data for http://dns1.com
$TTL 3600
@ IN SOA ns1.dns1.com. admin.dns1.com. (
2018040501 ; Serial
604820 ; Refresh
86600 ; Retry
2419600 ; Expire
604600 ) ; Negative Cache TTL
; Name Servers - NS records
@ IN NS ns1.dns1.com. ; This is required
@ IN NS ns2.dns1.com. ; You should have two name servers
; Name Servers - A records
ns1 IN A 192.168.56.3 ; This is required
ns2 IN A 192.168.56.3 ; You should have two name servers
; Our domains/sub-domains
dns1.com. IN A 192.168.56.3 ; dns1.com
host1 IN A 192.168.56.7 ; host1.dns1.com
host2 IN A 192.168.56.8 ; host2.dns1.com
ex. /etc/bind/zones/db.rev.192
; BIND reverse data file.
; The domain, etc. used should be a listed 'zone' in named.conf.
$TTL 86400
@ IN SOA dns1.com. admin.dns1.com. (
2018040501 ; Serial
10800 ; Refresh
3600 ; Retry
604800 ; Expire
86400 ) ; Minimum
; In this case, the number just before "PTR" is the last octet
; of the IP address for the device to map (e.g. 192.168.56.[3])
; Name Servers
@ IN NS ns1.dns1.com.
@ IN NS ns2.dns1.com.
; Reverse PTR Records
3 IN PTR dns1.com.
7 IN PTR host1.dns1.com.
8 IN PTR host2.dns1.com.