I have a range of ipv6 addresses available (native) and want to use them. I 've setup the kernel to support ipv6 and installed the necessary tools (iproute2 etc).
I am having a problem understanding how to actually add the range for the server to use it. Do I have to configure each one separately or is it possible to add the whole range?
Also, after I recompile the programs to support ipv6 (Gentoo), is there an expected strategy on which ip they 'll be using for outgoing connections (assuming the other end is ipv6 enabled)? Is it random, is it the first one, is it something entirely different?
You have to add each IP address you want to use manually. When applications talk over IPv6, by default they use the last address assigned unless bound to a specific port (which is application-specific).
The answer posted by @NathanC isn't completely accurate.
There are two ways in which you can make Linux treat IPs as locally assigned:
The traditional way where you add each address with its subnet - this is the easiest way to do things if it's an onlink address.
ip addr add 2001:db8::1/64
- adds a single IP.Add a route that treats the subnet as "local".
ip rou add local 2001:db8::/64 dev lo
The caveat to 2. is that you cannot bind programs to specific IP addresses within the local route and they must instead listen on the unspecified address (
::
) in order to receive traffic for the local route and requires you use Linux 2.6.37 or newer.To make 2. work, the subnet should be routed to the machine, you can do proxy_nd in order to make it work, but this is a terrible idea if a lot of addresses are going to be used. Actually, it's a terrible idea in general, but, sometimes there's no way around it if your provider won't give you a routed subnet.