Skip to content
Ask AI

DNS Configuration Guide

The Domain Name System (DNS) is one of the core services of the internet. It functions as a distributed database that maps domain names to IP addresses, enabling users to access the internet more conveniently. Through its hierarchical naming architecture, DNS achieves unified management and resolution of global domain names, providing users with an intuitive and easy-to-remember method for accessing websites.

The advantages of DNS include an efficient domain name resolution mechanism, a distributed system architecture, robust caching capabilities, and reliable redundancy backups. Compared to traditional host file-based resolution methods, DNS is more efficient, reliable, and scalable, delivering a seamless internet access experience for users.

OperationCommandDescription
Enter the system configuration viewconfigure terminal-
Enable DNS relay functiondns relay enable-
OperationCommandDescription
Enter the system configuration viewconfigure terminal-
Configure DNS Domain Name Serverdns server A.B.C.DConfigure server IP, such as 8.8.8.8
OperationCommandDescription
Enter the system configuration viewconfigure terminal
Enter DNS query group configuration viewdns query-group String: Configure DNS request list name
Configure the domain name that needs to be queriedquery Hostname: Configure domain name, maximum length 64 bytes
OperationCommandDescription
Enter the system configuration viewconfigure terminal
Enter ACL configuration viewaccess-list {L3|L3V6} {ingress|egress}Enter ACL configuration view
Configure corresponding DNS ACL matching fields{src-dns-group|dst-dns-group} string:Configure the DNS request list names to match, note that src dns group | dst dns group cannot be matched with src ip | dst ip together
OperationCommand
Display DNS servershow dns server

Network Requirements

Enterprise networking hopes to set firewall rules through devices, such as prohibiting all traffic originating from a certain domain group from entering and accessing the intranet from the device. In order to ensure that firewall rules can be correctly configured and effective, DNS ACL rules need to be configured as follows:

Procedure

sonic(config)# dns relay enable
sonic(config)# dns server 114.114.114.114
sonic(config)# dns query-group test
sonic(config-dns-query-group-test)# query www.baidu.com
sonic(config-dns-query-group-test)# query www.taobao.com
sonic(config-dns-query-group-test)# exit
sonic(config)# access-list L3 test1 ingress
sonic(config-L3-acl-test1)# rule 1 src-dns-group test packet-action deny
sonic(config-L3-acl-test1)# exit
sonic(config)# interface ethernet 3
sonic(config-if-3)# acl test1
sonic(config-if-3)# exit