dnsmasq auf Ubuntu 22.04

Quelle: https://computingforgeeks.com/install-and-configure-dnsmasq-on-ubuntu/

1. DNS-Server

systemd-resolve deaktivieren

sudo systemctl disable systemd-resolved sudo systemctl stop systemd-resolved ls -lh /etc/resolv.conf sudo unlink /etc/resolv.conf

Neue resolv.conf-Datei erstellen

echo nameserver | sudo tee /etc/resolv.conf


sudo apt update sudo apt install dnsmasq

Konfiguration: /etc/dnsmasq.conf

# Listen on this specific port # Setting this to zero completely disables DNS function, # leaving only DHCP and/or TFTP. port=53 # Never forward plain names (without a dot or domain part) domain-needed # Never forward addresses in the non-routed address spaces. bogus-priv # Reihenfolge wie in /etc/resolv.conf strict-order # Add domain name to simple names in a hosts-file expand-hosts # Set the domain for dnsmasq. this is optional, but if it is set, it # does the following things. # 1) Allows DHCP hosts to have fully qualified domain names, as long # as the domain part matches this setting. # 2) Sets the "domain" DHCP option thereby potentially setting the # domain of all systems configured by DHCP # 3) Provides the domain part for "expand-hosts" domain=btin.lan # Set Listen address listen-address= # Set to Server IP for network responses


sudo systemctl restart dnsmasq

DNS-Eintr├Ąge hinzuf├╝gen in /etc/hosts web1.lan web2.lan


sudo systemctl restart dnsmasq

2. DHCP-Server


dhcp-range=,,1h dhcp-option=option:router, dhcp-option=option:ntp-server, dhcp-option=option:dns-server, dhcp-option=option:netmask,


sudo systemctl restart dnsmasq