Change the DNS servers by command line on XenServer

To change the DNS servers after the original setup you have to modify the server from the command line.  To do so you first need to know the uuid of the management interface.  In my case I know the management interface is eth0.  I can get the uuid of eth0 by issuing the following command:

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

Then I issue the following command to update the resolv.conf file with the DNS server list.

xe pif-reconfigure-ip uuid=<uuid_from_above> mode=static IP=<eth0_ip_address> netmask=<eth0_subnetmask> gateway=<eth0_dfg> DNS=dnsserver1,dnsserver2

No reboot required to make this change. Just ping a hostname using a short netbios name to test.

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: