default DNS IP for node from unexpected interface (not always first interface or same network)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
High
|
Mike Pontillo | ||
2.3 |
Fix Committed
|
High
|
Mike Pontillo | ||
2.4 |
Fix Released
|
High
|
Mike Pontillo |
Bug Description
The default IP returned for the DNS name for a node (e.g. maas-node06.maas) is not always the first interface shown in the web interface (or API list) of network interfaces or otherwise defaults to the 'expected' interface.
It is also not a consistent network between nodes that have slightly differing interface configurations, which results in different nodes having default IP addresses on different networks depending on their network configuration order.
In a typical deployment, the first interface in the list will be the one that is entered into DNS as $NODE.$DOMAIN. However when using bridge or bonding interfaces that behavior appears to change unexpectedly.
According to the code in maasserver/
When creating bridges and bonds through the MAAS web interface (on 2.3.3) the bond or bridge interface usually replaces the primary underlying interface you created it from in the list order shown on the web interface despite being created later.
Example:
before: ens3, ens4, ens5, ens6 (in order)
after: br-bond0(ens3, ens5), ens4, ens6
In this case, the web interface actually shows br-bond0 in the list first, but the DNS entry defaults to ens4.
As previously mentioned get_hostname_
On initial look I thought it may have used maasserver/
1331: bond0
1332: br-bond0
913: ens3
914: ens4
915: ens5
916: ens6
I stopped digging into the code there but I am sure someone more familiar with the code would quickly pinpoint the actual location of the code used to sort this list and why the order is as it is.
= User Story / Use Case =
The most common situation this is seen in right now, is where the primary interface has some combination of a bond or bridge configured against it. This results in a secondary (likely internal) interface receiving the default IP.
Secondly to this, some nodes (e.g. a nova-compute openstack node or LXD host) may require a bridge on the primary interface but other nodes may not. Resulting in an inconsistent subnet being used as the default for different nodes.
This is standard in many Ubuntu OpenStack deployments right now.
= Suggested Fix =
These suggestions may need to be split into multiple bugs depending on how the issue is solved. I will await triage before splitting it into 2 bugs as it may be chosen to simply implement a better method instead of 'fixing' the current order to be consistent.
- At a minimum, the order of the list shown in the web interface should be consistent with the order used to select the default DNS IP. Beware, however, since this appears to be dynamically generated right now, changing the current order may unexpectedly change DNS in existing environments.
- Ideally the default IP would be chosen more deterministically between multiple nodes with slightly different network configurations (for example it is common that some nodes need a bridge for the primary interface and others do not). A possible alternative would be to select them in vlan/fabric order as that would then be consistent between multiple nodes, or, to configure a specific vlan/fabric order.
= Workaround =
It appears you can update the DNS selection this using the following MAAS CLI command.
The syntax/parameters of which appear undocumented and a little unexpected (since the result for ip_addresses is a dictionary) but appears to be the intended usage based on the code.
I do not believe it is currently possible to do this through the web interface (however generally speaking the DNS web interface portion is not currently well developed, that is outside the scope of this bug report)
$ maas NAME dnsresource read # locate the numeric ID of the DNS entry for the host you need to update
$ maas NAME dnsresource update ID ip_addresses=[IP]
Related branches
- Mike Pontillo (community): Approve
- MAAS Lander: Approve
-
Diff: 190 lines (+109/-18)3 files modifiedsrc/maasserver/models/interface.py (+2/-0)
src/maasserver/models/staticipaddress.py (+29/-18)
src/maasserver/models/tests/test_staticipaddress.py (+78/-0)
- Mike Pontillo (community): Approve
-
Diff: 212 lines (+132/-17)3 files modifiedsrc/maasserver/models/interface.py (+2/-0)
src/maasserver/models/staticipaddress.py (+30/-17)
src/maasserver/models/tests/test_staticipaddress.py (+100/-0)
- MAAS Lander: Approve
- Blake Rouse (community): Approve
- Newell Jensen (community): Abstain
- MAAS Maintainers: Pending (risk-reduction) requested
-
Diff: 212 lines (+132/-17)3 files modifiedsrc/maasserver/models/interface.py (+2/-0)
src/maasserver/models/staticipaddress.py (+30/-17)
src/maasserver/models/tests/test_staticipaddress.py (+100/-0)
tags: | added: sts |
Changed in maas: | |
status: | New → Confirmed |
Changed in maas: | |
status: | Confirmed → New |
Changed in maas: | |
status: | New → Incomplete |
Changed in maas: | |
status: | Triaged → Fix Committed |
Changed in maas: | |
milestone: | 2.5.0 → 2.5.0alpha1 |
Changed in maas: | |
status: | Fix Committed → Fix Released |
Trent,
IIRC, the DNS entry defaults to the PXE interface. If the PXE interface is part of a bond, then the default DNS entry is created against the bond, and same for the bridge. I have tested this with:
a. ens1 - non-PXE iface
b. ens2 - non-PXE iface
c. ens3 - PXE iface
1. I deployed the machine, I confirm that default DNS entry was given to (c) above.
2. I created a bond with both ens1/ens2 (bond0), and the default DNS entry was given to ens3.
3. I then create a bond between ens1/ens3 (bond0), and the default DNS entry was created to the bond0.
4. I then created a bridge against ens3 (br0), and the default DNS entry was created against br0 (which is the PXE interface).
5. I then created a bridge against ens1 (br0), and the default DNS entry was created against ens3 (which is the PXE interface).
So, from my testing it is working as expected, where the PXE interface is the interface where the default DNS entry is generated.
That said, could you provide extra information and determine whether the DNS entry, in your case, is also being created against the PXE interface and any other information you think would be relevant?
Thanks!