LoginSignup
4
2

More than 5 years have passed since last update.

Ubuntu 18.04でDNSサーバを切り替える方法

Posted at

UbuntuのDNSサーバを変更で思いの他手間取ったのでメモ

経緯

  • ubuntuにDNSサーバ用ソフトウェアであるNSDを導入しようと試行するも失敗
  • デフォルトでインストールされているbind9-hostがポートの競合を起こしている事が原因と判明
  • bind9-host抜く
  • 下記のように名前解できなくなった
$ dig google.com
;; reply from unexpected source: 127.0.0.1#53, expected 127.0.0.53#53

解決方法

sudo vi /etc/resolvconf/resolv.conf.d/head

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 9.9.9.9

sudo service resolvconf restart

cat /etc/resolv.conf
nameserverが変更されていることを確認

ハマりポイント

/etc/resolv.conf書き換えても元に戻る

/etc/resolv.conf自体がresolvconfのシンボリックリンクだった。
OSとしては/etc/resolv.confを読みに行くが、設定自体はresolvconfが管理してるっぽい。

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2