DNS resolver - for same hostname, list OpenVPN clients "above" Static DHCP?
-
TL;DR: If a hostname has been added to the DNS resolver both by DHCP static Mapping and by OpenVPN, Is there a way to get the DNS resolver to place the OpenVPN entry "above" the static entry?
Hello All,
I have a laptop (creatively named MSI) that is either:
- At home with a DHCP static mapping (hostname: MSI)
- On the road via OpenVPN (common name: MSI)
My goal is to be able to resolve the address of MSI in either of the above scenarios. Clients need to find MSI by this name in either case, which is why the name in both scenarios is MSI.
In the DNS resolver, I have checked both "Register DHCP static mappings in the DNS Resolver" and "Register connected OpenVPN clients in the DNS Resolver". This means the static address of MSI (192.168.110.144) is always in the resolver. When I connect MSI via OpenVPN, the resolver now has a second address for MSI (192.168.120.2).
Unfortunately, it seems that DNS resolver chooses to list the static address of MSI first:
C:\Windows\system32>nslookup > msi Server: UnKnown Address: 192.168.120.1 Name: msi.localdomain Addresses: 192.168.110.144 192.168.120.2
...So, when a client request MSI's address, it always gets the first one and uses it:
judypn:/ $ ping msi ping msi PING msi.localdomain (192.168.110.144) 56(84) bytes of data.
So here's the question: Is there a way to get the DNS resolver to place the OpenVPN entry "above" the static entry, so that when MSI is connected by OpenVPN, the OpenVPN address is returned?
If not, is there some other solution? I suppose as a last resort, I would have to give up on MSI having a static DHCP entry.
By the way, I thought that perhaps the DNS resolver orders the entries numerically, so I tried making the OpenVPN address range be below the LAN address range, but that did not change the order.
Thanks for any help/advice that's available!
-TM
-
I suppose a workaround would be to make a DHCP pool with one IP address and limit that pool's use to MSI's mac address? In this way, MSI wouldn't have a static DHCP mapping, but it would always get the same address, correct?