IPv6 Loopback Addresses (equivalent to 127.x.x.x)

ipv6loopback

I have a development environment set up where I have a separate loopback address for multiple websites.

For example, I have the following:

127.0.0.1 www.example.com
127.0.0.2 foo.example.com
127.0.0.3 bar.example.com
127.0.0.4 waffles.example.com

I'd like an equivalent solution for IPv6.

I already know that you can use ::1 as a loopback address, but ::2, ::3, etc don't seem to work.

Are there any other loopback addresses in IPv6? Is there a way to have multiple unique loopback addresses?

Best Answer

Technically ::2, ::3 etc. are part of ::0.0.0.0/96, the "ipv4 compatible ipv6 address" range. It's deprecated, but you probably don't want to use that range.

For a lab environment, use unique local addressing. Go to https://www.ultratools.com/tools/rangeGenerator and generate yourself a prefix. Then you can pick whatever addresses you want out of that prefix, and assign them to the loopback interface.