How can I access a web server or website using the link-local IPv6 address?
Below is the ipconfig output of the computer hosting the web server:
Ethernet Adapter Local Area Connection:
DNS suffix for a specific connection. : 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 with, say, " http://10.213.254.119/test " Now I am curious to know how can I access the same page using the local IPv6 address link?
I found that most browsers don't support scope IDs in URLs. Since realm IDs are usually required for link-local addresses, this means that these browsers cannot access link-local addresses. Creating a DNS record pointing to the link-local address will also not work because the DNS record cannot specify a realm ID.
Sometimes I needed to access the web interface of equipment that was not even on the same link. This means that I will have two obstacles preventing me from using the local address to access it. But I found a simple method that solved both of these problems for me.
Run an ssh client on the host that the browser is running on. Connect to a host with a direct link to the equipment I want to access via link-local address and set up port forwarding. For example, the command for this might look like this:
ssh -L '8080:[fe80::200:5eff:fe00:53b6%eth0]:80' host.example.com
At the moment, I can access it via localhost, which does not require identifier scope: http://[::1]:8080/
. This of course also works if the ssh client and ssh server are running on the same machine as the web browser.
Most browsers do not support this, and even if they did, you would have to use a URL such as http://[fe80::f85b:4256:ee76:24a4%eth0]/
where eth0
is the link id on the client system and therefore may be different for each client.
Better to use a routed IPv6 address.
You can access it with curl as:
curl -6 -g --interface eth0 "http://[e80::f85b:4256:ee76:24a4]:8080" -vvv