docker-alpine icon indicating copy to clipboard operation
docker-alpine copied to clipboard

DNS resolution issue in Alpine Linux 3.20. Ping/wget only work if nslookup first

Open agwidarsito opened this issue 2 weeks ago • 7 comments

This is very strange behavior on a fresh installation of Alpine Linux v3.20.0 directly onto a VM.

When I try and ping or wget or even apk update, it will always fail to resolve the domain name unless I manually run an nslookup command first.

E.g.

localhost:~# ping mirrors.ustc.edu.cn
ping: bad address 'mirrors.ustc.edu.cn'                                       <------ BAD, cannot resolve address

localhost:~# nslookup mirrors.ustc.edu.cn
Server:         8.8.8.8
Address:        8.8.8.8:53

Non-authoritative answer:
Name:   mirrors.ustc.edu.cn
Address: 2001:da8:d800:95::110

Non-authoritative answer:
Name:   mirrors.ustc.edu.cn
Address: 202.141.160.110
Name:   mirrors.ustc.edu.cn
Address: 202.141.176.110                                                   <---- So I run nslookup on it, seems to work

localhost:~# ping mirrors.ustc.edu.cn
PING mirrors.ustc.edu.cn (202.141.160.110): 56 data bytes
64 bytes from 202.141.160.110: seq=0 ttl=41 time=295.975 ms                <--------- Now I can ping?
64 bytes from 202.141.160.110: seq=1 ttl=41 time=295.963 ms
64 bytes from 202.141.160.110: seq=2 ttl=41 time=295.854 ms
64 bytes from 202.141.160.110: seq=3 ttl=41 time=295.946 ms

I'm not sure why this is happening - any ideas? It's so painful to even install packages because mirrors fail until I first run nslookup.

agwidarsito avatar Jun 23 '24 01:06 agwidarsito