Difference between `systemd-resolved` and `dnsmasq`

Difference between systemd-resolved and dnsmasq

Both systemd-resolved and dnsmasq are DNS services, but they serve different purposes and are often used in different contexts.


1. systemd-resolved

Purpose:

  • DNS Resolution : systemd-resolved is primarily a local DNS resolver that provides network name resolution to applications running on your machine. It integrates closely with the systemd suite of tools.
  • NetworkManager Integration : It works with NetworkManager and other network configuration tools to provide per-interface DNS settings, supporting scenarios where different network interfaces (e.g., Wi-Fi, Ethernet, VPN) may require different DNS servers.
  • DNS Caching : Provides basic DNS caching but is not as advanced as dnsmasq in terms of caching capabilities.
  • DNS over TLS (DoT): Supports DNS over TLS for encrypted DNS queries, improving privacy and security by encrypting DNS queries between your system and the DNS server.

Common Use Cases:

  • Desktop environments: Often used in Linux desktop distributions like Ubuntu, where you need automatic handling of DNS when switching between networks.
  • Simple DNS resolution for local applications.

Limitations:

  • Basic DNS features : systemd-resolved is mainly a simple DNS resolver and lacks advanced features like DHCP support or extensive DNS customization.
  • Limited caching: Basic caching compared to dedicated DNS services.

2. dnsmasq

Purpose:

  • DNS Caching : dnsmasq is a lightweight DNS forwarder and caching server. It caches DNS queries for faster responses to repeated requests.
  • DHCP Server : It also functions as a DHCP server, providing IP addresses to devices in a local network. This makes it popular for use in small home or office networks where you want a lightweight DHCP and DNS service.
  • TFTP Server: Supports TFTP (Trivial File Transfer Protocol), often used in network booting.
  • Custom DNS Configuration : dnsmasq allows for more granular DNS configurations, such as defining specific IP addresses for domain names, managing custom DNS routes, or forwarding certain DNS queries to specific DNS servers.

Common Use Cases:

  • Small or medium networks: Often used as a DNS and DHCP server for home networks, offices, or small cloud setups.
  • DNS caching for faster lookups: Caching speeds up DNS resolution for frequent queries.
  • VPNs: Commonly used in conjunction with VPNs to provide DNS resolution and IP management for VPN clients.
  • Routers and embedded systems: Frequently found in embedded devices like routers, where lightweight services are crucial.

Limitations:

  • No DNS over TLS: Does not natively support DNS over TLS, although it can be combined with other services to achieve this.

Key Differences:

Feature systemd-resolved dnsmasq
DNS Forwarding Yes Yes
DNS Caching Basic More advanced
DHCP Server No Yes
NetworkManager Integration Strong integration with NetworkManager Not tightly integrated
DNS over TLS (DoT) Yes No
Configuration Automatically configured for per-interface DNS Highly customizable for DNS and DHCP
Primary Use Local DNS resolution on desktops DNS and DHCP services for small networks, VPNs, etc.
TFTP Support No Yes

When to use each:

  • Use systemd-resolved when you need a basic DNS resolver integrated with system tools like NetworkManager, especially in desktop environments where per-interface DNS handling is important.

  • Use dnsmasq when you need a lightweight DNS server with advanced DNS caching and DHCP services, particularly in network or server environments (like home networks, small offices, VPNs, or cloud setups).

You can even use both services together, with dnsmasq providing advanced DNS and DHCP functionality and systemd-resolved handling DNS resolution locally on your machine.

相关推荐
asyxchenchong8881 小时前
最新Hermes Agent 技能封装与科研自动化:以 Meta-Analysis 为例-实现从文献检索到绘图的一站式工作流
运维·人工智能·自动化
tianyuanwo1 小时前
项目内自我管理:一名OS领域DevOps的破局之路
运维·devops
三十..1 小时前
Redis 核心原理与高可用架构实践
运维·数据库·redis
jinglong.zha3 小时前
LScript-从零基础到商业变现的AI自动化学习平台
运维·学习·自动化
Adorable老犀牛4 小时前
Telegraf:InfluxData 出品的指标采集代理
运维·telegraf
北塔软件4 小时前
北塔软件智能体平台 | 不只监控,更是AI时代的数据资产
运维·人工智能·知识库·北塔软件
AOwhisky5 小时前
学习自测与解析:MySQL第五、六、七期核心知识点详解
运维·数据库·笔记·学习·mysql·云计算
无限进步_5 小时前
从零实现一个迷你Shell——深入理解Linux命令行解释器
linux·运维·服务器·开发语言·c++·chrome
Adorable老犀牛5 小时前
nginx_exporter:Prometheus 监控 Nginx 基础指标
运维·nginx·prometheus
山里幽默的程序员5 小时前
DevOps 必备:盘点2026 年最强RESTful API 接口测试方案
运维·restful·devops·api开发·api开发工具