Zum Inhalt

Host - Einfaches DNS Lookup Tool

`` ``
Alle Befehle, die in die Zwischenablage kopiert werden!

Überblick

host* ist ein einfaches DNS-Lookup-Dienstprogramm, das eine saubere, einfach zu lesende Ausgabe für DNS-Abfragen bereitstellt. Es ist entworfen, um benutzerfreundlicher als graben und einfacher als nslookup, so dass es ideal für schnelle DNS-Lookups und grundlegende Fehlersuche Aufgaben.

Grundprinzip

bash host [options] hostname [server] host [options] IP_address [server]_

Wesentliche Befehle

Grundlegende DNS Lookups

```bash # Look up A and AAAA records (IPv4 and IPv6) host google.com ```_ `` ```bash # Reverse DNS lookup (IP to domain) host 8.8.8.8 ```_ `` ```bash # IPv6 reverse lookup host 2001:4860:4860::8888 ```_ `` ```bash # Using specific DNS server host google.com 8.8.8.8 ```_ ``

Abfragen von Datenträgern

```bash # A record (IPv4 address) host -t A google.com ```_ `` ```bash # AAAA record (IPv6 address) host -t AAAA google.com ```_ `` ```bash # MX record (Mail Exchange) host -t MX google.com ```_ `` ```bash # NS record (Name Server) host -t NS google.com ```_ `` ```bash # TXT record (Text records) host -t TXT google.com ```_ `` ```bash # CNAME record (Canonical Name) host -t CNAME www.google.com ```_ `` ```bash # SOA record (Start of Authority) host -t SOA google.com ```_ `` ```bash # PTR record (Pointer for reverse lookup) host -t PTR 8.8.8.8 ```_ `` ```bash # SRV record (Service record) host -t SRV _sip._tcp.example.com ```_ ``

Erweiterte Optionen

Verbose und Debug-Ausgang

```bash # Verbose output (equivalent to -a) host -v google.com ```_ `` ```bash # All records (ANY query type) host -a google.com ```_ `` ```bash # Debug output host -d google.com ```_ ``

Timeout und Verbindungsoptionen

```bash # Set timeout (5 seconds) host -W 5 google.com ```_ `` ```bash # Wait indefinitely for reply host -w google.com ```_ `` ```bash # Use TCP instead of UDP host -T google.com ```_ `` ```bash # Set number of UDP retries host -R 3 google.com ```_ ``

Suchverhaltensoptionen

```bash # Non-recursive query host -r google.com ```_ `` ```bash # Specify query class (default: IN) host -c IN google.com ```_ `` ```bash # Show SOA records from all authoritative servers host -C example.com ```_ `` ```bash # Zone transfer (list mode) host -l example.com ```_ ``

Beliebte DNS Server

Verschiedene DNS-Anbieter verwenden

```bash # Google DNS host google.com 8.8.8.8 ```_ `` ```bash # Cloudflare DNS host google.com 1.1.1.1 ```_ `` ```bash # OpenDNS host google.com 208.67.222.222 ```_ `` ```bash # Quad9 DNS host google.com 9.9.9.9 ```_ ``

Allgemeine Anwendungsfälle

Email Server Fehlerbehebung

```bash # Check MX records for email routing host -t MX example.com ```_ `` ```bash # Verify mail server IP host mail.example.com ```_ `` ```bash # Check multiple mail servers host -t MX gmail.com yahoo.com outlook.com ```_ ``

Domain Verifikation

```bash # Check TXT records for domain verification host -t TXT example.com ```_ `` ```bash # Verify SPF records host -t TXT example.com|grep "v=spf1" ```_ `` ```bash # Check DKIM records host -t TXT default._domainkey.example.com ```_ ``

Netzwerkdiagnose

```bash # Check authoritative name servers host -t NS example.com ```_ `` ```bash # Verify domain authority information host -t SOA example.com ```_ `` ```bash # Check CNAME aliases host -t CNAME www.example.com ```_ `` ```bash # Comprehensive domain analysis host -a example.com ```_ ``

Zurück DNS Lookups

```bash # Check hostname for IP host 192.168.1.1 ```_ `` ```bash # Verify server identity host 208.67.222.222 ```_ `` ```bash # IPv6 reverse lookup host 2001:4860:4860::8844 ```_ ``

Fehlerbehebung Befehle

Debug und Verbose Quers

```bash # Debug mode with specific record type host -d -t A google.com ```_ `` ```bash # Verbose TCP query host -v -T google.com ```_ `` ```bash # Non-recursive NS query host -r -t NS google.com ```_ `` ```bash # Extended timeout with MX query host -W 10 -t MX example.com ```_ ``

Befehlsoptionen Referenz

| | Option | Description | | | --- | --- | | | -a | Equivalent to -v and -t ANY | | | | -C | Show SOA records from all authoritative servers | | | | -c class | Specify query class (default: IN) | | | | -d | Enable debug output | | | | -l | List mode (zone transfer) | | | | -n | Use IP6.INT domain for IPv6 reverse lookups | | | | -N ndots | Set number of dots for absolute names | | | | -r | Make non-recursive queries | | | | -R retries | Set number of UDP retries | | | | -t type | Specify query type (A, AAAA, MX, NS, etc.) | | | | -T | Use TCP connection | | | | -v | Verbose output | | | | -W seconds | Set timeout in seconds | | | | -w | Wait indefinitely for reply | |

Aufzeichnungsarten

| | Type | Description | Example | | | --- | --- | --- | | | A | IPv4 address | host -t A google.com | | | | AAAA | IPv6 address | host -t AAAA google.com | | | | CNAME | Canonical name | host -t CNAME www.google.com | | | | MX | Mail exchange | host -t MX google.com | | | | NS | Name server | host -t NS google.com | | | | PTR | Pointer (reverse) | host -t PTR 8.8.8.8 | | | | SOA | Start of authority | host -t SOA google.com | | | | SRV | Service record | host -t SRV _sip._tcp.example.com | | | | TXT | Text record | host -t TXT google.com | | | | ANY | All records | host -a google.com | |

Installation

Linux (Ubuntu/Debian)

bash sudo apt-get install dnsutils_

Linux (CentOS/RHEL/Fedora)

```bash sudo yum install bind-utils

or

sudo dnf install bind-utils ```_

macOS

host kommt mit macOS vorinstalliert.

Windows

Verwenden Sie Windows Subsystem für Linux (WSL) oder installieren Sie über Paketmanager wie Chocolatey.

Tipps und Best Practices

  1. Clean Output: Host bietet sauberere, mehr lesbare Leistung als graben
  2. *Quick Lookups: Ideal für einfache DNS-Abfragen und einfache Fehlerbehebung
  3. *Multiple Anfragen: Kann mehrere Domänen in einem einzigen Befehl abfragen
  4. *Reverse Lookups: Automatische Erkennung von IP-Adressen und führt umgekehrte Lookups aus
  5. Ausgangseinstellungen: Verwenden -W Option für langsame oder unzuverlässige Netzwerke
  6. *TCP-Abfragen: Verwenden -T für große Antworten oder wenn UDP blockiert ist
  7. *Kombination mit anderen Werkzeugen: Verwenden Sie neben Graben und nslookup für umfassende Analyse

Häufige Fehlermeldungen

| | Error | Meaning | | | --- | --- | | | Host not found | Domain doesn't exist (NXDOMAIN) | | | | No address associated with hostname | No A/AAAA records found | | | | Connection timed out | DNS server unreachable | | | | Server failure | DNS server error (SERVFAIL) | | | | Query refused | DNS server refused the query | |

Weitere Befehle

  • dig - Detailliertes DNS Lookup Tool mit umfangreichen Optionen
  • nslookup Interaktives DNS-Lookup-Dienstprogramm
  • ping - Netzwerkkonnektivität testen und Hostnamen beheben
  • traceroute - Trace-Netzwerkpfad zum Ziel
  • whois - Domain-Registrierung und Eigentümerinformation