Possible Duplicate:
Can I bind a (large) block of addresses to an interface?

I have a /48 IPv6 block. I'd like to be able to do this:

$ wget --bind-address=<1st-ipv6> http://www.some-url.com
$ wget --bind-address=<2nd-ipv6> http://www.some-url.com
$ wget --bind-address=<3rd-ipv6> http://www.some-url.com

for any of the 2^80 available IPs in my /48 block.

According to my tests, assigning lots of IPs to an interface makes things slow (in terms of HTTP requests per second). And obviously, I can't assign billions of IPs to one interface. Is there a way to tell Linux to accept any IP that belong to my /48 block, or to modify wget so that it can be done?

Jan 17 2013 EDIT: I found out how to do it. Your kernel version must be at least 3.3, because from this version, this patch is applied: http://lists.openwall.net/netdev/2011/11/08/8

Then you have to run as root (as said by David Schwartz):

# ip -6 route add local your_ipv6_block/48 dev lo

You have to assign this route to the lo interface, even if it won't be the outgoing interface to reach the Internet.

Then you have to modify wget's sources. In src/connect.c, inside the function connect_to_ip(), after the socket is created, add this:

setsockopt(sock, SOL_IP, IP_FREEBIND, &v, sizeof(v));

Then compile wget (the compiler may complain about IP_FREEBIND not being defined, how to solve this is out of scope here) and install it.

Then you can successfully do:

$ wget --bind-address=<any_ipv6_in_your_block> http://www.some-url.com
  • 1
    The answer is here. Basically ip route add local ... dev lo. Jan 10, 2013 at 18:05
  • I tried "ip route add local xxxx/48 dev lo". It does not return any error, but when I try "wget --bind-address=..... whatismyv6.com", wget says "Cannot assign requested address". Same thing with "ip route add local xxxx/48 dev eth0".
    – raco
    Jan 10, 2013 at 20:01
  • Such a patch should be submitted upstream to the software maintainer, so that everyone will (eventually) get it. Jan 17, 2013 at 22:09

1 Answer 1


Assuming you doing this to load test your web server you could have a look at curl loader

This will make requests to a web server and use a different client IP for each request, it can also request different pages on the same connection simulating a user, for example going to a login page and logging in then logging off, etc

It will work with IPv4 and IPv6 and sets up the IP address's for you so all you need to do is give it an IP range, a url and maximum number of connections and concurrent connections, then run the command.

Not the answer you're looking for? Browse other questions tagged or ask your own question.