Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
6
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

windows標準のubuntuのDNS設定はWindowsとは別に管理されている

概要

表題の通りです。

気づき

DNS Server設定が正常にされていないDNS環境にて作業していたところ…
Window側のDNS設定は変更し、問題はないのに…

ubuntu側でapt installが正常に動作しません…

$ sudo apt update
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Temporary failure resolving 'security.ubuntu.com'

ubuntu側でテスト

$ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=52 time=11.4 ms
^C
--- 8.8.8.8 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 11.477/11.477/11.477/0.000 ms
$ping google.com
^C

(timeout で失敗…)

ipでは正常にいくのにdomainでは失敗…

改修

DNS設定を確認

$ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Oct 31 11:27 /etc/resolv.conf -> ../run/resolvconf/resolv.conf

/run/resolvconf/resolv.confにあるようなのでそこを確認

$cat /run/resolvconf/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line.
nameserver x.x.x.x
...

このx.x.x.xを修正します。

DNS設定を修正

$sudo nano /run/resolvconf/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line.
nameserver 8.8.8.8 8.8.4.4

systemd-resolvedを再起動して設定反映!

$sudo systemctl restart systemd-resolved
System has not been booted with systemd as init system (PID 1). Can't operate.

再度確認

$ping google.com
PING google.com (172.217.27.78) 56(84) bytes of data.
64 bytes from nrt12s15-in-f78.1e100.net (172.217.27.78): icmp_seq=1 ttl=52 time=12.6 ms
64 bytes from nrt12s15-in-f78.1e100.net (172.217.27.78): icmp_seq=2 ttl=52 time=15.3 ms

これでうまく通るようになりました。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
6
Help us understand the problem. What are the problem?