Change the name of a Citrix XenServer and add a DNS suffix list

Today I decided that I wanted to change the Hostnames of my XenServers.  After a little more thought it occurred to me that I should also add a DNS suffix lookup order to them to address some name resolution issues.  Here I show how to complete each task. 

First objective: change the hostname from the command line

The command I’m going to use to do this requires the UUID, so the first thing I need to do is figure out what it is.  I can do this using the following command:

host-list

the results of which will look something like this:

     uuid ( RO)                : 6123425d-46gg-553c-bsbg-ada4d03f1edc 
          name-label ( RW): SERVER1 
name-description ( RW): Default install of XenServer

The uuid is in bold text above. Now I can change the name of the server like this:

xe host-set-hostname-live host-name=CIPT0655 host-uuid=6123425d-46gg-553c-bsbg-ada4d03f1edc host-name=SERVER2

And now to check and see if the hostname is applied:

hostname

And I see that the name has now been changed. Objective one completed, but note that this is NOT the same as changing the display name in XenCenter.  You can do that through the XenCenter gui, or you can issue the following command:

xe host-param-set name-label=<new_hostname> uuid=<uuid_as_noted_above>

Second objective: add the DNS suffix list

The steps for this are defined in this Citrix article http://support.citrix.com/article/CTX118840.

First we will need to get the uuid of the management adapter.  I happen to know that this is eth0.  To get the uuid I run the following:

xe pif-list device=eth0

Which will return something like the following:

    uuid ( RO)                  : c8d514cc-dfee-1877-c288-2a5d84cc3275
                   device ( RO): eth0
currently-attached ( RO): true
                     VLAN ( RO): -1
        network-uuid ( RO): c5837a4a-ceed-8521-8ce3-4a4e81cd66fe

So now I ffed the uuid into the following command and then reboot the server:

xe pif-param-set uuid=<pif uuid> other-config:domain=sweeneyops.lab

Note that I could add multiple domains to the list by way of a comma separated list, which would change the other-config parameter to look something like this:

… other-config:domain=sweeneyops.lab,dom1.sweeneyops.lab

After my reboot, I simply run the following to check the results:

cat /etc/resolv.conf

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: