How do I set the loopback address in IPv6?

 

Loopback interfaces are for private use only by software running on the C Series Controller, to communicate with other software also running on the same C Series Controller.

To configure a loopback interface for IPv6:

  1. Click Configure, and expand Interfaces>Interface: lo>Unit>Family.

  2. Click Inet6.

    The Inet6 pane appears.

  3. From the Create new list, select Address.

  4. In the dialog box, type a name for the new address, and click OK.

  •  Configuring Loopback Interfaces for IPv4 (C-Web Interface)

  •  Configuring Gigabit Ethernet Interfaces for IPv4 (C-Web Interface)

  •  Configuring Gigabit Ethernet Interfaces for IPv6 (C-Web Interface)

  •  Configuring Tunnel Interfaces (C-Web Interface)

 

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?

How do I set the loopback address in IPv6?

kasperd

29.9k16 gold badges72 silver badges122 bronze badges

asked Oct 21, 2010 at 12:54

How do I set the loopback address in IPv6?

2

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.

How do I set the loopback address in IPv6?

answered Nov 7, 2010 at 21:32

Ben JencksBen Jencks

1,3518 silver badges13 bronze badges

2

I recommend using RFC 4193 addresses for this. RFC 4193 allows you to construct your own /48 for local use by taking the byte value fd followed by 5 random bytes. You are allowed to put anything you see fit after the first 48 bits, so if you wanted a /64 you can take fd followed by 7 random bytes as in this example for Linux systems:

ip -6 route add to local fd66:29e9:f422:8dfe::/64 dev lo

Using RFC 4193 has the advantage compared to earlier answers that you are not violating any RFCs in doing so and the addresses can be used without an interface identifier.

Each of the ranges mentioned in earlier answers are either using ranges reserved for different purposes or link-local addresses which require an interface identifier whenever used.

There exists an expired draft suggesting that the range 1::/32 gets allocated for additional loopback addresses like you are asking for. However since that draft expired years ago and no such allocation was ever made you cannot use 1::/32 for this.

answered Oct 12, 2018 at 15:14

How do I set the loopback address in IPv6?

kasperdkasperd

29.9k16 gold badges72 silver badges122 bronze badges

1

Your loopback adress is ::1/128. Note the width of the subnet which restricts it to just one host. change the subnetmask to something wider and check your routing table. Or use link-local adresses.

answered Oct 21, 2010 at 13:11

FladiFladi

8504 silver badges7 bronze badges

2

There is a RFC proposal called A Larger Loopback Prefix for IPv6, which proposes using 1::/32 as loopback addresses. However, the proposal was not approved and expired already in 2013.

How do I set the loopback address in IPv6?

answered Jan 12, 2019 at 15:04

F.RaabF.Raab

1412 bronze badges

3

jcomeau@aspire:~/rentacoder/jcomeau/kybyz$ sudo ip route add local ::/104 dev lo 
jcomeau@aspire:~/rentacoder/jcomeau/kybyz$ ping6 ::2
PING ::2(::2) 56 data bytes
64 bytes from ::2: icmp_seq=1 ttl=64 time=0.083 ms
64 bytes from ::2: icmp_seq=2 ttl=64 time=0.128 ms
^C
--- ::2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.083/0.105/0.128/0.024 ms
jcomeau@aspire:~/rentacoder/jcomeau/kybyz$ ping6 ::3
PING ::3(::3) 56 data bytes
64 bytes from ::3: icmp_seq=1 ttl=64 time=0.148 ms
64 bytes from ::3: icmp_seq=2 ttl=64 time=0.141 ms
64 bytes from ::3: icmp_seq=3 ttl=64 time=0.142 ms

from Can I bind a (large) block of addresses to an interface?

it's the only thing that worked for me. linux-specific, of course.

nota bene: because this may conflict with 0.0.0.0/8 addresses at some time in the future, ::127.0.0.0/104 would probably be a better choice.

answered Aug 14, 2015 at 8:52

5

Using link-local addressing seems to be the only valid option. What most suggestions here ignore is the fact that the IPv6 prefix declares scope, and I would not want my presumably private addressing to be in global scope.

So for Linux:

$ sudo ip -6 address add fe80::1/64 dev lo
$ sudo ip -6 address add fe80::2/64 dev lo
$ sudo ip -6 address add fe80::3/64 dev lo

And specify interface when referring to such addresses. Testing with netcat:

$ nc -l -p 10001 fe80::1%lo
$ nc fe80::1%lo 10001

Verifying correct scope:

$ ip -6 a
1: lo:  mtu 65536 
    inet6 fe80::1/64 scope link 
       valid_lft forever preferred_lft forever

Still it seems not very elegant having to add every single IP to be able to bind to it. With 127.0.0.0/8, you can bind to any address without prior assigning them.

answered Feb 5, 2016 at 15:03

korkmankorkman

1,6472 gold badges13 silver badges26 bronze badges

4

How is a loopback address specified in IPv6?

The loopback address in IPv4 is 127.0. 01. In IPv6, the loopback address is 0:0:0:0:0:0:0:1 or ::1.

How do you set a loopback address?

To configure an IP address for the loopback interface, enter the ip address command at the loopback interface configuration level as shown in the following example. Note that when you configure an IP address for a loopback interface, you do not specify a network mask. The default subnet mask 255.255.

How do you ping a loopback address in IPv6?

At the command line, type these commands: For IPv4: PING '127.0. 0.1' or PING LOOPBACK. For IPv6: PING '::1' or PING 'IPV6-LOOPBACK'

What is the equivalent of 127.0 0.1 in IPv6?

The name localhost normally resolves to the IPv4 loopback address 127.0. 0.1, and to the IPv6 loopback address ::1.