システムの再起動後も、ネームサーバーアドレスを/etc/resolv.confに永続的に保つ方法は? [コピー]

システムの再起動後も、ネームサーバーアドレスを/etc/resolv.confに永続的に保つ方法は? [コピー]

ネームサーバーを変更して/etc/resolv.confシステムが再起動した後、ネームサーバーは元の状態にリセットされました。

私はLinux Mint 19(シナモン)を使用しています。

# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 8.8.8.8
nameserver 8.8.4.4

これはシステムを再起動する前のファイルで、その後ネームサーバーが変更されました。

ベストアンサー1

Ubuntu 18とMint 19には「netplan」という新機能もあります。

下に/etc/ネットプラン/以下のように.yamlファイルを見つけることができます。

    # Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  nameservers:
    addresses: [8.8.8.8]

そこにDNS IPを入力して閉じてから永久に作成します。sudo netplan apply

または、設定で変更することもできます(Network Manager GUI)。

おすすめ記事