dnsmasq DNS Forwarder / DHCP Server
dnsmasq is a compact, open source network service designed to deliver DNS caching, DNS forwarding to upstream resolvers, and DHCP services for small networks and embedded devices. It consolidates multiple functions into a single daemon, reducing upstream DNS traffic while offering straightforward configuration through /etc/dnsmasq.conf or drop-in files.
dnsmasq runs as a single daemon that listens on UDP/TCP port 53 for DNS queries and on DHCP ports to lease addresses. It supports DHCPv4/v6, DNS caching, and simple host name resolution, making it ideal for tiny LANs, home routers, and lightweight appliances.
dnsmasq is generally safe when obtained from official repositories and configured with sensible access controls. It is widely used in home routers, Linux desktops, and embedded devices to provide efficient DNS caching, DHCP services, and basic local name resolution. Always secure network interfaces, limit exposure, and keep the package up to date.
dnsmasq is not a virus by design; it is a legitimate, open source daemon. However, attackers may modify or replace the binary if the system is compromised or if installations come from untrusted sources. Always verify the binary location, provenance, and signatures, and monitor for unexpected network behavior.
Red Flags: If dnsmasq is found in non-standard locations, is running from a directory writable by non-privileged users, or if DNS responses appear malformed or suspicious, treat it as a potential compromise and investigate.
Reasons it's running:
Dnsmasq is a lightweight DNS forwarder, DNS caching server, and DHCP server designed for small networks. It simplifies network management on Linux desktops, embedded devices, and routers by providing local name resolution, efficient DNS caching, and automatic IP address assignment.
Yes, dnsmasq is safe when installed from official repositories and properly configured. Limit interfaces, disable DHCP on untrusted networks, and keep it updated to reduce attack surface.
Install dnsmasq from your distribution's package manager (e.g., apt install dnsmasq on Debian/Ubuntu or pacman -S dnsmasq on Arch). Start and enable the service, then edit /etc/dnsmasq.conf to tailor DNS and DHCP settings.
Edit /etc/dnsmasq.conf to set a dhcp-range, dhcp-option for gateway and DNS servers, and specify the interface (e.g., interface=eth0). Restart dnsmasq to apply the changes and verify leases with dnsmasq/dhcp leases.
Dnsmasq uses UDP/TCP port 53 for DNS and UDP port 67 for DHCP (and 68 for client responses in IPv4). Depending on configuration, it may also forward queries to upstream DNS servers on port 53.
To disable, stop and disable the dnsmasq service and remove its configuration if desired. On routers or embedded devices, disable the DNS/DHCP options in the firmware UI and reboot.