xcat2 / xcat-core

Code repo for xCAT core packages
Eclipse Public License 1.0
360 stars 171 forks source link

Add search domain to resolv.conf #6266

Open geoffrey-pascal opened 5 years ago

geoffrey-pascal commented 5 years ago

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.

immarvin commented 5 years ago

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

geoffrey-pascal commented 5 years ago

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 ?

immarvin commented 5 years ago

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

geoffrey-pascal commented 5 years ago

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 !

immarvin commented 5 years ago

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.

nlvw commented 2 years ago

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).