Changing the DNS servers of Public Cloud instances
Objective
The default DNS server configured on instances you create will be the OVHcloud server (213.186.33.99 for example). You can add a secondary server or replace this configuration with your own. However, the DNS servers are configured automatically by a DHCP server and you will not be able to change the DNS configuration by editing the resolv.conf file.
This guide explains how to change the DHCP configuration of an instance in order to change the DNS servers.
OVHcloud is providing you with services for which you are responsible, with regard to their configuration and management. You are therefore responsible for ensuring they function correctly.
This guide is designed to assist you in common tasks as much as possible. Nevertheless, we recommend that you contact a specialist service provider if you have difficulties or doubts concerning the administration, usage or implementation of services on a server. You can find more information in the Go further section of this guide.
Requirements
- A Public Cloud instance in your OVHcloud account
- Administrative access to the instance via SSH or RDP
- Basic networking and administration knowledge
Instructions
Log in to your instance via SSH. Refer to our guide on Connecting to a Public Cloud instance if necessary.
Debian/Ubuntu
Using a text editor of your choice, edit the file /etc/dhcp/dhclient.conf in order to configure the DNS servers you want.
Here you can use different "statements" to add your desired DNS servers. Add the respective line and replace IP1/IP2 with their IP addresses.
- To add DNS servers that will effectively replace the one configured by default, add this line:
- To add DNS servers that will be preferred to the one configured by default:
- To add DNS servers that will only be used if the one configured by default is unavailable:
Save your changes to the config file and exit the editor.
Check that the configuration has been applied properly with the following command:
CentOS/Fedora
Check the current configuration with the command nmcli:
Retrieve the name of your public interface:
Disable the automatic DNS modification and add the IP addresses (replace IP1/IP2) of the DNS servers you want to configure. (Replace System eth0 with the actual value retrieved previously.)
Apply the configuration. (Replace System eth0 with the actual value retrieved previously.)
Check that the configuration has been properly applied:
On Windows
Connect to the instance via remote desktop session or with the VNC console. Refer to our guide on Connecting to a Public Cloud instance if necessary.
Open the Network settings.

Go to your public network adapter’s IPv4 configuration via the control panel.

Add the servers you want to use in the Advanced settings.

In PowerShell, you can use the command nslookup to check which DNS server is used by default.
Go further
First steps with Public Cloud instances
Changing the hostname of a Public Cloud instance
Join our community of users on https://community.ovh.com/en/.