Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search domains missing in /etc/resolv.conf #5400

Closed
ani-sinha opened this issue Jun 12, 2024 · 0 comments · Fixed by #5401
Closed

search domains missing in /etc/resolv.conf #5400

ani-sinha opened this issue Jun 12, 2024 · 0 comments · Fixed by #5401
Labels
bug Something isn't working correctly

Comments

@ani-sinha
Copy link
Contributor

ani-sinha commented Jun 12, 2024

I have a json network config that reads like this:

{
 "config": [
  {
   "mac_address": null,
   "name": "eth0",
   "subnets": [
    {
     "address": "10.37.200.128",
     "dns_nameservers": [
      "10.37.200.1"
     ],
     "dns_search": [
      "example.com"
     ],
     "gateway": "10.37.201.254",
     "ipv4": true,
     "netmask": "255.255.254.0",
     "type": "static"
    }
   ],
   "type": "physical"
  },
  {
   "address": "10.37.200.1",
   "type": "nameserver"
  }
 ],
 "version": 1
}

I expect to see example.com in the search domain in /etc/resolv.conf. Yet its missing!

$ cat /etc/resolv.conf 
; Created by cloud-init automatically, do not edit.
;
nameserver 10.37.200.1

but the interface ifcfg config file has it:

$ cat /etc/sysconfig/network-scripts/ifcfg-eth0 
# Created by cloud-init automatically, do not edit.
#
AUTOCONNECT_PRIORITY=120
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
DNS1=10.37.200.1
DOMAIN=example.com
GATEWAY=10.37.201.254
IPADDR=10.37.200.128
NETMASK=255.255.254.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

The problem here is what I understand is that https://cloudinit.readthedocs.io/en/21.1/topics/network-config-format-v1.html#nameserver is getting populated into resolv.conf but not the subnet configuration presented per interface basis. Looking at https://cloudinit.readthedocs.io/en/21.1/topics/network-config-format-v1.html#subnet-ip , dns_search and dns_nameservers should end up in /etc/resolv.conf . I think sysconfig renderer needs fixing . I will try to cook up a patch.

@ani-sinha ani-sinha added bug Something isn't working correctly new An issue that still needs triage labels Jun 12, 2024
@ani-sinha ani-sinha reopened this Jun 12, 2024
ani-sinha added a commit to ani-sinha/cloud-init that referenced this issue Jun 12, 2024
sysconfig renderer currently only uses global dns and search domain
configuration. This means it ignores interface specific dns configuration
completely. Network manager renderer on the other hand uses global
dns config with interface and subnet specific dns information to build
complete dns configuration which is then used to generate appropriate keyfiles.
Do the same for sysconfig so that /etc/resolv.conf can have complete dns and
search domain information populated.

Fixes: canonicalGH-5400
Signed-off-by: Ani Sinha <anisinha@redhat.com>
ani-sinha added a commit to ani-sinha/cloud-init that referenced this issue Jun 13, 2024
sysconfig renderer currently only uses global dns and search domain
configuration. This means it ignores interface specific dns configuration
completely. Network manager renderer on the other hand uses global
dns config along with interface and subnet specific dns information to build
complete dns configuration which is then used to generate appropriate keyfiles.
Do the same for sysconfig so that /etc/resolv.conf can have complete dns and
search domain information populated.

Fixes: canonicalGH-5400
Signed-off-by: Ani Sinha <anisinha@redhat.com>
ani-sinha added a commit to ani-sinha/cloud-init that referenced this issue Jun 13, 2024
sysconfig renderer currently only uses global dns and search domain
configuration. This means it ignores interface specific dns configuration
completely. Network manager renderer on the other hand uses global
dns config along with interface and subnet specific dns information to build
complete dns configuration which is then used to generate appropriate keyfiles.
Do the same for sysconfig so that /etc/resolv.conf can have complete dns and
search domain information populated.

Fixes: canonicalGH-5400
Signed-off-by: Ani Sinha <anisinha@redhat.com>
@catmsred catmsred removed the new An issue that still needs triage label Jun 13, 2024
ani-sinha added a commit to ani-sinha/cloud-init that referenced this issue Jun 14, 2024
sysconfig renderer currently only uses global dns and search domain
configuration. This means it ignores interface specific dns configuration
completely. Network manager renderer on the other hand uses global
dns config along with interface and subnet specific dns information to build
complete dns configuration which is then used to generate appropriate keyfiles.
Do the same for sysconfig so that /etc/resolv.conf can have complete dns and
search domain information populated.

Fixes: canonicalGH-5400
Signed-off-by: Ani Sinha <anisinha@redhat.com>
ani-sinha added a commit to ani-sinha/cloud-init that referenced this issue Jun 14, 2024
sysconfig renderer currently only uses global dns and search domain
configuration in order to populate /etc/resolv.conf. This means it ignores
interface specific dns configuration completely. This means, when global dns
information is absent and only interface specific dns configuration is present,
/etc/resolv.conf will not have complete dns information. Fix this so that
per interface dns information is also taken into account along with global dns
configuration in order to populate /etc/resolv.conf.

Fixes: canonicalGH-5400
Signed-off-by: Ani Sinha <anisinha@redhat.com>
TheRealFalcon pushed a commit that referenced this issue Jun 20, 2024
sysconfig renderer currently only uses global dns and search domain
configuration in order to populate /etc/resolv.conf. This means it ignores
interface specific dns configuration completely. This means, when global dns
information is absent and only interface specific dns configuration is present,
/etc/resolv.conf will not have complete dns information. Fix this so that
per interface dns information is also taken into account along with global dns
configuration in order to populate /etc/resolv.conf.

Fixes: GH-5400

Signed-off-by: Ani Sinha <anisinha@redhat.com>
holmanb pushed a commit that referenced this issue Jun 28, 2024
sysconfig renderer currently only uses global dns and search domain
configuration in order to populate /etc/resolv.conf. This means it ignores
interface specific dns configuration completely. This means, when global dns
information is absent and only interface specific dns configuration is present,
/etc/resolv.conf will not have complete dns information. Fix this so that
per interface dns information is also taken into account along with global dns
configuration in order to populate /etc/resolv.conf.

Fixes: GH-5400

Signed-off-by: Ani Sinha <anisinha@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants