How do I access the web server or website using link local IPv6 address?

Ritesh Agarwal picture Ritesh Agarwal · Jul 16, 2015 · Viewed 9.3k times · Source

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?

Answer

kasperd picture kasperd · Jul 20, 2015

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.