Host Command - DNS Lookup Tool | Online Free DevTools by Hexmos

Perform DNS lookups and query DNS records like A, AAAA, MX, NS, CNAME, and SOA with the Host command. Free online DNS lookup tool.

Host Command

What is the Host Command?

The host command is a simple utility for performing DNS (Domain Name System) lookups. It is commonly used by network administrators and developers to query DNS records for a given hostname or IP address. This tool helps in diagnosing network connectivity issues and understanding how domain names resolve to IP addresses.

Common Host Command Usage

Below are examples of how to use the host command to retrieve various DNS records:

Basic DNS Lookup

To perform a simple DNS lookup for a hostname, which typically returns its IP address (A record):

# Simple DNS lookup
host example.com

Querying Specific Record Types

You can specify the type of DNS record you want to query:

  • A Record (IPv4 Address):
  • # Lookup the IP address of a hostname
    host -t A example.com
  • AAAA Record (IPv6 Address):
  • # Lookup the IPv6 address of a hostname
    host -t AAAA example.com
  • MX Record (Mail Exchanger):
  • # Lookup the mail server records (MX) for a given domain
    host -t MX example.com
  • NS Record (Name Server):
  • # Lookup the name server records (NS) for a given domain
    host -t NS example.com
  • CNAME Record (Canonical Name):
  • # Lookup the canonical name (CNAME) records for a given host
    host -t CNAME sub.example.com
  • SOA Record (Start of Authority):
  • # Lookup the start of authority (SOA) record for a domain
    host -t SOA example.com

Advanced Lookups

  • All Available Records: To retrieve all DNS records associated with a domain:
  • # Lookup all available records for a given domain
    host -a example.com
  • Reverse DNS Lookup: To find the hostname associated with an IP address:
  • # Reverse DNS lookup (find the domain name associated with an IP address)
    host 192.168.1.1
  • Specifying a DNS Server: To use a specific DNS server for your query (e.g., Google's public DNS):
  • # Specify a different DNS server to use for the query
    host example.com 8.8.8.8

Understanding DNS Records

The host command is invaluable for understanding the different types of DNS records that make the internet function:

  • A Records: Map a hostname to an IPv4 address.
  • AAAA Records: Map a hostname to an IPv6 address.
  • MX Records: Specify the mail servers responsible for accepting email for a domain.
  • NS Records: Delegate a DNS zone to use the given authoritative name servers.
  • CNAME Records: Create an alias of one name to another.
  • SOA Records: Provide authoritative information about a DNS zone, including the primary name server, administrator's email, domain serial number, and various timers relating to zone refreshing.

External Resources