Ubuntu 22.04にGoogleのパブリックDNSに変更する

環境
OSバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"
# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"

操作方法
1.GoogleのパブリックDNS情報を追記します
# nano /etc/systemd/resolved.conf
最終行に以下の内容を追記します
DNS=8.8.8.8 8.8.4.4

2.systemd-resolvedを再起動します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl restart systemd-resolved
# systemctl restart systemd-resolved
# systemctl restart systemd-resolved

3.systemd-resolvedのステータスを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; ven>
Active: active (running) since Mon 2022-05-30 22:07:36 JST; 28s ago
# systemctl status systemd-resolved ● systemd-resolved.service - Network Name Resolution Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; ven> Active: active (running) since Mon 2022-05-30 22:07:36 JST; 28s ago
# systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; ven>
     Active: active (running) since Mon 2022-05-30 22:07:36 JST; 28s ago

4.Ping動作確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# ping yahoo.co.jp
PING yahoo.co.jp (183.79.219.252) 56(84) bytes of data.
64 bytes from 183.79.219.252 (183.79.219.252): icmp_seq=1 ttl=128 time=15.2 ms
64 bytes from 183.79.219.252 (183.79.219.252): icmp_seq=2 ttl=128 time=13.9 ms
# ping yahoo.co.jp PING yahoo.co.jp (183.79.219.252) 56(84) bytes of data. 64 bytes from 183.79.219.252 (183.79.219.252): icmp_seq=1 ttl=128 time=15.2 ms 64 bytes from 183.79.219.252 (183.79.219.252): icmp_seq=2 ttl=128 time=13.9 ms
# ping yahoo.co.jp
PING yahoo.co.jp (183.79.219.252) 56(84) bytes of data.
64 bytes from 183.79.219.252 (183.79.219.252): icmp_seq=1 ttl=128 time=15.2 ms
64 bytes from 183.79.219.252 (183.79.219.252): icmp_seq=2 ttl=128 time=13.9 ms

 

Ubuntu 22.04

Posted by arkgame