LoginSignup
16
14

More than 5 years have passed since last update.

Ubuntu(Bionic)のDNS設定

Last updated at Posted at 2018-02-27

ubuntu 1804のDNS設定がまた変わってたみたいで、ハマりましたのでメモ。

DNSの設定をGoogle(8.8.8.8)に固定する方法

/etc/systemd/resolved.conf

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
DNS=8.8.8.8
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=udp

search=hoge.co.jp #searchはデフォルトでは書いてませんが、手動で書いてあげれば検索してくれるようです。(20180801追記)

DNS=がコメントアウトされてますので、上記のようにすればOK。

設定の適用

systemctl restart systemd-resolved

確認は下記でできる様子です。

systemd-resolve --status
cat /var/run/systemd/resolve/resolv.conf

これでできたっぽい。

16
14
1

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
16
14