在域名系统(DNS)中,NS记录将域名与负责解析其IP地址的名称服务器联系起来。别名记录,也称为CNAME记录,将一个域名(别名)重定向到另一个域名(规范名)。
在Linux中创建NS记录
要创建NS记录,请使用以下命令:
shell
dig +short ns example.com
此命令将返回指向example.com域名的名称服务器的列表。
要添加新的NS记录,请使用以下命令:
shell
nsupdate -k /etc/bind/Kexample.com+157+0192.key example.com. SOA example.com. hostmaster.example.com. 2019042901 10800 3600 604800 38400
nsupdate> add ns1.example.com. A 192.0.2.1
nsupdate> add ns2.example.com. A 192.0.2.2
nsupdate> send
其中,example.com是你要为其创建NS记录的域名,ns1.example.com和ns2.example.com是名称服务器的主机名,192.0.2.1和192.0.2.2是名称服务器的IP地址。
在Linux中创建别名记录
要创建别名记录,请使用以下命令:
shell
dig +short example.com CNAME
此命令将返回example.com域名的规范名称。
要添加新的别名记录,请使用以下命令:
shell
nsupdate -k /etc/bind/Kexample.com+157+0192.key example.com. SOA example.com. hostmaster.example.com. 2019042901 10800 3600 604800 38400
nsupdate> update delete example.com. A
nsupdate> add example.com. CNAME realexample.com.
nsupdate> send
其中,example.com是你要为其创建别名记录的域名,realexample.com是别名记录指向的规范名称。