ユーザ用ツール

サイト用ツール


linux:ubuntu12.04:dnsmasq

dnsmasq と systemd-resolved(Ubuntu 12.04 LTS)

netplan に設定した DNS を拾いたいので、DNSStubListener=no とせずに、systemd-resolved 自体も disable にしないで、dnsmasq を DNS サーバーとして動かした。

すべてはここに

Ubuntu : systemd-resolved、及び Resolvconf 設定

これを十分読んでから、以下を読む。

20191028: Ubuntu 18.04.2 LTS - dnsmasq

ポイントは、/etc/dnsmasq.conf で bind-interfaces をアンコメント


よく使うコマンド

■ dnsmasq
  停止  # service dnsmasq stop
  開始  # service dnsmasq start

■ systemd-resolved
  再起動 # systemctl restart systemd-resolved
  状態  # systemd-resolve –status

■ ポート 53
  確認  # netstat -anp | fgrep ':53'
  確認  # netstat -anp | fgrep “127.0.0.53”


1. ネットワークの設定

何も変更していない。

# cat /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    enp2s0:
      addresses:
      - 10.56.90.30/24
      gateway4: 10.56.90.1
      nameservers:
        addresses:
        - 10.56.90.1
  version: 2
#
 

2. /etc/resolv.conf

動的 /etc/resolv.conf を使用している。=インストールしたときから変えていない。

# ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Jul 31 16:28 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
 

3. /etc/systemd/resolved.conf

いろいろ試したが、結局 インストールしたときからなにも変更していない。

# cat /etc/systemd/resolved.conf
[Resolve]
#DNS=
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=yes
#DNSStubListener=yes
#ReadEtcHosts=yes

4. /etc/dnsmasq.conf

systemd-resolved と共存させるためには bind-interfaces がポイント。それ以外は、普通に設定。

# diff dnsmasq.conf.ORIGINAL dnsmasq.conf
19c19
< #domain-needed
---
> domain-needed
21c21
< #bogus-priv
---
> bogus-priv
53c53
< #strict-order
---
> strict-order
124a125
> bind-interfaces
565a567
> cache-size=256

5. /etc/hosts

自宅LAN 内のサーバーアドレスを追記。

# cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 machine-name
10.56.90.30 www.hohog.net

linux/ubuntu12.04/dnsmasq.txt · 最終更新: 2020/09/21 18:23 by hohog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki