How to curl using IPv6 address?

I have a VPS with a /64 IPv6 assigned to it. When I try to curl using one of the IPs in the block, this is the error I get:

curl --interface '2a02:c207:2010:1077::2' curl: (45) bind failed with errno 99: Cannot assign requested address 

What exactly do I need to do to fix this? Shouldn't I be able to use any IP on the machine when logged in as root?

Basically I just need the ability to curl using any IPv6 assigned to the VPS.

1

2 Answers

after some testing, I find the following command works:

$ curl -g -6 '

interface 'eth0' is the interface with ipv6 enabled, so you may need to replace it with something else.

and just in case, the telnet command to test ipv6:

$ telnet -6 fe80::3ad1:35ff:fe08:cd%eth0 80

From man curl

--interface specify interface e.g. eth0:1

curl --interface eth0 -g -6 ' -H 'Host: 

It feels like you are expecting curl to manipulate your machine's interfaces to add-and-then-use a specific /128 ? If you want that you will probably have to write your own shell wrapper.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like