Replies: 10 comments 31 replies
-
Hi @pshunter, if I understand you correctly you want to have a link between the Unfortunately this is not really a trivial task and cannot be solved for the general case. IP addresses may he duplicated in different VRFs, and the same is true for DNS records in different views, and the assignment of IP addesses/DNS names to DNS resource records is non-obvious. So far nobody came up with a good canonical solution for the general case so that the mechanism could be fully automated. When the environment is simple (just one VRF, generally "global", and just one or no views in NetBox DNS) you can use the custom script in When you need any help implementing this, please feel free to come back to me and I'll try to support you. Ideally, we get another useful example for the documentation out of it.
That's not that simple, for exactly the same reason - ambiguity in the general case. If someone comes up with a bullet-proof way to select the correct related object under all circumstances I'll gladly try to add the functionality ... I would be happy to have it myself. |
Beta Was this translation helpful? Give feedback.
-
I wasn't sure where to put this, but I definitely didn't want to start another thread on "Why not link to IPAM?", so it's going to live here. Let me start out by saying, I understand the drive for this to be perfect and having stuff just magically work would be AWESOME. But, I think you might be too concerned with the affect of a VRF on DNS entries. And, I think you might also be worried about trying to save people from their own stupidity. Let's start with an example. I have the default "Global" VRF, and I have 2 named VRFs; VRF1 and VRF2. If I have the following: Global - hostname.example.com - 10.0.0.1/24 And they're all in the same DNS zone, how would I deal with this anyway? They're all in the "EXAMPLE.COM" zone, so they're going to overlap anyway. Even from a network perspective, I don't have a solution for that internally. DNS will have three entries. BUT, I also don't care. I'm not worried that pinging vrf.example.com will give me the same result as pinging magic.example.com, even though I'm in the Global VRF. What would be slightly annoying is that the PTR record might be a bit weird. But, that's not impossible to rectify either. Once the records are created, I figure out which PTR I want, and then I disable the PTR record for the other entries. OR, what could be done is; allow the ZONE/VIEW to filter entries based on VRF. This way, you could have a zone called "EXMAPLE.COM" that only has entries for the "Global" VRF, and a zone for VRF1 doing the same. Maybe you don't care about DNS for VRF2, you just want to put names against the hosts in there for IaC reasons. And, I just checked, and you don't provide a unique claim on the domain name, only the combination of domain name and view. So, potentially, just allow VRFs to be assigned to VIEWs, and then you could have "External View", "View", "VRF1 View", etc. What this would mean is:
This isn't perfect, but it would be workable. If you were to go down this path, I'd also ask that you allow for a few things:
It's not a perfectly fully formed idea, but allowing the assignment of a VRF to a view, and then allowing that view do to the filtering for automatic creation wouldn't be too hard I would imagine. It would require people to think about what they're doing, but Netbox is allowed to be a bit idiosyncratic with some things. Take Primary IPs for example. And too, I'd much prefer something that works automatically 80% of the time, than something I have to do manually 100% of the time. |
Beta Was this translation helpful? Give feedback.
-
Hi @zeddD1abl0, thanks for your thoughts. I admit to being a sucker for perfection ;-) ... but that's not the main thought behind trying to do 'the right thing'. The problem is more that when the flaws in a concept are too obvious, too many people will fall into traps and especially with DNS and other central infrastructure the results can be ... well, let's say you don't want that to happen. Data integrity is the main concern. That's one of the reasons why I always suggest that when you have a well-defined use case, implement it as a custom script or something else and publish it so that others can participate from your partial solution. I will be glad to put it into the examples section, the documentation or wherever ... no problem at all. It's not that I don't want to have a solution, it's that none so far is something I would want to put in for general use. There is also a new PR #68 by @jean1 which looks really interesting and which could make it into production code because it doesn't make any assumptions about specifics of a particular environment. I think it could be a step in the right direction. We discussed the issue offline for a while, and he's aware of the pitfalls. Anyway, there is ongoing work towards that issue, and I will look deeper into it as soon as I have more time than I have right now. I really want to find a solution to this issue as well. |
Beta Was this translation helpful? Give feedback.
-
IPAM linkingOne thing about using It does, for example, not allow IDNs written in their UTF-8 representation (which is acceptable, though uncomfortable), but it happily accepts a name like One could of course validate the value That's exactly the problem that @jean1's approach seems to avoid - I'll do some extensive testing later on, but I'm quite hopeful it's a good approach. CNAMEsYou also mention CNAME records in your initial comment, and I actually have an action item regarding CNAMEs on my list. One of the more common errors leading to DNS malfunction is broken CNAMEs. Either the creator of a CNAME record omits the dot at the end of the value when it's an FQDN, or they specify names that don't exist (or the targets are removed afterwards). So I'm planning to implement CNAME validation in NetBox DNS. Turns out that this is not as simple as it looks, and it can't be done in an exhaustive way. There are a couple of common cases: The value of the CNAME RR does not end in a dotThat looks like the easy case but isn't.
The value of the CNAME RR ends in a dot
So we can validate simple name values (single labels without dot) in any case, and for all other cases we first need to find out whether we have authoritative information about the zone. If we do, we can check whether the name is in the zone or not - the latter would be an error. If we don't, we can't validate the CNAME. If we can validate the CNAME we can also link to its target value, can't we? The answer is - no, we can't. A CNAME is an alias for a name, not for a record, so it doesn't necessarily have a unique target record. It can (and in fact does) point to all RRs that happen to have the CNAMEs value as their name, as it is a symbolic link to a name, not to a record. Simple example: An IPv4 and an IPv6 record for the same name usually exists in non-legacy environments. At best, we can (and probably will) add a list of all records a CNAME points to in the CNAMEs detail view. But your suggested CNAME linking just doesn't work, as it's not the way CNAMEs are defined. Some features are really easy to implement. And some just look simple, but aren't ... |
Beta Was this translation helpful? Give feedback.
-
While working with @jean1 on PR #68 I stumbled across another example why it's difficult to reliably map IPAM IP Address objects to NetBox DNS records. A pretty simple and fairly common scenario, in this case from my own environment: I have an internal and an external DNS view in order to handle NAT for my IPv4 address space and avoid leakage of internal network information to the Internet. Furthermore I (mainly) use an IPv6 prefix internally and externally, of course without NAT. So now the problem ist as follows:
This is one case where #68 will not help - each IP address can only be linked to one address record, so you need to choose the address in one of the views. Works for IPv4, would work for IPv6 (if there were no IPv4, i.e. an ideal world :-)), but it does not work for the dual-stack case. Any thoughts or ideas? |
Beta Was this translation helpful? Give feedback.
-
Hm ... the idea has its merits. The only drawback I can see is that prefixes are a) optional and b) hierarchical, i.e. an IP address can have multiple prefixes or none at all. On the other hand, hierarchical is good - take the most specific one that is linked to a view and you'll be fine. One issue might be if someone doesn't or want prefixes, in which case your suggestion just won't work. But that's a minor issue IMHO - after all, it doesn't hurt to use them. The other issue is more relevant - the 'DNS Name' field isn't really suitable for generic DNS names, as pointed out above. You can use it in many cases, but there are legitimate names it won't accept and there are illegitimate names it does. The second case can be handled, albeit in an ugly way, by NetBox DNS' name validation, but the first one is a real restriction, though it won't happen too often (I hope that at least, there are users in Asian countries who might disagree - I just don't know). But, to be fair - #68 has an issue with the first case as well, as you can create name/zone combinations that are legal in DNS but won't be accepted in the 'DNS Name' field. |
Beta Was this translation helpful? Give feedback.
-
For all who haven't noticed yet: NetBox DNS 0.20.0 has @jean1's experimental feature for linking IP addresses to DNS address records now. I played around with it over the weekend and yesterday, and I think it's very useful for many use cases and pushes NetBox DNS a major step forward. Please try it out and write about your experiences. It doesn't have to stay experimental for too long :-) |
Beta Was this translation helpful? Give feedback.
-
There is no conversion. Unmanaged records stay unmanaged, managed records are added independently. If you have unmanaged records that clash with managed ones, set them to 'inactive' and you're fine. Existing records should not be touched, at least unless there is an error in the new code I didn't find yet. Did you find unmanaged A or AAAA records that were converted by the new functionality? Another information: PTR records are created per address record, there is a 1:1 relationship between them. |
Beta Was this translation helpful? Give feedback.
-
Ah. That was a misunderstanding. The IPAM coupling feature leaves the address records as they are. If you create an IP address that would result in an address record with the same name, that record is created and the existing one is left intact. Unless, as you noticed, you have the The issue I mentioned earlier is that you actually see the exception in the NetBox GUI. You shouldn't, that kind of error should be caught in the |
Beta Was this translation helpful? Give feedback.
-
Current State of Affairs and PerspectiveAs you may have noticed, we made some substantial progress in this matter, mainly thanks to this month's contribution from @jean1, which is a large step forward. I just released version 0.20.2 based on Jean's work, which improves on the validation of DNS data entered and straightens some edges, and for some use cases this will already be a good solution. But please be aware that this feature is still marked experimental, which means it can go away at any time (not likely at all) or change substantially (very likely). There will probably be migration paths, but my capacities are limited and so support for experimental features is based on best effort. At the very least, have a backup (I know this is boring). Implemented FunctionalityWith the new experimental 'IPAM Coupling' feature it is possible to assign a zone and a name to any IP address, which will then result in an address record with the name provided will be created in the selected zone. That record is coupled to the IP address in a way that changes in the IP Address, the record name or the zone are reflected in the address record. Vice versa, the address record cannot be edited (it is implemented as a managed record). Deleting the IP address will also delete the address record. Vice versa, deleting the DNS zone will remove the assignment from the IP address to the address record and clear the 'DNS name' field in the IP address object. Uncovered RequirementsWhile this will cover many, especially simple, use cases, there are still some requirements that can not be covered with this concept. Most of them occur in more complex environments, i.e. when views and VRFs are involved, and some of them are related to large numbers of objects to be handled.
Next StepsDuring integration of the current functionality and following the comment from @zeddD1abl0 I got some ideas how we can improve on the remaining issues, and maybe solve them in a more extensive way.
The idea that is currently forming is as follows:
Any thoughts? |
Beta Was this translation helpful? Give feedback.
-
Hi,
We switched to Netbox as a truth source some time ago and we used it to manage our DNS by pulling data from the DNSName record in devices. We'd like to use the DNS plugin to be able to really manage our DNS tables and also some exceptions.
However, as it seems there is no link between the devices' DNS Name record and the contents of the DNS table.
This leads us to enter the same data twice in 2 different locations (dns name of a device and IP).
Would there be a possibility to automatically create a DNS record when the DNSName field of a device or VM is filled up ?
Would it also be possible to remove the corresponding record if a device or VM is deleted ?
It would also be nice if the ips from DNS records would be clickable and lead to IPS in the IPAM module/view, and maybe add a link in the other direction too.
Thanks,
J.C.H.
Beta Was this translation helpful? Give feedback.
All reactions