Blog/Add DNS Search Domains in XCP-ng Server

From Forza's ramblings

2022-02-17: DNS Search Domains in XCP-ng Server[edit | edit source]

When setting up XCP-ng with a static IP address, there is no option in the xsconsole to add dns search domains. This means you must use full dns domain names in XOA and XCP-ng instead of hostnames. For example, instead of vmhost1 you would have to use vmhost1.domain.com.

It is possible to add search domains in /etc/resolv.conf, but the entries do not remain after a reboot. The solution is using xe pif-param-set to add persistent domain names.

1) First, identify which interface (PIF) which is the management interface on for the XCP-ng host.

# xe pif-list host-name-label=xcpng-host01 management=true
uuid ( RO)                  : e7b6f379-89cc-68e6-8ae6-3bbcf32076f6
                device ( RO): bond1
    currently-attached ( RO): true
                  VLAN ( RO): -1
          network-uuid ( RO): cc966455-d5f8-0257-04a7-d3d7c671636b

2) Take note of the uuid and use that with xe pif-param-set to add the search domains.

# xe pif-param-set uuid=e7b6f379-89cc-68e6-8ae6-3bbcf32076f6 other-config:domain=domain1.com,domain2.com,domain3.com

This procedure has to be done for each host in the pool.

Now, when the host is restarted, the domain search entries should be added to /etc/resolv.conf.