0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ubuntu 24.04 の DNS変更

Last updated at Posted at 2025-01-29

Contabo の Ubuntu 24.04 LTS で名前解決ができなくて apt update 出来ないことがよく起こったため DNS に Google Public DNS を追加した。

DNS 設定の編集

50-cloud-init.yaml50 の部分は環境によって異なる可能性があります。

bash
sudo vi /etc/netplan/50-cloud-init.yaml

Google Public DNS の 8.8.8.88.8.4.4 を追加する。

/etc/netplan/50-cloud-init.yaml
network:
  version: 2
  ethernets:
    eth0:
      match:
        macaddress: "00:50:56:57:dc:57"
      addresses:
      - "156.67.110.218/23"
      - "2400:d321:2238:8891:0000:0000:0000:0001/64"
      nameservers:
        addresses:
+       - 8.8.8.8
+       - 8.8.4.4
        - 62.72.40.51
        - 62.72.40.52
        - 2605:a141:5028::1:53
...

設定の適用

bash
sudo netplan apply

確認

追加した 8.8.8.88.8.4.4 があれば OK。
名前解決が出来るようになっているはず。

$ resolvectl status
Global
         Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
  resolv.conf mode: stub

Link 2 (eth0)
    Current Scopes: DNS
         Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 8.8.4.4
       DNS Servers: 8.8.8.8 8.8.4.4 62.72.40.51 62.72.40.52 2605:a141:5028::1:53
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?