Reader small image

You're reading from  Azure Networking Cookbook, Second Edition - Second Edition

Product typeBook
Published inDec 2020
PublisherPackt
ISBN-139781800563759
Edition2nd Edition
Tools
Concepts
Right arrow
Author (1)
Mustafa Toroman
Mustafa Toroman
author image
Mustafa Toroman

Mustafa Toroman is a solution architect focused on cloud-native applications and migrating existing systems to the cloud. He is very interested in DevOps processes and cybersecurity, and he is also an Infrastructure as Code enthusiast and DevOps InstituteAmbassador. Mustafa often speaks at international conferences about cloud technologies. He has been an MVP for Microsoft Azure since 2016 and a C# Corner MVP since 2020. Mustafa has also authored several books about Microsoft Azure and cloud computing, all published by Packt.
Read more about Mustafa Toroman

Right arrow

6. DNS and routing

Azure DNS allows us to host Domain Name System (DNS) domains in Azure. When using Azure DNS, we use Microsoft infrastructure for the name resolution, which results in fast and reliable DNS queries. Azure DNS infrastructure uses a vast number of servers to provide great reliability and availability of service. Using Anycast networking, each DNS query is answered by the closest available DNS server to provide a quick reply.

We will cover the following recipes in this chapter:

  • Creating an Azure DNS zone
  • Creating an Azure Private DNS zone
  • Integrating a virtual network with a private DNS zone
  • Creating a new record set in Azure DNS
  • Creating a route table
  • Changing a route table
  • Associating a route table with a subnet
  • Dissociating a route table from a subnet
  • Creating a new route
  • Changing a route
  • Deleting a route

Technical requirements

For this chapter, the following is required:

  • An Azure subscription

Creating an Azure DNS zone

To start using Azure DNS, we must first create a DNS zone. A DNS zone holds a DNS record for a specific domain, and it can hold records for a single domain at a time. A DNS zone will hold DNS records for this domain and possible subdomains. DNS name servers are set up to reply to any query on a registered domain and point to a destination.

Getting ready

Before you start, open your browser and go to the Azure portal via https://portal.azure.com.

How to do it...

In order to create a new Azure DNS zone with the Azure portal, we must follow these steps:

  1. In the Azure portal, select Create a resource and choose DNS Zone under Networking services (or search for DNS Zone in the search bar).
  2. In the new pane, we must enter information for the Subscription, Resource group, and Name fields. If we select an existing resource group, the region will automatically be the same as the one for the resource group selected. Optionally, we can mark this...

Creating an Azure Private DNS zone

An Azure Private DNS zone operates very similarly to a DNS zone. However, instead of operating on public records, it operates inside a virtual network. It is used to resolve custom names and domains inside your Azure virtual network.

Getting ready

Before you start, open your browser and go to the Azure portal at https://portal.azure.com.

How to do it...

In order to create a new Azure DNS zone with the Azure portal, we must follow these steps:

  1. In the Azure portal, select Create a resource and choose Private DNS Zone under Networking services (or search for Private DNS Zone in the search bar).
  2. In the new pane, we must enter information for the Subscription, Resource group, and Name fields. If we select an existing resource group, the region will automatically be the same as the one for the resource group selected. The name must be an FQDN:
    Adding information in the Basics pane to create a new Azure private DNS zone

Figure 6.2: Creating a new private DNS zone with the Azure portal

How it works...

Integrating a virtual network with a private DNS zone

When a private DNS zone is created, it is a standalone service that doesn't do much on its own. We must integrate it with a virtual network in order to start using it. Once integrated, it will provide DNS inside the virtual network.

Getting ready

Before you start, open the browser and go to the Azure portal at https://portal.azure.com.

How to do it...

In order to add a new record to the DNS zone, we must use the following steps:

  1. In the Azure portal, locate Private DNS Zone.
  2. In Private DNS Zone, select Virtual network links and click Add:
    Clicking on the Add option to create a virtual network link

    Figure 6.3: Adding a virtual network link

  3. In the new pane, fill in Link name, then select values for the Subscription and Virtual network fields (only virtual networks in the selected subscription will be available). Alternatively, we can provide the resource ID of our virtual network, rather than selecting options from the drop-down menu:
    Adding a virtual network link by providing various details

Figure 6.4: Adding...

Creating a new record set in Azure DNS

When creating a DNS zone, we define what domain we're going to hold records for. A DNS zone is created for a root domain defined with an FQDN. We can add additional subdomains and add records to hold information on other resources on the same domain.

Getting ready

Before you start, open the browser and go to the Azure portal via https://portal.azure.com.

How to do it...

In order to add a new record to the DNS zone, we must use the following steps:

  1. In the Azure portal, locate DNS zone.
  2. In Overview, select the option for adding a record set:
    Clicking on the Record set option to add a new record set in the DNS zone

    Figure 6.5: Adding a record set in DNS zone

  3. A new pane will open. Enter the name of the subdomain to which you want to add a record:
    Entering the name of the subdomain for the record set

    Figure 6.6: Adding a subdomain for the record

  4. We need to select the type of record we want to add. The options are A, AAAA, CNAME, MX, NS, SRV, TXT, and PTR. The most common record type is A, so let's select that one:
    Selecting the type of record we want to add to the record set

    Figure 6.7: Selecting...

Creating a route table

Azure routes network traffic in subnets by default. However, in some cases, we want to use custom traffic routes to define where and how traffic flows. In such cases, we use route tables. A route table defines the next hop for our traffic and determines where the network traffic needs to go.

Getting ready

Before you start, open the browser and go to the Azure portal via https://portal.azure.com.

How to do it...

In order to add a new record to the DNS zone, we must use the following steps:

  1. In the Azure portal, select Create a resource and choose Route Table under Networking services (or search for route table in the search bar).
  2. In the new pane, we need to select options for Subscription, Resource group, and Region, and provide the name of the route table. Optionally, we can define whether we want to allow gateway route propagation (which is enabled by default):
    Creating a route table by selecting various options in the Basics pane

Figure 6.10: Creating a route table

How it works...

Network routing...

Changing a route table

As mentioned in the previous recipe, creating a new route table will result in an empty resource. Once a resource is created, we can change the settings as needed. Before we configure the routes and subnets associated with the route table, the only setting we can change is the Border Gateway Protocol (BGP) route propagation. We may change other settings after creation as well.

Getting ready

Before you start, open the browser and go to the Azure portal via https://portal.azure.com.

How to do it...

In order to change a route table, we must do the following:

  1. In the Azure portal, locate Route table.
  2. Under Settings, we may change the Propagate gateway routes settings in the Configuration pane at any time:
    Option to change the Propagate gateway routes settings

Figure 6.11: Option to change the Propagate gateway routes settings

How it works...

Under the settings of the route table, we can disable or enable gateway route propagation at any time. This option, if disabled, prevents on-premises...

Associating a route table with a subnet

When a route table is created, it doesn't do anything until it's properly configured. There are two things we need to address: which resources are affected, and how. To define which resources are affected, we must make an association between a subnet and a route table.

Getting ready

Before you start, open the browser and go to the Azure portal via https://portal.azure.com.

How to do it...

In order to associate a subnet with a route table, we must do the following:

  1. In the Azure portal, locate Route table.
  2. Under Settings, select the Subnets option. In the Subnets pane, select the Associate option to create a new association:
    Clicking on the Associate option to create a new association

    Figure 6.12: Creating a new association

  3. A new pane will open. There are two options available—selecting a virtual network and choosing a subnet that we want to associate the route table with. First, we must select Virtual network. Selecting this option will list all the available...

Dissociating a route table from a subnet

After we create an association and rules, those rules will apply to all resources on the associated subnet. If we want rules to no longer apply to a specific subnet, we can remove the association.

Getting ready

Before you start, open the browser and go to the Azure portal via https://portal.azure.com.

How to do it...

In order to remove the association between the subnet and the route table, we must do the following:

  1. In the Azure portal, locate Route table.
  2. Under Settings, select the Subnets option, and select the subnet you want to remove:
    Selecting the subnet that we want to remove

    Figure 6.17: Selecting a subnet for removal

  3. The subnet configuration pane will open. Select the Route table option. Note that this actually opens a subnet configuration. It's a common mistake to confuse this pane with the association and to choose the Delete option. This will not only remove the association but also remove the subnet altogether:
    The subnet configuration pane

    Figure 6.18: Subnet configuration...

Creating a new route

After we create a route table and the associated subnets, there is still a piece missing. We defined the route table that will be affected with subnet association, but we're missing the part that defines how it will be affected. We define how associated subnets are affected using rules called routes. Routes define traffic routes, stating where specific traffic needs to go. If the default route for specific traffic is the internet, we can change this and reroute the traffic to a specific IP or subnet.

Getting ready

Before you start, open the browser and go to the Azure portal via https://portal.azure.com.

How to do it...

In order to create a new route, we must do the following:

  1. In the Azure portal, locate Route table.
  2. In the Route table pane, under Settings, select Routes. Select Add to add a new route:
    Clicking on the Add option to add the new route

    Figure 6.21: Adding a new route

  3. In the new pane, we need to define values for the Route name and Address prefix (in CIDR format)...

Changing a route

Route requirements may change over time. In such cases, we can either remove the route or edit it, depending on our needs. If a route needs to be adjusted, we can select the option to change the route and apply the new traffic flow at any time.

Getting ready

Before you start, open the browser and go to the Azure portal via https://portal.azure.com.

How to do it...

In order to change the existing route, we need to do the following:

  1. In the Azure portal, locate Route table.
  2. Under Settings, select Routes and select the route you want to change from the list of available routes:
    Selecting the route that we want to change

    Figure 6.24: Changing an available route

  3. A new pane will open. We can change the Address prefix (for the destination IP range) and Next hop type settings. If the Next hop type option is a virtual appliance, an option for Next hop address will be available:
    Editing the route by changing Address prefix and Next hop type

Figure 6.25: Option for Next hop address

How it works...

The requirements for a route may change over...

Deleting a route

As we have already mentioned, route requirements may change over time. In some cases, rules are no longer applicable and we must remove them. In such cases, changing the route will not complete the task and we will need to remove the route completely. This task may be completed by deleting the route.

Getting ready

Before you start, open the browser and go to the Azure portal via https://portal.azure.com.

How to do it...

In order to delete a route, we must do the following:

  1. In the Azure portal, locate the Route table link.
  2. Under Settings, select Routes and then select the route you want to delete:
    Selecting the route that we want to delete

    Figure 6.26: Deleting an existing route

  3. A new pane will open. Select the Delete option and confirm your action:
    Clicking on the Delete option to delete the existing route

    Figure 6.27: Selecting the Delete option

  4. After this action has been confirmed, you will return to the previous pane and the deleted route will no longer be listed:
    The successful deletion of a route

Figure 6.28: The successful deletion of a route

How it works...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Azure Networking Cookbook, Second Edition - Second Edition
Published in: Dec 2020Publisher: PacktISBN-13: 9781800563759
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Mustafa Toroman

Mustafa Toroman is a solution architect focused on cloud-native applications and migrating existing systems to the cloud. He is very interested in DevOps processes and cybersecurity, and he is also an Infrastructure as Code enthusiast and DevOps InstituteAmbassador. Mustafa often speaks at international conferences about cloud technologies. He has been an MVP for Microsoft Azure since 2016 and a C# Corner MVP since 2020. Mustafa has also authored several books about Microsoft Azure and cloud computing, all published by Packt.
Read more about Mustafa Toroman