|
| 1 | +# Hybrid DNS Configuration |
| 2 | + |
| 3 | +Oracle Cloud Infrastructure (OCI) customers can configure DNS names for their instances in the Virtual Cloud Network (VCN) as described in [DNS in Your Virtual Cloud Network](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). The DNS names are resolvable only within the VCN using the VCN DNS resolver available at 169.254.169.254. This IP address is only reachable from instances in the VCN. |
| 4 | + |
| 5 | +This document describes the process to enable resolution of DNS names of instances in the VCN from on-premises clients and vice-versa, when the on-premises datacenter is connected with the VCN (through VPN or FastConnect). |
| 6 | + |
| 7 | +## Setup Overview |
| 8 | + |
| 9 | + |
| 10 | +### Case1 – DNS resolution from on-premises to VCN |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +When an on-premises client is trying to connecting to cloud VCN resources: |
| 15 | + |
| 16 | +1. Client machine initiates a DNS query (for db1.exaclient.custvcn.oraclevcn.com) to on-prem DNS server (172.16.0.5) |
| 17 | +2. On-prem DNS server forwards the request to DNS VM in the VCN (10.0.10.15) over private connectivity (VPN or FastConnect) |
| 18 | +3. DNS query forwarded to VCN DNS resolver (169.254.169.254) |
| 19 | +4. DNS VM gets the IP address of the FQDN and send it back to on-prem DNS server |
| 20 | +5. On-prem DNS server gets the IP address and responds to the client machine |
| 21 | + |
| 22 | + |
| 23 | +#### Case2 – DNS resolution from VCN to on-premises |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +When an instance in the VCN is trying to connect to an on-premises instance: |
| 28 | + |
| 29 | +1. Instance in the VCN initiates a DNS query (say app1.customer.net) |
| 30 | +2. The DNS server configured in the DHCP options used by the instance's subnet will receive the DNS request. In this case, the request will be received by DNS VM in the VCN |
| 31 | +3. DNS query forwarded to on-premises DNS server (172.16.0.5) over private connectivity (VPN of Fastconnect) |
| 32 | +4. DNS VM gets the response and sends it back to client |
| 33 | + |
| 34 | + |
| 35 | +## Configuration Steps |
| 36 | + |
| 37 | +Below are the steps to achieve this configuration |
| 38 | + |
| 39 | +1. Create a DNS VM in the VCN |
| 40 | + 1. Create a security list with following rules: |
| 41 | + * allow udp 53 (for DNS queries) from clients (VCN address space + On-prem address space) |
| 42 | + * allow tcp 22 (for ssh access) from Internet or on-prem address space |
| 43 | + * allow ICMP type3 from same sources as rule above (for ssh access) |
| 44 | + |
| 45 | + 2. Create a DHCP options set: |
| 46 | + * Set DNS type as "Internet and VCN resolver" |
| 47 | + |
| 48 | + |
| 49 | +2. Create a subnet, which uses the security list and DHCP options set created above. |
| 50 | +3. Launch a VM with latest 'Oracle Linux 7.4' image into this subnet |
| 51 | +4. Install & Configure named |
| 52 | +``` |
| 53 | + $ sudo yum install bind |
| 54 | + $ sudo firewall-cmd --permanent --add-port=53/udp |
| 55 | + $ sudo firewall-cmd --permanent --add-port=53/tcp |
| 56 | + $ sudo /bin/systemctl restart firewalld |
| 57 | + $ cat > /etc/named.conf |
| 58 | +options { |
| 59 | + listen-on port 53 { any; }; |
| 60 | + allow-query { localhost; 10.0.0.0/16; 172.16.0.0/16; }; |
| 61 | + forward only; |
| 62 | + forwarders { 169.254.169.254; }; |
| 63 | + recursion yes; |
| 64 | +}; |
| 65 | +
|
| 66 | +zone "customer.net" { |
| 67 | + type forward; |
| 68 | + forward only; |
| 69 | + forwarders { 172.16.0.5; 172.16.31.5; }; |
| 70 | +}; |
| 71 | +
|
| 72 | +<hit ctrl-D> |
| 73 | +
|
| 74 | + * $ sudo service named restart |
| 75 | +``` |
| 76 | + |
| 77 | +5. Configure forwarding on the on-prem DNS servers for 'VCN domain' (custvcn.oraclevcn.com) to be forwarded to DNS VM in the VCN. |
| 78 | + Below is a snapshot of the setup in an AD/DNS server. |
| 79 | +  |
| 80 | + |
0 commit comments