Assign specific IPv6 address of subnet to cURL Assign specific IPv6 address of subnet to cURL curl curl

Assign specific IPv6 address of subnet to cURL


cURL cannot bind to 2a01:4f8:XXXX:YYYY::3 because 2a01:4f8:XXXX:YYYY::3 is not an IP local address assigned to any interface. Hosts can only receive packets on addresses that are assigned to them, and, accordingly, you can only bind to those addresses.

As you described, if you do add 2a01:4f8:XXXX:YYYY::3 as an address on the interface using ip addr add, it works. That is to be expected.

I don't know of a way to assign a large group of addresses to the local system without having to add them one by one. There is a trick but it only works for some operating systems (perhaps only Linux) and only for IPv4 and only for the loopback interface.


You misunderstand the meaning of the netmask. In both your examples you configure one address on the interface. The netmask you specify is that of the whole network.

If you want to use multiple addresses you will have to configure each of them separately.