AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1098283
Accepted
John
John
Asked: 2022-04-11 08:38:35 +0800 CST2022-04-11 08:38:35 +0800 CST 2022-04-11 08:38:35 +0800 CST

srv 记录的有效区域名称或有效服务名称是什么?

  • 772

我一直在关注一些关于如何使用 A 记录和 SRV 记录将域映射到特定 ip 和端口的指南/问题,例如1.1.1.1:1889:

https://stackoverflow.com/questions/11433570/how-to-use-srv-or-any-other-record-do-redirect-a-domain

https://stackoverflow.com/questions/19015138/how-to-redirect-dns-to-different-ports

在上述问题中,他们建议使用 SRV 记录。我唯一不清楚的部分是如何确定service在我的 SRV 记录中使用的正确名称?例如,假设我有这些记录

mysql.example.com.  86400 IN A 1.1.1.1
mongo.example.com.  86400 IN A 1.1.1.1
www.example.com.  86400 IN A 1.1.1.1
mosquitto.example.com.  86400 IN A 1.1.1.1
_mysql._tcp.example.com. 86400 IN SRV 10 20 3306 mysql.example.com.
_mongo._tcp.example.com. 86400 IN SRV 10 20 27017 mongo.example.com.
_http._tcp.example.com. 86400 IN SRV 10 20 3306 www.example.com.
_mqtt._tcp.example.com. 86400 IN SRV 10 20 3306 mosquitto.example.com.

我的 SRV 记录中使用的服务名称是否_mysql, _mongo, _http and _mqtt正确? 我完全猜到了这些服务名称,因为我找不到列出所有可以使用的可接受服务名称的网站。

domain-name-system srv-record
  • 1 1 个回答
  • 141 Views

1 个回答

  • Voted
  1. Best Answer
    Patrick Mevzek
    2022-04-11T09:30:57+08:002022-04-11T09:30:57+08:00

    最初的网络浏览器根本不遵循SRV记录,所以即使你可以设计它们,它们也毫无用处。

    现在给出一个通用过程,以了解任何记录SRV中的内容,例如。

    IANA 是事物的守护者,因此请访问https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4,您可以在其中看到SRV它在 RFC 2782 中定义

    在那里它被定义为:

    以下是 SRV RR 的格式,其 DNS 类型代码为 33:

       _Service._Proto.Name TTL Class SRV Priority Weight Port Target
    

    然后分别:

    服务

       The symbolic name of the desired service, as defined in Assigned
       Numbers [STD 2] or locally.  An underscore (_) is prepended to
       the service identifier to avoid collisions with DNS labels that
       occur in nature.
    

    和

    原型

       The symbolic name of the desired protocol, with an underscore
       (_) prepended to prevent collisions with DNS labels that occur
       in nature.  _TCP and _UDP are at present the most useful values
       for this field, though any name defined by Assigned Numbers or
       locally may be used (as for Service).  The Proto is case
       insensitive.
    

    [STD 2] 参考是 RFC 1700,但 RFC 3232 废弃了它,以使可能值的数据库在线......这再次由 IANA 管理。

    它现在在那里:https ://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml请注意,它基本上是您/etc/services在任何 Unix 框中的文件中找到的内容.

    所以收回你的例子(你的端口号在描述的多SRV条记录中是错误的):

    • mysql确实是为端口定义的,3306因此它作为服务名称有效,因此在SRV记录中
    • 对于 port 27017,服务名称是mongodb, not mongo(但 Mongo 客户是否尊重SRV记录?)
    • http确实是为端口定义的,80因此它是一个有效的服务名称(以及https端口 443)
    • mqtt被定义为有效的端口名称,对于 port 1883。但与上述相同的问题,客户是否使用SRV记录?

    还请注意,在野外有各种SRV不遵循上述记录的记录。如果它们可以发布它们“工作”,那么即使它们不使用上述注册服务名称,也不会阻止它们在 DNS 级别解析,只要某些应用程序当然会读取它们。

    例如,您可以在网上找到很多示例_sip._tls,_sipfederationtls._tcp它们都是错误的:tls不是有效的协议,sipfederantiontls也不是有效的服务名称(实际上太长了,如https://www.rfc-editor. org/rfc/rfc6335.html#section-5.1指定它的长度最多为 15 个字符)。因此,某些工具/UI 可能会阻止在区域文件中创建这些记录,并且某些名称服务器可能会拒绝加载它们,但在大多数情况下它们会起作用(如果应用程序确实使用它们)。

    • 4

相关问题

  • Solaris DNS

  • resolv.conf 在经过一段时间后被更改

  • 为什么有些网站的网址中没有“www”就无法显示?[关闭]

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve