How do I access the web server or website using li

2020-07-17 14:36发布

问题:

Below is the output of the ipconfig of the machine where web server is hosted:

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::f85b:4256:ee76:24a4%11 IPv4 Address. . . . . . . . . . . : 10.213.254.119 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 10.213.254.252

I can access the website using say: "http://10.213.254.119/test" Now I am interested to know how can I access the same page using link local IPv6 address?

回答1:

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.



回答2:

You can access it using curl as:

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



回答3:

Most browsers don't support that, and even if they did you would have to use a URL like http://[fe80::f85b:4256:ee76:24a4%eth0]/ where eth0 is the identifier of the link on the client system, and so can be different for each client.

Better to use routable IPv6 address.