DNS 记录介绍

DNS records

Understanding PTR MX SRV SPF AAAA DNS Records

  • NS record - The Name Server record simply specifies the other name
    servers for the domain, or maps a domain name to that of the primary
    server for the zone.
  • A record The Address record holds the IP address of the name.
  • CNAME record The Canonical Name record is an alias field allowing you
    to specify more than one name for each TCP/IP address.
  • MX record The Mail Exchange record specifies the name of the host
    that processes mail for this domain.
  • HINFO record The Host record is the record that actually specifies
    the TCP/IP address for a specified host. All hosts that have static
    TCP/IP addresses should have an entry in this database.
  • PTR record Pointer records are used for reverse lookup entries. They
    specify the IP address in reverse order and the corresponding host
    name.

Dig DNS records

Using Linux Dig to Query DNS Records

  • Simple lookup : dig howtouselinux.com

  • Lookup Name Servers: dig @8.8.8.8 howtouselinux.com NS

  • Lookup using external DNS Server: dig @8.8.8.8 howtouselinux.com

  • Lookup MX record: dig @8.8.8.8 howtouselinux.com MX

  • Lookup CNAME record: dig @8.8.8.8 howtouselinux.com CNAME

  • Lookup TXT record (e.g will it will return SPF records, google verification methods): dig @8.8.8.8 howtouselinux.com TXT

reference:

DNS port
Query DNS Txt Records with Dig Command
Linux dig DNS

### DNS记录的主要类型 DNS(Domain Name System,域名系统)的核心功能之一是通过不同的记录类型来映射域名与各种目标资源之间的关系。以下是常见的DNS记录类型及其作用: #### A记录 A记录用于将域名或子域名直接指向一个IPv4地址。这是最基础也是最常见的DNS记录类型[^3]。 #### AAAA记录 类似于A记录,AAAA记录则是用来将域名或子域名指向一个IPv6地址。随着IPv6的普及,这种记录变得越来越重要。 #### CNAME记录 CNAME记录定义了一个域名作为另一个域名的别名。当查询一个具有CNAME记录的域名时,DNS会返回其对应的目标域名,并继续对该目标域名进行解析[^3]。 #### MX记录 邮件交换记录(MX)指定负责接收发往该域名电子邮件的邮件服务器。它通常包含优先级字段,以便在有多个邮件服务器的情况下决定哪个服务器应被优先使用。 #### TXT记录 TXT记录允许管理员向DNS条目中添加任意文本信息。这常用于验证域名所有权、SPF(Sender Policy Framework)、DKIM签名以及其他安全措施。 #### NS记录 名称服务器记录(NS)指定了哪些DNS服务器能够提供关于特定DNS区域的信息。它们对于建立权威性和分层结构至关重要。 #### SOA记录 起始授权机构记录(SOA)提供了有关DNS区的一些基本参数,比如主名字服务器是谁、序列号是多少以及刷新时间间隔等。每一个有效的DNS区域都应该有一个唯一的SOA记录开头[^1]。 #### PTR记录 反向查找记录(PTR),主要用于实现从IP地址到域名的逆向解析过程,在某些应用场景下非常有用,例如SMTP协议中的身份认证环节。 #### SRV记录 服务位置记录(SRV)可以指示如何连接至某项特定的服务实例,如VoIP电话系统的SIP服务端口详情等等。 #### URL转发 虽然严格意义上不属于标准DNS记录范畴之内,但许多服务商支持设置URL重定向规则,使得访问某个域名时会被自动跳转至另一网址处[^3]。 #### 泛解析 (* Wildcard Record) 通配符记录可以让所有未明确列出的子域均指向同一目的地,从而简化管理和维护工作量[^3]。 ```python # 示例代码展示如何创建简单的A记录配置文件 zone_file_content = """ example.com. IN SOA ns1.example.com. admin.example.com. ( 20230701 ; Serial number 86400 ; Refresh time interval in seconds 7200 ; Retry time interval in seconds 3600000 ; Expire time after which zone becomes invalid 172800 ) ; Minimum TTL value for negative responses example.com. IN NS ns1.example.com. example.com. IN NS ns2.example.com. www.example.com. IN A 192.0.2.1 mail.example.com. IN MX 10 mailserver.example.com. """ print(zone_file_content) ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值