What is dns records in linux

Check DNS Records with Examples – PTR MX SRV CNAME AAAA

DNS is a very critical part of the Linux operation world. We will cover the most common DNS records today. All domains are required to have at least a few essential DNS records for a user to be able to access their website using a domain name.

DNS Records

Here are 4 commonly used DNS records.

  1. A record – A record is used to map a domain (e.g., mystunningwebsite.com) or a sub-domain (e.g., blog.mystunningwebsite.com) to an IP address or many ips.
  2. PTR record – Provides a domain name in reverse-lookups. eg. (23.236.62.147 — www.howtouselinux.com)
  3. CNAME record – also known as canonical name records, are used to create aliases that point to other names. They are commonly used to map WWW, FTP and MAIL sub-domains to a domain.
  4. MX record – MX (Mail Exchange) records control how incoming email is routed for your domain.

DNS A Record

A record is the most commonly used record type. If we have ever set up a website, we most likely configured an A record before. These records are the most basic form of a DNS record and almost all other record types we will discuss are based off of A record functionality.

When we set up an A record, we will specify an FQDN (Fully Qualified Domain Name) to be pointed to an IP address. If we are creating a website, then the IP address will usually be given to you by our DNS registrar when we purchased our domain name.

DNS CNAME Record

CNAME records, also known as alias records, point a hostname to another hostname or FQDN. These records are typically used to point multiple hosts to a single location, without having to specifically assign an A record to each hostname.

For example: if we moved our blog from news.example.com to blog.example.com, then we would use a CNAME record. CNAME records can also be used to point a hostname to another domain or external hostname.

To resolve a CNAME record, the name server must behave slightly different than it would with a normal query of another record type. When a name server looks up a name and finds it is a CNAME record, it replaces the name with the canonical name (the target of the CNAME) and looks up the new name. In a sense, a CNAME lookup performs two queries to reach the final resolution.

DNS MX record

A mail exchanger record (MX record) specifies the mail server responsible for accepting email messages on behalf of a domain name. It is possible to configure several MX records, typically pointing to an array of mail servers for load balancing and redundancy.

Читайте также:  Vmware linux установить vmware tools

DNS PTR Record

DNS PTR records are used in reverse DNS lookups. When a user attempts to reach a domain name in their browser, a DNS lookup occurs, matching the domain name to the IP address. A reverse DNS lookup is the opposite of this process: it is a query that starts with the IP address and looks up the domain name.

More DNS Records

Here are 6 more DNS records.

  1. TXT record – TXT (text) records are used to provide textual information about a domain (like the name of the host and contact details) to external sources.
  2. SPF record – Sender Policy Framework (SPF) is an email validation system designed to prevent email spam by verifying sender IP addresses.
  3. NS record – NS records define which name servers contain the DNS records for a domain.
  4. SOA record – Stores admin information about a domain.
  5. SRV record – SRV records (also known as service records) are responsible for localizing specific domain-related services such as FTP, HTTP, and SIP.
  6. AAAA record – maps a domain name to the IP address (Version 6) of the computer hosting the domain. An AAAA record is used to find the IP address of a computer connected to the internet from a name.

DNS TXT Record

The Text record (TXT) allows us to add both human and machine-readable instructions. This record type serves a variety of purposes, including email spam prevention, domain ownership verification, and framework policies, as well as providing point-of-contact and general information about the domain.

DNS SRV Record

SRV records help with service discovery. For example, SRV records are used in Internet Telephony to define where a SIP service may be found.

An SRV record typically defines a symbolic name and the transport protocol used as part of the domain name. It defines the priority, weight, port, and target for the service in the record content.

DNS AAAA Record

AAAA records are DNS records that use an IP address to connect a domain to a website, and can be added to your domain at any time. They are similar to A records, but AAAA records point to 128–bit/IPv6 addresses, instead of the IPv4 addresses used by A records.

David is a Cloud & DevOps Enthusiast. He has years of experience as a Linux engineer. He had working experience in AMD, EMC. He likes Linux, Python, bash, and more. He is a technical blogger and a Software Engineer. He enjoys sharing his learning and contributing to open-source.

howtouselinux.com is dedicated to providing comprehensive information on using Linux.

We hope you find our site helpful and informative.

Источник

4 ways to Check DNS Record with Dig Command in Linux

The most efficient way to check DNS records in Linux is using dig command. This command will send the DNS query to the name servers listed in the resolver(/etc/resolv.conf). It allows you to query information about various DNS records, including A record, MX record CNAME record etc.

The following commands can be used to check DNS records in Linux.

  • dig dnsrecords.com
  • dig @8.8.8.8 dnsrecords.com
  • dig dnsrecords.com ANY
  • dig dnsrecords.com +short
  • dig dnsrecords.com +trace

How to use Dig command

We can use dig name + record type + @dns server to query the DNS info from a DNS server. By default, dig performs a lookup for an A record if no type argument is specified.

  1. server – the IP address or hostname of the name server to query. It is optional and if we don’t provide a server argument then dig uses the name server listed in /etc/resolv.conf.
  2. name – the name of the resource record that is to be looked up.
  3. record type – the type of query requested by dig. For example, it can be an A record, MX record, SOA record or any other types.
Читайте также:  Nvidia gt216 driver linux

Check DNS A record with Dig command

The A stands for address and this is the most fundamental type of DNS record. A record is used to point a domain or subdomain to an IP address. We can use this command to query A record for a domain name. For example:

$ dig www.howtouselinux.com
www.howtouselinux.com. 0 IN A 23.236.62.147

Query DNS PTR record with dig command

A PTR record is well-known as the reverse version of an A record. We can get the PTR record with this command. This is the PTR record for IP address 23.236.62.147.

$ dig -x 23.236.62.147
147.62.236.23.bc.googleusercontent.com.

Query DNS MX record with dig command

A DNS ‘mail exchange’ (MX) record directs email to a mail server. This record can tell us the email server for a domain name. With the following command, we can get the MX record for google.com.

$ dig google.com mx
google.com. 0 IN MX 10 aspmx.l.google.com.
google.com. 0 IN MX 20 alt1.aspmx.l.google.com.
google.com. 0 IN MX 50 alt4.aspmx.l.google.com.
google.com. 0 IN MX 30 alt2.aspmx.l.google.com.
google.com. 0 IN MX 40 alt3.aspmx.l.google.com.

Get DNS records Against a specific DNS server with dig command

Many DNS servers are around the world. To specify a name server against which the query will be executed, use the @ (at) symbol followed by the name server IP address or hostname.

$ dig www.howtouselinux.com @8.8.8.8
www.howtouselinux.com. 5 IN A 23.236.62.147

  • Tcpdump: Filter DNS packets
  • Linux DNS: PTR MX SRV SPF AAAA DNS Records
  • Using Tcpdump to Filter DNS Packets
  • Free DNS Servers in 2021
  • Flush DNS Cache with Command Quick Guide
  • Exploring DNS TTL with Examples
  • Understanding Linux Dig Command
  • Exploring EDNS with Examples
  • Best and Fastest DNS Server For PS4 PS5
  • Best and Fastest DNS Servers For Gaming
  • What is DNS? DNS Meaning
  • Query DNS Txt Record with Dig Command

David is a Cloud & DevOps Enthusiast. He has years of experience as a Linux engineer. He had working experience in AMD, EMC. He likes Linux, Python, bash, and more. He is a technical blogger and a Software Engineer. He enjoys sharing his learning and contributing to open-source.

howtouselinux.com is dedicated to providing comprehensive information on using Linux.

We hope you find our site helpful and informative.

Источник

Understanding DNS records with Examples

DNS is short for Domain Name System. It is simply a database that links meaningful names (known as hostnames), such as www.howtouselinux.com, to a specific IP address, such as 185.230.63.171.

Each device connected to the Internet has a unique IP address. With the system of DNS, we don’t have to memorize IP addresses.

DNS records type

All domains are required to have at least a few essential DNS records for a user to be able to access their website using a domain name. This is the key concept of DNS.

Here are 4 commonly used DNS records.

  • A record – A record is used to map a domain (e.g., www.howtouselinux.com) or a sub-domain (e.g., blog.www.howtouselinux.com) to an IP address or many ips.
  • PTR record – Provides a domain name in reverse-lookups. eg. (23.236.62.147 — www.howtouselinux.com)
  • CNAME record – also known as canonical name records, are used to create aliases that point to other names. They are commonly used to map WWW, FTP and MAIL sub-domains to a domain.
  • MX record – MX (Mail Exchange) records control how incoming email is routed for your domain.
Читайте также:  Hiren boot usb on linux

Check this post to learn more about DNS records.

How to query DNS record

Each application like Chrome has its own mechanism to get the DNS record. We will explain how to use the Linux command to query DNS records.

We can use dig name + record type + @dns server to query the DNS info from a DNS server. By default, dig performs a lookup for an A record if no type argument is specified.

  • server – the IP address or hostname of the name server to query. It is optional and if we don’t provide a server argument then dig uses the name server listed in /etc/resolv.conf.
  • name – the name of the resource record that is to be looked up.
  • record type – the type of query requested by dig. For example, it can be an A record, MX record, SOA record or any other types.

Example of DNS record

We can see that google.com has 6 A records with the following example. The main purpose of this is for load balance and fault tolerance.

172.217.194.138
172.217.194.139
172.217.194.102
172.217.194.101
172.217.194.100
172.217.194.113

Which port does DNS use?

DNS uses both TCP and UDP port 53. The most frequently used port for DNS is UDP 53. This is used for DNS queries on the client-side. Check more info about DNS port here.

How to use tcpdump to filter DNS Record packets?

We can use this tcpdump command to filter DNS query packets.

# tcpdump -i eth0 udp port 53

We can write these packets to a file with this tcpdump command and analyze these packets with Wireshark GUI.

# tcpdump -i eth0 -w /tmp/dns.pcap udp port 53

We can read these packets from dns.pcap file to get more details about the DNS query.

# tcpdump -vvv -r /tmp/dns.pcap port 53

Example of DNS Packet Analysis

We can get the A record for google.com with the flowing command.

This is the output of tcpdump command after we run the above dig command. Check more info about how to use dig command to query DNS records here.

20:11:00.466866 IP 10.79.98.233.54127 > 64.104.76.247.53: 60712+ [1au] A? google.com. (39)

This is the packet we get from the DNS server for this DNS query.

20:11:00.560294 IP 64.104.76.247.53 > 10.79.98.233.54127: 60712 6/4/1 A 74.125.24.113, A 74.125.24.102, A 74.125.24.139, A 74.125.24.138, A 74.125.24.100, A 74.125.24.101 (207)

By default, the dig command query the A record for that domain name with UDP protocol. Check this post to learn more about other DNS records like AAAA, MX, PTR etc.

David is a Cloud & DevOps Enthusiast. He has years of experience as a Linux engineer. He had working experience in AMD, EMC. He likes Linux, Python, bash, and more. He is a technical blogger and a Software Engineer. He enjoys sharing his learning and contributing to open-source.

howtouselinux.com is dedicated to providing comprehensive information on using Linux.

We hope you find our site helpful and informative.

Источник

Оцените статью
Adblock
detector