WGet을 사용하여 무언가를 다운로드하려고 할 때 도메인 이름이 IPv6 주소로 변환되면 일반적으로 실패합니다.
이는 링크 리디렉션이 있을 때 더 일반적입니다.
예를 들어:
$ wget --inet6-only https://raw.githubusercontent.com/walkxcode/Dashboard-Icons/main/png/ebay.png
--2022-11-13 10:27:05-- https://raw.githubusercontent.com/walkxcode/Dashboard-Icons/main/png/ebay.png
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 2606:50c0:8001::154, 2606:50c0:8000::154, 2606:50c0:8003::154, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|2606:50c0:8001::154|:443...
$ wget --inet6-only https://download.docker.com/linux/centos/9/x86_64/stable/Packages/docker-ce-20.10.21-3.el9.x86_64.rpm
--2022-11-13 10:32:52-- https://download.docker.com/linux/centos/9/x86_64/stable/Packages/docker-ce-20.10.21-3.el9.x86_64.rpm
Resolving download.docker.com (download.docker.com)... 2600:9000:21ed:e000:3:db06:4200:93a1, 2600:9000:21ed:2e00:3:db06:4200:93a1, 2600:9000:21ed:7000:3:db06:4200:93a1, ...
Connecting to download.docker.com (download.docker.com)|2600:9000:21ed:e000:3:db06:4200:93a1|:443...
첫 번째 예에서는 raw.githubusercontent.com
이름이 로 확인됩니다 2606:50c0:8001::154, 2606:50c0:8000::154, 2606:50c0:8003::154
. 그런 다음 WGget은 해당 IP에 연결을 시도하지만 아무 일도 일어나지 않고 정지됩니다. 다운로드가 진행되지 않습니다. 두 번째 예에서도 같은 일이 발생합니다 download.docker.com
.
IPv4 연결을 강제로 실행하면 콘텐츠가 성공적으로 다운로드됩니다.
$ wget --inet4-only https://raw.githubusercontent.com/walkxcode/Dashboard-Icons/main/png/ebay.png
--2022-11-13 10:28:16-- https://raw.githubusercontent.com/walkxcode/Dashboard-Icons/main/png/ebay.png
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.109.133, 185.199.108.133, 185.199.110.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 24872 (24K) [image/png]
Saving to: ‘ebay.png’
ebay.png 100%[==================================================================================>] 24.29K --.-KB/s in 0.005s
2022-11-13 10:28:16 (4.48 MB/s) - ‘ebay.png’ saved [24872/24872]
$ wget --inet4-only https://download.docker.com/linux/centos/9/x86_64/stable/Packages/docker-ce-20.10.21-3.el9.x86_64.rpm
--2022-11-13 10:34:35-- https://download.docker.com/linux/centos/9/x86_64/stable/Packages/docker-ce-20.10.21-3.el9.x86_64.rpm
Resolving download.docker.com (download.docker.com)... 52.84.83.27, 52.84.83.65, 52.84.83.79, ...
Connecting to download.docker.com (download.docker.com)|52.84.83.27|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21654080 (21M) [binary/octet-stream]
Saving to: ‘docker-ce-20.10.21-3.el9.x86_64.rpm’
docker-ce-20.10.21-3.el9.x86_64.rpm 100%[==================================================================================>] 20.65M 27.3MB/s in 0.8s
2022-11-13 10:34:36 (27.3 MB/s) - ‘docker-ce-20.10.21-3.el9.x86_64.rpm’ saved [21654080/21654080]
IPv6를 사용할 때 WGet이 실패하는 이유는 무엇입니까?