I’m attempting to use a 172.16.x.x
address in one of my A records. I understand that this isn’t able to be publicly routed, but for my use case, it doesn’t need to be.
My use case:
I have a device that I plug into a computer via the Ethernet port, and it has its own DHCP. The DHCP assigns an IP address to that whichever Ethernet interface I plugged it into, and I can then connect to the device’s web interface via the IP address of the device (ex. 172.16.0.1
). The device does not have another connection out, and does not have DNS. I am running dnsmasq on it for DHCP routing, with the following settings:
dhcp-range=172.16.0.2,172.16.0.14,1h
dhcp-option=3
dhcp-option=6
I run a DHCP server on it so that I don’t need to worry about hard-coding a static IP address, configuring the local Ethernet interface to be on the same subnet, etc. This way, I can just plug it in, it’ll assign an address, and just work.
What I’m trying to do:
I would like to use a DNS name to connect to the device instead. That way I can use an address like mydevice.mydomain.com
to connect. However, when I put an A record into my DNS for the device, it doesn’t seem to resolve.
This is what my DNS looks like in Cloudflare:
| Type | Name | Content | Proxy status | TTL | Actions |
| ---- | -------- | ---------- | ---------------------- | ---- | ------- |
| A | mydevice | 172.16.0.1 | DNS only - reserved IP | Auto | Edit |
And when I dig the name, this is what I get:
$ dig mydevice.mydomain.com
; <<>> DiG 9.18.1-1ubuntu1.1-Ubuntu <<>> mydevice.mydomain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1044
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;mydevice.mydomain.com. IN A
;; Query time: 76 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Fri Jun 17 13:22:18 MDT 2022
;; MSG SIZE rcvd: 41
As you can see, it doesn’t appear to resolve anything. However, it does see an A record is present for it. Does Cloudflare give blank data back for private/reserved IP ranges? I was hoping that it would resolve to my 172.16.0.1
address, and then I could use that to connect to my device that’s plugged in.