top of page
alirunutpo

PowerShell – DNS – Create conditional forwarder zone for a specific domain



The Add-DnsServerConditionalForwarderZone cmdlet adds a conditional forwarder to a Domain Name System (DNS) server.You can select the master servers, forwarder time-out, recursion, host computer, replication scope, and directory partition for the conditional forwarder.Conditional forwarders are stored as zones on a DNS server.


This command creates a conditional forwarder zone called contoso.com.The entries are stored in the registry.The command includes IP addresses for one or more master DNS servers.The command uses the PassThru parameter.




PowerShell – DNS – Create conditional forwarder zone




Specifies a length of time, in seconds, that a DNS server waits for a master server to resolve a query.If a server does not resolve the request, the next server in the list is queried until all master servers are queried.After this period, the DNS server can attempt to resolve the query itself.This parameter applies only to the forwarder zone.The minimum value is 0.The maximum value is 15.


Indicates that the server loads existing data for the forwarder from the registry.Conditional forwarders are internally stored as zones.This parameter is not valid for Active Directory-integrated zones.


There are different ways to set up name resolution between two DNS domains. One is creating a secondary zone on your DNS server. A secondary zone contains a complete copy of a DNS zone from another DNS server. For example, I could create a secondary zone for pim.contoso.com on a DNS server running in the ad.contoso.com domain.


Stub zones are copies like secondary zones but contain just Name Server (NS), Start of Authority (SOA), and sometimes glue Host (A) records because stub zones are not authoritative for the domain. Unlike delegation, stub zones can be copies of zones from any domain. For instance, you could create a stub zone for pim.contoso.com on a server in the ad.contoso.com domain. The authoritative DNS server for pim.contoso.com must give permission for the partial zone transfer to the ad.contoso.com DNS server.


DNS forwarders can be used to redirect lookup queries to another DNS server. In Windows Server DNS, you can configure a forwarder to send all queries that cannot be resolved by the local DNS server to another server. In addition to that, Windows Server DNS supports conditional forwarding, which sends lookup queries for a domain to another server without attempting to resolve the query locally.


So which method should you use when configuring DNS name resolution for establishing a trust between two Active Directory forests? The most efficient way to resolve names in pim.contoso.com from ad.contoso.com, and vice versa, is to set up a conditional forwarder in both forests. There is no DNS root server that can be the server for both DNS domains, so delegation cannot be used.


Conditional forwarders are best suited in situations where we know that the IP addresses of authoritative DNS servers are not going to change often. Stub zones are better when authoritative DNS servers frequently change because stub zones do not usually require manual reconfiguration. Conditional forwarders provide non-authoritative responses because the zones are not hosted on the DNS server against which the queries are made. But in a secured AD environment that is OK.


The quickest way to create a conditional forwarder on your DNS server is using PowerShell. Log into the DNS server, open a PowerShell window, and run the command below. In this example, I am logging into ad.contoso.com and want to set up a conditional forwarder for the pim.contoso.com domain. I know the DNS server IP address in the pim.contoso.com domain is 192.168.1.2.


Do not worry if the DNS server you enter for the conditional forwarder is not validated at first. Wait a few minutes and check the properties of the conditional forwarder again. You should see that the server has been validated.


When forwarders are configured on a DNS server, when it receives a DNS query for a name for which it is not authoritative, meaning a query outside the scope of its control, one it has no knowledge of, the server will forward the request to whatever forwarder(s) were configured on it, instead of using root hints. Forwarders will always take precedence over Root Hints.Note: You can also configure your server to forward queries to different servers depending on the DNS suffix that is specified in the DNS query. To do so, configure conditional forwarding appropriately. I will cover this in a later article.


We will start by creating Private DNS Zone which will be linked hub-vnet. For this demo, I am assuming you already have hub-spoke topology setup and connected with on-premise over VPN. create_dns_zone_and_link.ps1 123456789101112131415 $ResourceGroupName = "dns-sandbox"$ZoneName ="virtualmachine.internal"$hubVnet = Get-AzVirtualNetwork ` -Name "hub-vnet"$zone = New-AzPrivateDnsZone ` -ResourceGroupName $ResourceGroupName ` -Name $ZoneName$link = New-AzPrivateDnsVirtualNetworkLink ` -ResourceGroupName $ResourceGroupName ` -ZoneName $ZoneName ` -Name "LinkWithHub" ` -EnableRegistration ` -VirtualNetworkId $hubVnet.Id Here I am taking Zone name as virtualmachine.internal, which means all the virtual machine created in hub-vnet will have dns name like *.virtualmachine.internal. Also I have enabled auto registration for this vnet which means any vm created in this vnet will be auto registered with this zone. Auto registration works only for virtual machines. For all other resources, you can create DNS records manually in the private DNS zone linked to the virtual network. Please note, you can enable auto registration process for vnet only for single zone. Once completed, go to resource group from azure portal, click on newly created on private DNS zone and you should have something like this -


Make sure to check the option Store this conditional forwarder in Active Directory, and replicate as followsSelect the option All DNS servers in the forest from the drop down menu.Not doing so will result in uneven DNS responses from the domain controllers


Now, you need to allow your on-prem network DNS server to conditionally forward DNS queries for the private hosted zone and private AWS resources to the IP addresses of the inbound endpoint created earlier.


In the DNS Domain field, enter the domain name of the private hosted zone and the IP addresses of the endpoints created earlier. Then select the Store this conditional forwarder in Active Directory option to get the conditional forwarder replicated with other DNS servers in the forest.


If you would like to resolve private Amazon resources, domain names such as EC2 instances, EFS, etc., which are not publicly exposed, you can create another conditional forwarder. In this case, the DNS domain you specify should be amazonaws.com.


This post will define conditional forwarding. Then it will explore some of the downsides to too many conditional forwarder DNS rules and look at a real customer example. Finally, it will discuss ways BlueCat can help keep conditional forwarding under control.


Conditional forwarders are DNS servers that only forward queries for a specific domain name. In a standard DNS lookup, the server attempting to resolve it would forward all queries it cannot answer locally. A conditional forwarder is configured to forward queries to a specific forwarder based on the domain name in the query. It essentially adds a name-based condition to the forwarding process.


Using the GUI, you can follow the below steps to create a new zone and point it to the DNS file that you created with the export. Right-click your Forward Lookup Zones folder and choose to create a New Zone. This will launch the New Zone Wizard.


First we get the powerShell object from the parent ID using the split command then the zoneFolderType that we will use later to filter the different types of zones (Forward, Reverse, conditional)Then we get the PowerSHellHost object using


At first we get the ipAddress and name from the JSON output. This is done using JSON.parse which will return an array which in my case will have a single element.The second part is to create a zone attribute from the zone string input to pass it to the add a host (A) workflow.For the end user confort I have also created an action that get all the Forward zones and return these as an array that I use with the presentation properties Predefined list of elements"Finally I place this wotkflow in an XaaS components folder so I can identify the workflows in there as being designed for being used as XaaS components.


We can now request our software blueprint with the DNS host record component. Note that the name and address fields are not shown to the end user since we bound them to the software blueprint. The end user here will select the zone, and the record option. In production we would likely have set constants defaults for these in the software blueprint designer. This screenshot also show the drop down I created for the zones list. Software blueprint with XaaS DNS host record component


Both AD and IPA domains need to be visible to each other. In normal DNS configuration, no changes are required. When the testing DNS domains are not part of shared DNS tree visible to both IPA and AD, customer DNS zone forwarders can be created:


1. Once either option is selected, it will move forward requesting the zone name. Enter in the zone name.2. If the ISP Maintained DNS option is selected, it will request the information for the ISP DNS. If the Server maintains the zone, it will ask for a zone name. Any name can work.3. After clicking next on server maintains the zone, it will then ask if you want to create a new file or use an existing file, inputs the information or file you wish to use and then click next4. Next, It will present you 3 options, 2 if Active Directory is not installed. Heed any warnings it presents, select the option you wish to use, and click Next.5. This section will ask you if it should forward queries to DNS servers with a specific IP or if it shouldn't. Select the option you wish to use, input any needed information, and click next.6. Finally, confirm the details with you, and "Finish" will complete the process. 2ff7e9595c


0 views0 comments

Recent Posts

See All

IORTCW Download

Como jogar Return to Castle Wolfenstein com gráficos e recursos modernos usando iortcw Return to Castle Wolfenstein (RTCW) é um clássico...

Comments


bottom of page