Overview
systemd-resolve communicates with the systemd-resolved daemon to perform DNS queries, manage the local cache, and provide information related to name resolution. It is primarily used to diagnose DNS configuration issues or to look up IP addresses for specific domains.
Key Features
- DNS, LLMNR, mDNS name resolution
- DNS cache management and flushing
- Querying name resolution status and statistics
- Support for querying via specific interfaces
Key Options
systemd-resolve allows control over name resolution behavior and information retrieval through various options.
Information Query and Control
Generated command:
Try combining the commands.
Description:
`systemd-resolve` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
Learn how to utilize name resolution features through various usage examples of systemd-resolve.
Basic DNS Query
systemd-resolve example.com
Looks up the IP address for a given domain.
Check systemd-resolved Service Status
systemd-resolve --status
Verifies the current DNS server configuration, cache status, and statistics.
Flush DNS Cache
systemd-resolve --flush-caches
Clears the internal DNS cache of systemd-resolved to fetch the latest information.
Query Specific DNS Record Type
systemd-resolve --type=MX google.com
Retrieves the MX (Mail Exchanger) records for google.com.
Query via Specific Interface
systemd-resolve --interface=eth0 example.com
Looks up the IP address for example.com through the eth0 interface.
Tips & Notes
Useful tips and points to note when using systemd-resolve.
Usage Tips
- The `resolvectl` command offers similar functionality to `systemd-resolve` and may have a more user-friendly interface. In many cases, `resolvectl` is a symbolic link to `systemd-resolve`.
- When diagnosing DNS issues, checking the current DNS server configuration and cache status with `systemd-resolve --status` is helpful.
- Flushing the local cache can refresh stale DNS information, which is particularly useful when DNS record changes need to be reflected immediately.
Notes
`systemd-resolve` requires the `systemd-resolved` service to be active to function correctly. This service is typically running by default on most systemd-based Linux systems. If the service is inactive, you can start it with the command `sudo systemctl start systemd-resolved`.