When I'm trying to ping6 my VirtualBox machine, I'm getting the following error:
$ ping6 fe80::a00:27ff:fe1e:42d9
connect: Invalid argument
Of course, I have already googled and found that I can avoid that by appending an interface name to that IPv6 address itself - and indeed, it's working fine:
$ ping6 fe80::a00:27ff:fe1e:42d9%vboxnet0
PING fe80::a00:27ff:fe1e:42d9%vboxnet0(fe80::a00:27ff:fe1e:42d9) 56 data bytes
64 bytes from fe80::a00:27ff:fe1e:42d9: icmp_seq=1 ttl=64 time=0.239 ms
64 bytes from fe80::a00:27ff:fe1e:42d9: icmp_seq=2 ttl=64 time=0.272 ms
64 bytes from fe80::a00:27ff:fe1e:42d9: icmp_seq=3 ttl=64 time=0.283 ms
However, I'm feeling uncomfortable about that. What shall I do in order to make it working just as 'ping6 fe80::a00:27ff:fe1e:42d9' in my local network?
With link-local IPv6 addresses you always have to specify the interface. The reason is that the same address block (prefix) is used on every network, and most systems have multiple network interfaces (loopback, ethernet, wifi, virtual-box networks, some dongle etc.). The system therefore can't know what to do based on only the address. The address fe80::a00:27ff:fe1e:42d9 is only unique on a specific link (interface). On a different link the same address might be a completely different system.
Because of this link-local addresses are usually not very useful for manual use. You'd have to specify the interface every time you use them, and on a different system the interface name might be different so you can't send somebody a link with the address. You'd have to know that the person/software you send it to is actually connected to the right link (you can't route link-local addresses, they are only usable on the link itself), and what the interface name for that link is on their system.
That doesn't mean that link-local addresses are useless. They are very useful for automatic processes running on the link. For example Neighbor Discovery (to find other systems on the link), Router Advertisements (to communicate default gateways and network settings), DHCPv6 (for automatic host configuration), routing protocols like OSPFv3 (for communicating with neighbours), mDNS (local service discovery) etc etc etc. But they aren't very useful for manual use. Many browsers don't handle them properly in URLs either.
So, what you really need are "real" IPv6 addresses with a global scope that you can route. That way the routing table of your system knows which addresses are used where, and you don't have to manually specify the interface. There are multiple ways of getting routable IPv6 addresses.
If you have an internet provider then they will usually provide you with IP addresses. For IPv4 they often provide you with one globally unique address (if any, IPv4 addresses have run out and many people have to share to keep IPv4 running). For IPv6 they usually provide you with a /48 (65536 subnets, each consisting of an as-good-as unlimited number of IPv6 addresses) or a /56 (356 subnets). The idea behind IPv6 is that you always get much much more than you'll ever need.
If you are a large organisation or internet provider you can request your own address blocks from your regional internet registry (RIR). I'll skip over this for now, but feel free to ask a follow-up question if you want to know more!
The last option, for example if your internet provider doesn't give you IPv6 addresses (shame on them, but there are still plenty of providers that live in the stone age ;) and you don't want to connect your systems to the internet, then you can generate your own private IPv6 addresses. As I said you won't be able to communicate with systems on the internet with these (you need an internet provider to connect you and give you addresses for that) but they are great for testing and little islands of networks. They are called ULA (unique local addresses) and you can generate them on your own. To avoid conflicts between different networks (ULA isn't globally routable, but maybe you want to set up a VPN to your friends or something like that) the MAC address of one of your systems is usually used to generate the ULA prefix. Try for example https://cd34.com/rfc4193/ and enter a MAC address. It will do the calculations for you and give you a block of IPv6 addresses to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With