Shmulik Klein
Shmulik Klein

Reputation: 3914

Can I Use an IP Address in a SRV Record?

I'm trying to understand whether or not is it possible to use an IP address in a SRV record's "Target" section instead of an hostname.

I noticed that when querying an SRV record (using dig or dnsjava) on a DNS server I'm getting the resulted hostname following a trailing dot (absolute path) - this means that if I want to use an IP address I'll have to chop the dot, so I'll be able to connect to targeted IP.

Is this follows the SRV's specification (RFC 2782) ? And if I'm obligate to use a hostname, can you please explain why ?

I'm asking this for being able to implement the client side which fetch the result for a certain service after querying the relevant SRV record.

Upvotes: 3

Views: 6295

Answers (1)

Robᵩ
Robᵩ

Reputation: 168636

The RFC you reference defines "Target" as:

The domain name of the target host. There MUST be one or more address records for this name, the name MUST NOT be an alias (in the sense of RFC 1034 or RFC 2181).

Therefore the target cannot be an IP address.

Upvotes: 9

Related Questions