这是我在 BIND9 中的配置
/etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 192.168.1.24
#nameserver 127.0.0.53
search fabyfashion.com
/etc/bind/named.conf.options
acl "trusted" {
192.168.1.64; #LAPTOP-3BEQ0U93
};
options {
directory "/var/cache/bind";
recursion yes;
allow-recursion { trusted; };
listen-on { 192.168.1.24; };
allow-transfer { none; };
forwarders {
8.8.8.8;
8.8.4.4;
};
#dnssec-validation auto;
dnssec-validation no;
#listen-on-v6 { any; };
/etc/bind/named.conf.local
//direct resolution area
zone "fabyfashion.com" {
type master;
file "/etc/bind/db.fabyfashion.com";
};
//reverse resolution area
zone "1.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.1.168.192";
};
/etc/bind/db.fabyfashion.com
;
; BIND Resource Records file for the zone
fabyfashion.com
;
$TTL 604800
@ IN SOA dns.fabyfashion.com. root.fabyfashion.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
;
@ IN NS dns.fabyfashion.com.
dns IN A 192.168.1.24
www IN A 192.168.1.24
LAPTOP-3BEQ0U93 IN A 192.168.1.64
server IN CNAME dns.fabyfashion.com.
/etc/bind/db.1.168.192
;
; BIND Resource Record File for Reverse Zone
1.168.192
;
$TTL 604800
@ IN SOA dns.fabyfashion.com. root.fabyfashion.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS dns.fabyfashion.com.
24 IN PTR dns.fabyfashion.com.
24 IN PTR www.fabyfashion.com.
64 IN PTR LAPTOP-3BEQ0U93.fabyfashion.com.
检查语法时,区域显示正确
root@dns:/etc/bind#named-checkconfnamed.conf.local
root@dns:/etc/bind# named-checkzone fabyfashion.com db.fabyfashion.com
zone fabyfashion.com/IN: loaded serial 2
好的
root@dns:/etc/bind# named-checkzone 1.168.192 db.1.168.192
zone 1.168.192/IN: loaded serial 2
好的
测试命令 |nslookup| dig | host |
nslookup
root@dns:/etc/bind# nslookup
> fabyfashion.com
Server: 192.168.1.24
Address: 192.168.1.24#53
*** Can't find fabyfashion.com: No answer
root@dns:/etc/bind# nslookup
> 192.168.1.24
24.1.168.192.in-addr.arpa name = www.fabyfashion.com.
24.1.168.192.in-addr.arpa name = dns.fabyfashion.com.
挖
root@dns:/etc/bind# dig fabyfashion.com
; <<>> DiG 9.16.15-Ubuntu <<>> fabyfashion.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48006
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1,
ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: d56444b5a9f1ffb00100000063b549b2a45a5e97b01355c7 (good)
;; QUESTION SECTION:
;fabyfashion.com. IN A
;; AUTHORITY SECTION:
fabyfashion.com. 604800 IN SOA dns.fabyfashion.com.
root.fabyfashion.com. 2 604800 86400 2419200 604800
;; Query time: 0 msec
;; SERVER: 192.168.1.24#53(192.168.1.24)
;; WHEN: mié ene 04 03:41:06 CST 2023
;; MSG SIZE rcvd: 117
root@dns:/etc/bind# dig 192.168.1.24
; <<>> DiG 9.16.15-Ubuntu <<>> 192.168.1.24
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 18472
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 28c0b038682a0fa80100000063b54a86d19374e052b3805b (good)
;; QUESTION SECTION:
;192.168.1.24. IN A
;; AUTHORITY SECTION:
. 4661 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2023010400 1800 900 604800 86400
;; Query time: 0 msec
;; SERVER: 192.168.1.24#53(192.168.1.24)
;; WHEN: mié ene 04 03:44:38 CST 2023
;; MSG SIZE rcvd: 144
主持人
root@dns:/etc/bind# host 192.168.1.24
24.1.168.192.in-addr.arpa domain name pointer dns.fabyfashion.com.
24.1.168.192.in-addr.arpa domain name pointer www.fabyfashion.com.
root@dns:/etc/bind# host www.fabyfashion.com
www.fabyfashion.com has address 192.168.1.24
root@dns:/etc# systemctl status bind9
● named.service - BIND Domain Name Server
Loaded: loaded (/lib/systemd/system/named.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2023-01-04 04:00:06 CST; 2s ago
Docs: man:named(8)
Process: 14516 ExecStart=/usr/sbin/named $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 14518 (named)
Tasks: 8 (limit: 4492)
Memory: 26.7M
CPU: 79ms
CGroup: /system.slice/named.service
└─14518 /usr/sbin/named -u bind -4
ene 04 04:00:06 dns named[14518]: command channel listening on 127.0.0.1#953
ene 04 04:00:06 dns named[14518]: managed-keys-zone: loaded serial 529
ene 04 04:00:06 dns named[14518]: zone 0.in-addr.arpa/IN: loaded serial 1
ene 04 04:00:06 dns named[14518]: zone 1.168.192.in-addr.arpa/IN: loaded serial 2
ene 04 04:00:06 dns named[14518]: zone fabyfashion.com/IN: loaded serial 2
ene 04 04:00:06 dns named[14518]: zone 127.in-addr.arpa/IN: loaded serial 1
ene 04 04:00:06 dns named[14518]: zone 255.in-addr.arpa/IN: loaded serial 1
ene 04 04:00:06 dns named[14518]: zone localhost/IN: loaded serial 2
ene 04 04:00:06 dns named[14518]: all zones loaded
ene 04 04:00:06 dns named[14518]: running
Should I register my domain with a provider?
I HAVE BEEN LOOKING FOR SOME ANSWER FOR MONTHS, I WOULD APPRECIATE IF SOMEONE CAN HELP ME IF I'M WRONG ABOUT SOMETHING THANKS