How DNS Query Filtering on AWS Works and How to Configure It (2024)

How DNS Query Filtering on AWS Works and How to Configure It (1)

·

Follow

Published in

AWS in Plain English

·

6 min read

·

2 days ago

--

DNS (Domain Name System) is a crucial component of network management, translating human-friendly domain names into IP addresses that machines use to communicate. AWS provides robust tools to manage and filter DNS queries, enhancing security and performance for your applications. In this article, we’ll explore how DNS query filtering on AWS works and provide a step-by-step guide on how to configure this solution.

How DNS Query Filtering on AWS Works and How to Configure It (3)

Understanding DNS Query Filtering on AWS

DNS query filtering helps control which DNS queries are allowed or blocked based on predefined rules. This is particularly useful for enhancing security by preventing access to malicious domains, enforcing compliance, and improving network performance by blocking unnecessary or harmful queries.

How DNS Query Filtering on AWS Works and How to Configure It (4)

Key Components

  1. Amazon Route 53: A scalable and highly available DNS web service that translates domain names into IP addresses.
  2. Route 53 Resolver: A recursive DNS service that answers DNS queries for domain names.
  3. Route 53 Resolver DNS Firewall: Allows you to filter and manage DNS queries for your VPC (Virtual Private Cloud).

How DNS Query Filtering Works

  1. Define DNS Firewall Rule Groups: Rule groups consist of one or more rules that specify which domains to allow or block.
  2. Associate Rule Groups with VPCs: Apply these rule groups to the VPCs where you want to enforce DNS query filtering.
  3. Monitor and Manage DNS Queries: Use AWS CloudWatch and other monitoring tools to review DNS query logs and adjust rules as needed.

Prerequisites

Before delving into the lab setup, ensure that you have the following prerequisites in place:

  • An AWS account with the appropriate permissions to create and manage network resources.
  • A foundational understanding of Amazon VPC concepts, EC2, and AWS services.
  • Deployment of a VPC, public subnet, and internet gateway should be completed prior to commencing this lab.

To filter outbound DNS traffic from your VPC, we need to create a DNS Firewall.

Navigate to the DNS Firewall console:

  • Open the AWS Management Console.
  • Go to the VPC service >> DNS Firewall
How DNS Query Filtering on AWS Works and How to Configure It (5)

Create a Domain List:

A Domains List is a collection of domain names that we define and manage. It serves as the basis for creating DNS Firewall rules that allow or block DNS queries

  • In the left navigation pane, choose “DNS Firewall.”
  • Click “Domain List” and “Add Domain List”

Note: Here we will list all the domains that we want to block.

  • Enter a name, and the list of domains to block.
  • Click on “Add Domain List”
How DNS Query Filtering on AWS Works and How to Configure It (6)

Create a Rule Group:

A rule group is a collection of rules that specify the actions to take on DNS queries. Rule groups allow you to organize and manage multiple DNS Firewall rules efficiently.

  • Go back to “DNS Firewall”
  • Click “Rule Groups” >> “Create Rule Group”
  • Enter a name and click on “Add rule group”
How DNS Query Filtering on AWS Works and How to Configure It (7)
  • Once the group is created, go the “Rules” and click on “Add Rule”
How DNS Query Filtering on AWS Works and How to Configure It (8)
  • Enter a Name
  • At “Configurations” choose the Domain List created on the previous step.
  • At the “Action” choose “Block”
  • As for the Response, choose “NXDOMAIN”
  • Click on “Add Rule”
How DNS Query Filtering on AWS Works and How to Configure It (9)
How DNS Query Filtering on AWS Works and How to Configure It (10)

At the Rule Group created on Step one, navigate to Associated VPCs:

  • Click “Associate VPC.”
How DNS Query Filtering on AWS Works and How to Configure It (11)
  • Choose the VPC you want to associate with this rule group.

Complete the Association:

  • Click “Associate” to apply the rule group to the selected VPC.
How DNS Query Filtering on AWS Works and How to Configure It (12)

Enable Query Logging:

  • In the Route 53 console, go to “Resolver” >> “VPCs”
How DNS Query Filtering on AWS Works and How to Configure It (13)
  • Click at the VPC associated with the Rule Group from step 2.
  • At “Query Logging Configurations” click “Configure Query Logging”
How DNS Query Filtering on AWS Works and How to Configure It (14)
  • Enter a name for the logging configuration
  • For this simple lab we will use “CloudWatch Logs Group”
  • Create a new log group, then click at “Create query logging”
How DNS Query Filtering on AWS Works and How to Configure It (15)

Deploy a EC2 Instance and test the DNS request:

Note: Refer to the following guide on how to deploy an EC2 Instace: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html

Once your instance is deployed, connect to it via SSH or “EC2 Instance Connect”, and run the following commands at the CLI:

nslookup amazon.com
nslookup gaming.amazon.com
nslookup google.com
nslookup nytimes.com

The result should be similar to:

[ec2-user@ip-10–0–3–76 ~]$ nslookup amazon.com
Server: 10.0.0.2
Address: 10.0.0.2#53
** server can't find amazon.com: NXDOMAIN

[ec2-user@ip-10–0–3–76 ~]$ nslookup gaming.amazon.com
Server: 10.0.0.2
Address: 10.0.0.2#53
** server can't find gaming.amazon.com: NXDOMAIN

[ec2-user@ip-10–0–3–76 ~]$ nslookup google.com
Server: 10.0.0.2
Address: 10.0.0.2#53
Non-authoritative answer:
Name: google.com
Address: 142.251.179.101
Name: google.com
Address: 142.251.179.102
Name: google.com
Address: 142.251.179.113
Name: google.com
Address: 142.251.179.138
Name: google.com
Address: 142.251.179.139
Name: google.com
Address: 142.251.179.100
Name: google.com
Address: 2607:f8b0:4004:c06::8a
Name: google.com
Address: 2607:f8b0:4004:c06::8b
Name: google.com
Address: 2607:f8b0:4004:c06::64
Name: google.com
Address: 2607:f8b0:4004:c06::65

[ec2-user@ip-10–0–3–76 ~]$ nslookup nytimes.com
Server: 10.0.0.2
Address: 10.0.0.2#53
** server can't find nytimes.com: NXDOMAIN

As you can see from the output, we received a NXDOMAIN response for those domains blocked.

Review Logs in CloudWatch:

  • Open the CloudWatch console.
  • Navigate to “Log Groups” and find the log group you specified.
  • Click on “Search all Logs”
How DNS Query Filtering on AWS Works and How to Configure It (16)
  • Review the DNS query logs to ensure your rule group is functioning as expected.
How DNS Query Filtering on AWS Works and How to Configure It (17)
  • Regularly Update Rule Groups: Keep your rule groups updated to include new threats and domains as they are identified.
  • Monitor DNS Query Logs: Continuously monitor logs to detect and respond to suspicious activity.
  • Implement Least Privilege: Apply the principle of least privilege when creating rules, allowing only necessary domains and blocking everything else by default.

DNS query filtering on AWS using Route 53 and the Route 53 Resolver DNS Firewall is a powerful tool for enhancing the security and performance of your network. By following the steps outlined in this guide, you can effectively manage and control DNS queries within your AWS environment, ensuring a safer and more reliable infrastructure.

Thank you for being a part of the In Plain English community! Before you go:

  • Be sure to clap and follow the writer ️👏️️
  • Follow us: X | LinkedIn | YouTube | Discord | Newsletter
  • Visit our other platforms: CoFeed | Differ
  • More content at PlainEnglish.io
How DNS Query Filtering on AWS Works and How to Configure It (2024)

FAQs

How exactly DNS query works? ›

A DNS query is a message that a client sends to the DNS server. It contains a list of questions that the DNS server answers. A DNS query can contain multiple questions that the server will reply to, but a server might also reply with its own additional information.

How does the AWS DNS firewall work? ›

Route 53 Resolver DNS Firewall lets you create “blocklists” for domains you don't want your VPC resources to communicate with via DNS. You can also take a stricter, “walled-garden” approach by creating “allowlists” that permit outbound DNS queries only to domains you specify.

How to enable DNS query logging? ›

Here is how you enable DNS logging on Windows:
  1. Use Windows-R to open the run box on the system.
  2. Type eventvwr. ...
  3. Navigate the following path: Applications and Service Logs > Microsoft > Windows > DNS Client Events > Operational.
  4. Right-click on Operational, and select Enable Log.
Dec 16, 2020

How does DNS filtering work? ›

Before the employee's computer loads the website, it first sends a query to the company's DNS resolving service, which uses DNS filtering. If that malicious site is on that company's blocklist, the DNS resolver will block the request, preventing malicious-website.com from loading and thwarting the phishing attack.

What are the four DNS queries? ›

There are four types of DNS queries: recursive, iterative, authoritative, and non-authoritative.

What part of AWS handles their DNS? ›

Use the AWS Management Console or the API to register your new domain name. Route 53 automatically creates a hosted zone that stores DNS records for your domain. You also receive four Route 53 name servers across four different Top-Level Domains (TLDs) to help ensure a high level of availability.

How do I change DNS settings in AWS? ›

To update your DNS settings for AD Connector

On the Directory details page, choose the Network & Security tab. Scroll down to the Existing DNS settings section and choose Update. In the Update existing DNS addresses dialog, type the updated DNS IP addresses, and then choose Update.

How do I run a DNS query? ›

You have to run a simple line in the Windows command prompt to perform the DNS request. Follow these steps to do it right: Open the command prompt. Type nslookup followed by the IP address and press 'Enter.

What is an example of a DNS query? ›

A DNS query is a request for information from a DNS server. For example, each time you enter a domain name into your browser, such as example.com , your browser makes a DNS query to locate the IP address for that domain name.

What is the structure of a DNS query? ›

Structure of DNS query

The question section specifies the domain name being queried and the type of record sought (e.g., A, MX, etc). Following the question, the answer section provides the requested information if available, while the authority section lists authoritative name servers for the queried domain.

What triggers a DNS query? ›

The client sends a query message to the DNS server that contains a fully qualified domain name (FQDN), a query type, such as a particular resource record the client requires, and the class for the domain name, which is typically the Internet (IN) class.

Why is my DNS query not working? ›

If the DNS error is being caused by your firewall or antivirus software, try disabling them temporarily. After turning them off manually, try opening the browser again to see if it's working. If that did the trick, be sure to reactivate your firewall again right away.

How do I trace my DNS query? ›

Alternatively, you could try using nslookup, also in the command line to perform a DNS query independent of your local DNS cache. Nslookup will return both the name and address of the DNS server that your machine connects to as well as the fully qualified domain name and the IP address it resolves to.

How does DNS resolver work? ›

The DNS resolver is the first stop in the DNS lookup, and it is responsible for dealing with the client that made the initial request. The resolver starts the sequence of queries that ultimately leads to a URL being translated into the necessary IP address.

How does a DNS check work? ›

A DNS lookup is the query journey initiated each time you enter a URL into your web browser's address bar. Your DNS recursive resolver, also known as a recursor or resolver, will first check to see if the requested information is in cache.

How does DNS iterative query mechanism works? ›

An iterative DNS query is a request for a website name or URL. However, with this query type, the domain name system (DNS) server does not fetch the complete answer for the query. Rather, it provides a referral to other DNS servers that might have the answer.

Top Articles
Sermons about Genesis 4713 4727
Charismatic Charlie Wade Novel Chapter 6198 – MTL Novels
Tales From The Crib Keeper 14
Wcco Crime News
Scooter Tramps And Beer
Lux Nails Columbia Mo
Munsif Epaper Urdu Daily Online Today
Eso Mud Ball Miscreant
Ms Ortencia Alcantara Instagram
Erhöhte Gesundheitsgefahr durch Zuckeraustauschstoff Erythrit?
Craigslist Pets Longview Tx
Craigslist Free Stuff Columbus Ga
gameplay:shiny_pokemon_and_luck [PokéRogue Wiki]
Guy I'm Talking To Deleted Bumble
Barefoot Rentals Key Largo
SAP Secure Login Service for SAP GUI Now Available
92801 Sales Tax
Which Statement About These Two Restaurant Meals Is Correct
Ticket To Paradise Showtimes Near Cmx Daytona 12
Think Up Elar Level 5 Answer Key Pdf
Flappy Bird Cool Math Games
Tinyzonetv.to Unblocked
Craigslist Jobs Glens Falls Ny
Car Complaints Toyota
Linktree Teentinyangel
Punishment - Chapter 1 - Go_mi - 鬼滅の刃
Uga Im Leagues
55000 Pennies To Dollars
3850 Colonial Blvd Suite 100 Fort Myers Fl 33966
Aunt Nettes Menu
Zions March Labradors
La Times Jumble Answer Today
Don Wallence Auto Sales Reviews
Erste Schritte für deine Flipboard Magazine — Ein Blogger-Guide -
Lo que necesitas saber antes de desrizarte el cabello
Dl Delta Extranet
Trailmaster Fahrwerk - nivatechnik.de
Jodie Sweetin Breast Reduction
Lohud Rockland Obituaries
SYSTEMAX Software Development - PaintTool SAI
Ruth Chris 3 Course Meal
Edye Ellis Obituary
Metro By T Mobile Sign In
Realidades 2 Capitulo 2B Answers
Clea-Lacy Juhn: Schwerer Schicksalsschlag kurz nach Zwillingsgeburt
Kieaira.boo
Culver's Flavor Of The Day Wilson Nc
Walgreens Bunce Rd
World of Warcraft Battle for Azeroth: La Última Expansión de la Saga - EjemplosWeb
Daily Cryptoquip Printable
Codex Genestealer Cults 10th Edition: The Goonhammer Review
Latest Posts
Article information

Author: Msgr. Benton Quitzon

Last Updated:

Views: 5744

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Msgr. Benton Quitzon

Birthday: 2001-08-13

Address: 96487 Kris Cliff, Teresiafurt, WI 95201

Phone: +9418513585781

Job: Senior Designer

Hobby: Calligraphy, Rowing, Vacation, Geocaching, Web surfing, Electronics, Electronics

Introduction: My name is Msgr. Benton Quitzon, I am a comfortable, charming, thankful, happy, adventurous, handsome, precious person who loves writing and wants to share my knowledge and understanding with you.