`dig -x ...` and RFC 2317 Classless IN-ADDR.ARPA Delegation

Grant Taylor gtaylor at tnetconsulting.net
Thu Dec 19 18:24:46 UTC 2024


Hi,

I'd appreciate some help in getting just the PTR record from the 
following dig command:

	dig +short -x 192.0.2.1

With the following germane content from the respective zones:

	1.2.0.192.in-addr.arpa.	IN	CNAME	nic.host.example.net.

	nic.host.example.net.	IN	PTR	host.example.net.
	nic.host.example.net.	IN	A	192.0.2.1
	host.example.net.	IN	A	192.0.2.1

When I run the dig command above, I get two lines of output:

	nic.host.example.net.
	host.example.net.

I'm looking at scripting the collection of the value of the PTR record; 
host.example.net.  But my old method of "$(dig +short -x 192.0.2.1)" 
isn't compatible with the RFC 2317 Classless IN-ADDR.ARPA Delegation / 
CNAME method.  As such, I'm looking to update it.

Is there another -- hopefully -- simple command that I can run to get 
just the PTR value?

I took a look at `drill` and it seems to do similar and comes with it's 
own complications.

The venerable `host` also seems to produce multiple lines of output.

Or am I looking at something to post-process the output from dig et al. 
or my own custom utility (Perl / Python code) to use beside dig et al.?



-- 
Grant. . . .
unix || die


More information about the bind-users mailing list