Could not resolve DNS after start Docker desktop
curl www.naver.com
curl: (6) Could not resolve host: www.naver.com
- Run
Docker desktop
>Settings
>Resources
>Network
- Change docker subnet
192.168.65.0/24
to10.x.x.x/24
like10.0.65.0/24
Apply and Restart
- Test
curl www.naver.com
<html>
<head><title>302 Found</title></head>
<body>
<center><h1>302 Found</h1></center>
<hr><center> NWS </center>
</body>
</html>
- Run
Win+Q
>Hyper-V manager
> right sideVirtual switch manager
- Create external virtual switch
- Input this options:
- Name: wsl-external
- Connection type: External
- Select "Allow management operating system to share this network adapter"
- Apply ans Save
- Move
C:\Users\[User name]
- Now add to
.wslconfig
text like this:
[wsl2]
networkingMode=bridged
vmSwitch=wsl-external
- Save and close
- Shutdown wsl2
wsl --shutdown
- Connect wsl2 distro and test connection
❯ curl google.com -vvv
* Trying 142.251.42.174:80...
* Connected to google.com (142.251.42.174) port 80 (#0)
> GET / HTTP/1.1
> Host: google.com
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 301 Moved Permanently
< Location: http://www.google.com/
< Content-Type: text/html; charset=UTF-8
< Date: Wed, 01 Feb 2023 06:40:49 GMT
< Expires: Fri, 03 Mar 2023 06:40:49 GMT
< Cache-Control: public, max-age=2592000
< Server: gws
< Content-Length: 219
< X-XSS-Protection: 0
< X-Frame-Options: SAMEORIGIN
<
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
* Connection #0 to host google.com left intact