7

下面是托管 Web 服务器的机器的 ipconfig 的输出:

以太网适配器本地连接:

连接特定的 DNS 后缀。:链路本地 IPv6 地址。. . . . : fe80::f85b:4256:ee76:24a4%11 IPv4 地址。. . . . . . . . . . :10.213.254.119 子网掩码。. . . . . . . . . . :255.255.255.0 默认网关。. . . . . . . . : 10.213.254.252

我可以使用说:“ http://10.213.254.119/test ”访问该网站现在我很想知道如何使用链接本地 IPv6 地址访问同一页面?

4

3 回答 3

7

I found that most browsers don't support scope identifiers in URLs. Since scope identifiers are usually required for link-local addresses, that means those browsers can't access link-local addresses. Creating a DNS entry pointing to the link-local address won't work either since the DNS entry cannot specify a scope identifier.

Sometimes I have needed to access the webinterface of equipment which wasn't even on the same link. That means I would have two obstacles preventing me from using a link-local address to access it. But I found a simple method which solved both of those problems for me.

Run an ssh client on the host where the browser is running. Connect to a host with a direct link to the equipment I want to access through a link-local address, and set up a port-forwarding. For example the command to do so could look like this:

ssh -L '8080:[fe80::200:5eff:fe00:53b6%eth0]:80' host.example.com

At this point I can access it through localhost, which doesn't require a scope identifier: http://[::1]:8080/. This of course also works if ssh client and ssh server happen to both be running on the same machine as the webbrowser.

于 2015-07-20T07:28:29.897 回答
4

You can access it using curl as:

curl -6 -g --interface eth0 "http://[e80::f85b:4256:ee76:24a4]:8080" -vvv

于 2016-10-06T20:23:03.350 回答
3

大多数浏览器不支持这一点,即使他们支持,您也必须使用一个 URL,例如客户端系统上链接的标识符http://[fe80::f85b:4256:ee76:24a4%eth0]/where eth0,因此每个客户端可能会有所不同。

最好使用可路由的 IPv6 地址。

于 2015-07-16T07:26:34.703 回答