EDIT:
It was suggested this is a duplicate of another question.
That is not clear at all for me.
First, the accepted answer suggests 3 possible reasons (which may actually be 2), and one of them was verified by catalin as the cause in his case.
It remains to be clarified whether that answers the present case.
I tried using --header "Host:us.archive.ubuntu.com" with curl, and it doesn't help.
I am not sure this discards the "Host headers" problem as a cause.
Second, catalin means to browse a site. I mean to wget from it. I am no expert in networking, but I guess the reasons for catalin's error might be different from mine... even if possibly the same.
I suggest this one is not closed until I can understand and implement the methods to confirm or reject those suggestions.
But it is useful to have those pointers, which I had missed.
I mean to use the IP instead of the server name, to directly wget a file.
I am under Msys2, Win 10 (that's why post here and not in askubuntu, e.g.), but I guess it would be be the same in Linux.
I couldn't make this work.
I post below the details of what I tried.
I had a similar failure using curl.
I wrote a separate post, as I am not sure the explanations and solutions are the same as here.
What is the correct way of doing this?
Note: Using wget ftp://<IP>/... instead of wget http://<IP>/... worked fine.
This is what I tried:
- Obtain the IP address for the server.
$ ping us.archive.ubuntu.com
Haciendo ping a us.archive.ubuntu.com [91.189.91.38] con 32 bytes de datos:
Respuesta desde 91.189.91.38: bytes=32 tiempo=173ms TTL=52
Respuesta desde 91.189.91.38: bytes=32 tiempo=166ms TTL=52
Respuesta desde 91.189.91.38: bytes=32 tiempo=172ms TTL=52
Estadísticas de ping para 91.189.91.38:
Paquetes: enviados = 3, recibidos = 3, perdidos = 0
(0% perdidos),
Tiempos aproximados de ida y vuelta en milisegundos:
Mínimo = 166ms, Máximo = 173ms, Media = 170ms
Control-C
- Try
wgetting the file using the server name. It works ok.
$ wget http://us.archive.ubuntu.com/ubuntu/pool/universe/y/yudit/yudit-common_2.9.6-7_all.deb
--2020-09-21 08:52:23-- http://us.archive.ubuntu.com/ubuntu/pool/universe/y/yudit/yudit-common_2.9.6-7_all.deb
Resolving us.archive.ubuntu.com (us.archive.ubuntu.com)... 91.189.91.39, 91.189.91.38, 2001:67c:1562::15, ...
Connecting to us.archive.ubuntu.com (us.archive.ubuntu.com)|91.189.91.39|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1637644 (1.6M) [application/x-debian-package]
Saving to: ‘yudit-common_2.9.6-7_all.deb’
yudit-common_2.9.6-7_all.deb.1 100%[======================================================================================>] 1.56M 1.20MB/s in 1.3s
2020-09-21 08:52:25 (1.20 MB/s) - ‘yudit-common_2.9.6-7_all.deb’ saved [1637644/1637644]
- Try
wgetting the file using the IP address. It does not work. I also tried adding flags--no-dns-cacheand--continue. Ref: https://unix.stackexchange.com/questions/243241/wget-command-how-to-download-from-a-specific-ip-address-and-port
$ wget http://91.189.91.39/ubuntu/pool/universe/y/yudit/yudit-common_2.9.6-7_all.deb
--2020-09-21 09:23:25-- http://91.189.91.39/ubuntu/pool/universe/y/yudit/yudit-common_2.9.6-7_all.deb
Connecting to 91.189.91.39:80... connected.
HTTP request sent, awaiting response... 404 Not Foun
2020-09-21 09:23:25 ERROR 404: Not Foun.