Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
agwidarsito opened this issue Jun 23, 2024 · 9 comments

Comments

@agwidarsito
Copy link

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
Copy link
Author

Update: The exact same issue seems to happen on a fresh install of Alpine 3.18.0.

@mauromorales
Copy link

I'm getting the same issue on a qemu installation, Alpine 3.19 was working fine. One thing I do notice is that it seems to be using ipv6 by default, but not sure if this is somewhat related

@agwidarsito
Copy link
Author

agwidarsito commented Jul 1, 2024

@mauromorales I thought it might have been related to IPv6 also.. I disabled it and still no luck sadly :(

@mauromorales
Copy link

Thanks for keeping me posted. Will try other things and update if I find something

@fossdd
Copy link

fossdd commented Jul 1, 2024

Did you run setup-interfaces?

@agwidarsito
Copy link
Author

Do I need to do that even before I run setup-alpine? It seems even the installer cannot download from the mirrors some of the time :(

@mauromorales
Copy link

In my case I'm not sure if the issue is Alpine itself or the fact that it is running on qemu and I don't think qemu comes with an ipv6 dns resolver

@eznix86
Copy link

eznix86 commented Aug 1, 2024

I tried this and it works

setup-interfaces
vi /etc/udhcpc/udhcpc.conf # Uncomment RESOLV_CONF="NO"
rc-service networking restart
ip addr
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf

@agwidarsito
Copy link
Author

Oh wow thanks so much, I'll give that a shot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants