%EC%97%90%EC%84%9C%20%EC%9E%84%EC%9D%98%20IP%EC%97%90%20%EB%8C%80%ED%95%9C%20%EB%B0%94%EC%9D%B8%EB%94%A9%EC%9D%B4%20%EC%9E%91%EB%8F%99%ED%95%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4..png)
/64 IPv6 서브넷을 제공하는 scaleway.com 서버(DEV1-S)가 있습니다. 이 서브넷의 IP를 사용하여 HTTP 요청(예제에서는 wget 사용)을 만들고 싶지만 작동할 수 없습니다. 요청(wget은 물론 다른 프로그램 및 프로그래밍 언어도 포함)이 중단됩니다.
IPv6 주소는 2001:bc8:1830:1b18::1, 게이트웨이는 2001:bc8:1830:1b18::, 넷마스크는 64입니다.
ip -6 addr
새로 생성된 서버에서 를 실행하면 다음이 출력됩니다.
root@test:~# ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 2001:bc8:1830:1b18::1/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::dc2e:4cff:fe57:a019/64 scope link
valid_lft forever preferred_lft forever
포럼 및 기타 질문/답변에서 서브넷의 주소에 바인딩하려면 다음 명령을 실행해야 한다는 내용을 읽었습니다.
ip add add local 2001:bc8:1830:1b18::/64 dev lo
ip route add local 2001:bc8:1830:1b18::/64 dev ens2
sysctl -w net.ipv6.ip_nonlocal_bind=1
이 명령 이후의 출력은 ip -6 addr
다음과 같습니다.
root@test:~# ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
inet6 2001:bc8:1830:1b18::/64 scope global
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 2001:bc8:1830:1b18::1/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::dc2e:4cff:fe57:a019/64 scope link
valid_lft forever preferred_lft forever
2001:bc8:1830:1b18::9
이제 ping6 대신 에 2001:bc8:1830:1b18::1
내 서버에서만 ping6을 실행할 수 있습니다 . 다른 서버/네트워크에서는 발생하지 않습니다.
가 없으면 sysctl -w net.ipv6.ip_nonlocal_bind=1
wget은 다음을 반환합니다.
root@test:~# wget --bind-address=2001:bc8:1830:1b18::2 -v google.com
--2021-08-13 00:29:45-- http://google.com/
Resolving google.com (google.com)... 2a00:1450:400e:802::200e, 142.250.179.174
Connecting to google.com (google.com)|2a00:1450:400e:802::200e|:80... failed: Cannot assign requested address.
Connecting to google.com (google.com)|142.250.179.174|:80... failed: Address family not supported by protocol.
이제 3개의 명령을 수행한 후 --bind-address 플래그를 이외의 서브넷 주소로 설정하여 wget을 실행하면 2001:bc8:1830:1b18::1
요청이 영원히 중단됩니다.
root@test:~# wget --bind-address=2001:bc8:1830:1b18::1 google.com
--2021-08-12 23:55:48-- http://google.com/
Resolving google.com (google.com)... 2a00:1450:400e:802::200e, 142.250.179.174
Connecting to google.com (google.com)|2a00:1450:400e:802::200e|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2021-08-12 23:55:48-- http://www.google.com/
Resolving www.google.com (www.google.com)... 2a00:1450:400e:80f::2004, 142.251.36.4
Connecting to www.google.com (www.google.com)|2a00:1450:400e:80f::2004|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’
index.html [ <=> ] 13.03K --.-KB/s in 0.009s
2021-08-12 23:55:48 (1.44 MB/s) - ‘index.html’ saved [13342]
root@test:~# wget --bind-address=2001:bc8:1830:1b18::2 google.com
--2021-08-12 23:55:52-- http://google.com/
Resolving google.com (google.com)... 2a00:1450:400e:802::200e, 142.250.179.174
Connecting to google.com (google.com)|2a00:1450:400e:802::200e|:80...
lsof
wget 프로세스에 대해 다음과 같이 말합니다: wget 3413 root 3u IPv6 58660 0t0 TCP[2001:bc8:1830:1b18::2]:56623->ams15s41-in-x0e.1e100.net:http (SYN_SENT)
내가 도대체 뭘 잘못하고있는 겁니까? 많은 감사드립니다!