xcat-core icon indicating copy to clipboard operation
xcat-core copied to clipboard

Add search domain to resolv.conf

Open geoffrey-pascal opened this issue 6 years ago • 6 comments

Is there any way to add a custom search attribute to the resolv.conf ? I tried to set the domain attribute from the network table to "subdomain1.mydomain.com subdomain2.mydomain.com" but it's not added to the resolv.conf on the deployed node and it fails to generate a working dhcpd.conf.

What I am trying to achieve is to be able to resolve shortnames that are not part of the xcat cluster with the DNS forwarder defined in the site table.

For example :

external-node is not part of the xcat cluster and his FQN is external-node.subdomain2.mydomain.com. The request is actually forwarded to the DNS declared in the site table when I use the FQN, not when I use the short name. To make this work I have to manually add to resolv.conf the search attribute search subdomain1.mydomain.com subdomain2.mydomain.combut I would like to do it without any syncfile ou manual editting.

geoffrey-pascal avatar Apr 25 '19 09:04 geoffrey-pascal

hi @geoffrey-pascal , you have to define the networks entries with domain to be each of the search domains subdomain1.mydomain.com and subdomain2.mydomain.com

For example:

[root@boston02 ~]#  tabdump networks
#netname,net,mask,mgtifname,gateway,dhcpserver,tftpserver,nameservers,ntpservers,logservers,dynamicrange,staticrange,staticrangeincrement,nodehostname,ddnsdomain,vlanid,domain,mtu,comments,disable
"10_0_0_0-255_0_0_0","10.0.0.0","255.0.0.0","eth0","10.0.0.101",,"<xcatmaster>",,,,,,,,,,"subdomain1.mydomain.com",,,
"30_5_0_0-255_255_0_0","30.5.0.0","255.255.0.0",,,,,,,,,,,,,,"subdomain2.mydomain.com",,,

The search domains will be added to the option domain-search for all the shared-network in /etc/dhcpd.conf, hence the /etc/resolv.conf in the provisioned node

immarvin avatar Apr 29 '19 03:04 immarvin

Hi @immarvin Thanks for your answer. What I am trying to achieve is to have the two subdomains added to /etc/resolv.conf but they are on the same network, I don't think I can put two domains in the attribute domain of the networks table right ?

geoffrey-pascal avatar Apr 29 '19 12:04 geoffrey-pascal

hi @geoffrey-pascal , yes, if you put 2 domains in 1 entry in networks table, makedhcp -n will produce an invalid option in dhcpd.conf

    option domain-search  "clusters.com", "test.com,xyz.com", "abc.com";

and on the dhclient side, this options will be taken as invalid value and won't be written to /etc/resolv.conf

immarvin avatar Apr 30 '19 02:04 immarvin

is there any other way to add more than one domain in the resolv.conf ? Otherwise, it would be nice to have the ability to add more than one domain in the network table.

Thanks !

geoffrey-pascal avatar Apr 30 '19 07:04 geoffrey-pascal

I am afraid currently you have to modify the /etc/dhcpd/dhcpd.conf manually. We will have a discussion on this to see whether we will support such feature.

immarvin avatar Apr 30 '19 07:04 immarvin

To add on to this if you follow @immarvin initial suggestions things work in the name to ip direction but reverse lookups will not work for anything that has to forward to the external DNS (instead of xcat's).

nlvw avatar Aug 03 '22 18:08 nlvw