DNS/DHCP 服务器
DNS/DHCP 服务器(Dnsmasq)(01)安装Dnsmasq
Dnsmasq:安装
安装 Dnsmasq,它是轻量级的 DNS 转发器和 DHCP 服务器软件。
安装 Dnsmasq。
root@dlp:~# apt -y install dnsmasq
配置 Dnsmasq。
root@dlp:~# vi /etc/dnsmasq.conf
# line 19 : uncomment
# never forward plain names
domain-needed
# line 21 : uncomment
# never forward addresses in the non-routed address spaces
bogus-priv
# line 53 : uncomment
# query with each server strictly in the order in resolv.conf
strict-order
# line 67 : add if you need
# query the specific domain name to the specific DNS server
# the example follows means query domain to the server
server=/server.education/10.0.0.10
# line 116 : uncomment and specify network interfaces to bind
interface=enp1s0
# line 134 : uncomment
bind-interfaces
# line 145 : uncomment to add domain name on hostname automatically
expand-hosts
# line 155 : add to set domain name
domain=srv.world
# change the link according to man page of systemd-resolved in order to avoid conflicting on 53
root@dlp:~# ln -fs /run/systemd/resolve/resolv.conf /etc/resolv.conf
root@dlp:~# systemctl restart dnsmasq systemd-resolved
对于 DNS 记录,请将其添加到 中。然后,Dnsmasq 将回答客户的查询。
root@dlp:~# vi /etc/hosts
# add DNS entries
10.0.0.30 dlp.srv.world dlp
10.0.0.31 www.srv.world www
root@dlp:~# systemctl reload dnsmasq
验证网络中客户端主机的名称或地址解析。
root@desktop:~# vi /etc/netplan/01-netcfg.yaml# change DNS setting to refer to Dnsmasq Server
nameservers:
addresses: root@desktop:~# netplan apply
root@desktop:~# grep nameserver /run/systemd/resolve/resolv.conf
nameserver 10.0.0.30root@desktop:~#
dig dlp.srv.world.
root@desktop:~#
dig -x 10.0.0.30;DiG 9.18.24-0ubuntu5-Ubuntudlp.srv.world.;; global options: +cmd;; Got answer:;; ->>HEADERHEADER
页:
[1]