DNS for the DB System
You can use DNS and hostname resolution for the DB system.
Oracle recommends using a private DNS resolver to enable the use of hostnames when on-premises hosts and VCN resources communicate with each other.
The following table shows which choices are supported with each type of DB system, and the endpoints that need to be resolved for the DB system to function.
DB System Type | Supported DNS Choices | Endpoints to Be Resolved |
---|---|---|
Single-node virtual machine |
|
|
Multi-node RAC virtual machine |
|
|
The following sections give more details about the DNS choices.
Default (Internet and VCN Resolver)
See the preceding table for the types of DB systems that support the Internet and VCN resolver.
Oracle recommends using the Internet and VCN resolver for DNS. It's the default, built-in DNS functionality that comes with each VCN. It enables hosts in a VCN to resolve these items:
- Hostnames of other hosts in the same VCN.
- Hostnames that are publicly published on the Internet.
For a DB system, the Internet and VCN resolver handles resolution of all necessary endpoints: Object Storage endpoints (includes both the Object Storage endpoints and Swift endpoints), YUM repos, and SCANs (SCANs are used only with multi-node RAC DB systems).
By default, each VCN is configured to use the Internet and VCN resolver. If you plan to use a custom DNS resolver, you must configure the VCN in a different way.
Use the Internet and VCN Resolver With Your DB System
As part of the overall network setup, perform these tasks:
- Create the VCN with the required DNS settings:
- When creating the VCN, select the check box for Use DNS hostnames in this VCN.
- Specify a DNS label for the VCN.
- Notice that you cannot change these VCN DNS settings after you create the VCN.
- Create each subnet with the required DNS settings:
- When creating a subnet in the VCN, select the check box for Use DNS hostnames in this subnet.
- Specify a DNS label for the subnet.
- Notice that you cannot change these subnet DNS settings after you create the subnet.
- Use the default set of DHCP options that come with the VCN:
- When creating each subnet, configure it to use the VCN's default set of DHCP options.
- By default, the default set of DHCP options is configured to use the Internet and VCN resolver.
- Create the DB system with a hostname prefix:
- Later, when creating the DB system, specify a value in the Hostname prefix field.
- Notice that the DB system's Host domain name value is automatically assigned based on the VCN and subnet DNS labels.
The resulting DB system has a fully qualified domain name (FQDN) based on the hostname prefix, VCN label, and subnet label you specify.
For more information, see:
Hostname Restrictions for Using the Internet and VCN Resolver
When you create the VCN, subnet, and DB system, you must carefully set the following identifiers, which are related to DNS in the VCN:
- VCN DNS label.
- Subnet DNS label.
- Hostname prefix for the DB system.
These values make up the node's FQDN:
<hostname_prefix><RAC_node_#>.<subnet_DNS_label>.<VCN_DNS_label>.oraclevcn.com
For multi-node RAC DB systems, a node number is automatically appended after the hostname prefix.
For example:
- Node 1:
dbsys1.ad1.acmevcniad.oraclevcn.com
- Node 2:
dbsys2.ad1.acmevcniad.oraclevcn.com
Requirement for the DB System's Hostname Prefix:
- Recommended maximum: 16 characters.
- Must start with an alphabetical character.
- Cannot be the string localhost.
Requirements for the VCN and Subnet DNS Labels:
- Recommended maximum: 15 characters.
- No hyphens or underscores.
- Recommended: Include the region name in the VCN's name, and include the availability domain name in the subnet's name.
-
The FQDN has a maximum total limit of 63 characters, so set the VCN and subnet DNS labels short enough to meet that requirement. Here is a safe general rule:
<16_chars_max>#.<15_chars_max>.<15_chars_max>.oraclevcn.com
The recommended maximums are not enforced when you create the VCN and subnets. However, the DB system deployment fails if the FQDN has more than 63 characters.
Custom DNS Resolver
A custom DNS resolver is a DNS server that you set up in your on-premises network and maintain yourself. It must resolve the endpoints required by the DB system.
By default, the VCN is configured to use the Internet and VCN resolver. Therefore, if you instead want to use a custom DNS resolver, you must configure the VCN and DHCP options in a different way.
Use a Custom DNS Resolver With Your DB System
As part of the overall network setup, perform these tasks:
- Create the VCN with the recommended DNS settings:
- When creating the VCN, Oracle recommends that you select the check box for Use DNS hostnames in this VCN and then specify a DNS label for the VCN.
- Notice that you cannot change the preceding VCN DNS settings after you create the VCN. They are optional for a custom DNS server, but required if you use the Internet and VCN resolver. Therefore, Oracle recommends that you configure them now in case you later want to use the Internet and VCN resolver.
- Create each subnet with the recommended DNS settings:
- When creating a subnet in the VCN, Oracle recommends that you select select the check box for Use DNS hostnames in this subnet and then specify a DNS label for the subnet.
- Notice that you cannot change the preceding subnet DNS settings after you create the subnet. They are optional for a custom DNS server, but required if you use the Internet and VCN resolver. Therefore, Oracle recommends that you configure them now in case you later want to use the Internet and VCN resolver.
- Edit the default set of DHCP options to use a custom resolver:
- When creating each subnet, configure it to use the VCN's default set of DHCP options.
- Edit the default set of DHCP options so that DNS type is set to Custom resolver. Provide the IP address for at least one DNS server (maximum three). Optionally provide a single search domain (which will automatically be added to the host's
/etc/resolv.conf
file).
- Create the DB system with required DNS entries:
- Later, when creating the DB system, specify a Hostname prefix.
- For the Host domain name: If you selected the check box for Use DNS hostnames in the preceding steps, the Host domain name is automatically generated from the VCN and subnet DNS labels. Otherwise, you must provide a value for the Host domain name.
- Notice that when launching the DB system, an IP address is automatically assigned from the VCN's CIDR block and the address is resolved locally based on the host's
/etc/hosts
file. Your custom DNS resolver does not need to resolve the hostname in advance for the DB system launch to succeed.
For more information, see:
Hostname Restrictions When Using a Custom DNS Resolver
Requirement for the DB System's Hostname Prefix:
- Recommended maximum: 16 characters.
- Must start with an alphabetical character.
- Cannot be the string localhost.
Requirements for the VCN and Subnet DNS Labels:
-
You can provide a value for the DNS labels only if you select the check box for Use DNS hostnames when creating the VCN and subnets. The resulting FQDN for the DB system follows this format:
<hostname_prefix>.<subnet_DNS_label>.<VCN_DNS_label>.oraclevcn.com
- Recommended maximum for each DNS label: 15 characters.
- No hyphens or underscores.
- Recommended: Include the region name in the VCN's name, and include the availability domain name in the subnet's name.
-
The FQDN has a maximum total limit of 63 characters, so set the VCN and subnet DNS labels short enough to meet that requirement. Here is a safe general rule:
<16_chars_max>.<15_chars_max>.<15_chars_max>.oraclevcn.com
The recommended maximums are not enforced when you create the VCN and subnets. However, the DB system deployment fails if the FQDN has more than 63 characters.
Requirements for the DB System's Host Domain Name:
- You can provide a value in the Host domain name field only if you did not select the check box for Use DNS hostnames when creating the VCN and subnets.
- No hyphens or underscores.
- Ensure that the value results in an FQDN that is no longer than 63 characters. Otherwise the DB system deployment will fail.
DNS: Between On-Premises Network and VCN
If you are using the Internet and VCN resolver and want to enable the use of hostnames when on-premises hosts and VCN resources communicate with each other, you can set up an instance in the VCN to be a custom DNS server.
For an example of an implementation of this scenario with the Oracle Terraform provider, see Hybrid DNS Configuration.
Set Up DNS for a DB System
DNS lets you use host names instead of IP addresses to communicate with a DB system.
You can use the Internet and VCN resolver (the DNS capability built into the VCN) as described in DNS in Your Virtual Cloud Network.
Alternatively, you can use your choice of DNS server. You associate the host name and domain name to the public or private IP address of the DB system. You can find the host and domain names and IP addresses for the DB system on the Database page in the Console.
To associate the host name to the DB system's public or private IP address, contact your DNS administrator and request a custom DNS record for the DB system's IP address. For example, if your domain is example.com
and you want to use clouddb1
as the host name, you would request a DNS record that associates clouddb1.example.com
to your DB system's IP address.
If you provide the public IP address to your DNS administrator as described above, you should also associate a custom domain name to the DB system's public IP address:
- Register your domain name through a third-party domain registration vendor, such as register.com.
- Resolve your domain name to the DB system's public IP address, using the third-party domain registration vendor console. For more information, refer to the third-party domain registration documentation.