Table of Contents
- 1. デフォルトの/etc/resolv.conf
- 2. /etc/resolvconf/resolv.conf.d/tailを無効にする
- 3. systemd-resolvedを有効する
- 4. resolvconfを有効にする
1 デフォルトの/etc/resolv.conf
デフォルトだと以下の通りです。
- resolvconfが有効になっています。
- /etc/resolvconf/resolv.conf.d/tailの内容が/etc/resolv.confに追加されます。DHCPサーバからDNS情報を配布していると、この内容が邪魔になる場合があります。
- systemd-resolvedが無効になっています。
DHCPサーバからnameserver 192.168.11.2とsearch hiroom2.comが配布されている状態だと/etc/resolv.confは以下のようになります。
$ cat /etc/resolv.conf# Dynamic resolv.conf(5) file for glibc resolver(3) generated by# resolvconf(8)# DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTENnameserver 192.168.11.2search hiroom2.com# ParrotDNS/OpenNICnameserver 139.99.96.146nameserver 37.59.40.15nameserver 185.121.177.177# Round Robinoptions rotate
2 /etc/resolvconf/resolv.conf.d/tailを無効にする
#!/bin/sh -esudo mv /etc/resolvconf/resolv.conf.d/tail /etc/resolvconf/resolv.conf.d/tail.disablesudo systemctl restart resolvconf
3 systemd-resolvedを有効する
#!/bin/sh -esudo systemctl disable resolvconfsudo systemctl stop resolvconfsudo rm /etc/resolv.confsudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.confsudo systemctl enable systemd-resolvedsudo reboot
4 resolvconfを有効にする
systemd-resolvedからresolvconfに戻す場合は以下のコマンドを実行します。
#!/bin/sh -esudo rm /etc/resolv.confsudo systemctl disable systemd-resolvedsudo systemctl stop systemd-resolvedsudo ln -s /etc/resolvconf/run/resolv.conf /etc/resolv.confsudo systemctl enable resolvconfsudo reboot