Skip to content

Commit 0f4d976

Browse files
Added two examples - One to configure NAT instance for Internet access from private instances, another for a DNS VM to allow on-premises network to query DNS hostnames in the VCN (#295)
- Added example to configure NAT instance for Internet access from private instances - Added example to configure Hybrid DNS instance to allow on-premises clients to resolve DNS names of instances in the VCN
1 parent 0e3542a commit 0f4d976

File tree

12 files changed

+792
-0
lines changed

12 files changed

+792
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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+
![On-premises to VCN](images/architecture-onprem-to-vcn.png)
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+
![VCN to on-premises](images/architecture-vcn-to-onprem.png)
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 &#39;VCN domain&#39; (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+
![AD conditional forwarding setup](images/ad-cond-forwarding-setup.png)
80+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ___ ____ _ ____ _ _____
2+
# / _ \| _ \ / \ / ___| | | ____|
3+
# | | | | |_) | / _ \| | | | | _|
4+
# | |_| | _ < / ___ | |___| |___| |___
5+
# \___/|_| \_/_/ \_\____|_____|_____|
6+
***
7+
This example creates a VCN with two management subnets, in two different availability domains. It then launches an instance in each of these management subnets and configures them to perform DNS forwarding for DNS hostnames in the VCN, and the DNS hostnames in the on-premises network. See ![Hybrid DNS configuration using DNS VMs in VCN.md](Hybrid-DNS-configuration-using-DNS-VM-in-VCN.md) for more details on the setup.
8+
9+
To enable resolution of DNS hostnames from on-premises, you will need to update the default DHCP options of the VCN to use the DNS VMs as the DNS resolvers.
10+
11+
### Using this example
12+
* Update env-vars with the required information. Most examples use the same set of environment variables so you only need to do this once.
13+
* Source env-vars
14+
* `$ . env-vars`
15+
16+
Once the environment is built, the DNS VMs will be able to query the DNS hostnames within the VCN. You can run 'nslookup <fqdn-of-an-instance-in-vcn> <DNS VM IP>' from any instance in the VCN to verify this. By specifying an IP address at the end of the 'nslookup' command, the DNS query is sent to the DNS service at that IP address.
17+
18+
### Files in the configuration
19+
20+
#### `env-vars`
21+
Is used to export the environmental variables used in the configuration. These are usually authentication related, be sure to exclude this file from your version control system. It's typical to keep this file outside of the configuration.
22+
23+
Before you plan, apply, or destroy the configuration source the file -
24+
`$ . env-vars`
25+
26+
#### `dns.tf`
27+
Defines the resources.
28+

0 commit comments

Comments
 (0)