7
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

UbuntuでDNSの設定を永続させる

Posted at

ubuntuの/etc/resolv.confが勝手に書き変わる問題

/etc/resolv.confを編集した後に、netplan apply等を実行するとデフォルトの設定に戻ってしまう場合がある。

手順

aptを叩くために/etc/resolv.confを編集

nameserver 8.8.8.8

resolvconfをインストール

sudo apt -y update
sudo apt -y install resolvconf

念のため手動で起動

sudo systemctl start resolvconf.service
sudo systemctl enable resolvconf.service
sudo systemctl status resolvconf.service

/etc/resolvconf/resolv.conf.d/headの編集

nano /etc/resolvconf/resolv.conf.d/head

下記を追加

nameserver 8.8.8.8 
nameserver 8.8.4.4

resolvconfの再起動

sudo systemctl restart resolvconf.service
sudo systemctl restart systemd-resolved.service

名前解決が出来れば完了!

参考文献

7
5
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
7
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?