Need to know Linux internals on multiple IPv6 addresses on single interface.
Hi,
Thanks for the time in advance... What I Need... I need to understand how linux manages multiple IPv6 addresses on a single interface without using aliases unlike IPv4 where aliases are used. Is there an internal indexing on multiple IP's on same interface? Why I Need this... I am trying to write a piece of code for assigning multiple global virtual IPv6 address to an interface in a cluster environment. I need to return an integral handle to the calling app. This handle will then be used to find out which ip address was assigned and be deleted if required. Prototype for the function is as follows : int32 addVirtualIp(char *interface, char *ipaddress); Returns handle, to be used to delete the assignment later. -1 on failure. |
The method used in IPv4 using alias interface names was a bad hack. With IPv6 you simply add and delete IPv6 addresses. I'm hoping they will make this work with IPv4, too, soon. It sort of works now (you can actually add them) but not really (they don't do what is expected).
With IPv6 this is very simple. You add or delete what you want to be there or not be there. In your code, if a calling app is asking for an IPv6 address to be dynamically assigned, and needs a handle to find out which address ... just give it the IPv6 address itself. If you have a size limit on handles that prevents this, then store the IPv6 addresses in a file in some directory designated for this purpose, and pass it the name of the file, letting it read the IPv6 address from there and remove the file. |
Thanks for your inputs.
You are right, I can write the IP to a file, or as I need to return an integer I can write the map (key{unique handle}, value{ipv6 address}) to the file. But I don't want to do that. That's the whole point. I don't want any I/O operations. The kernel must be maintaining this information, and there has to be some unique identifier, which the kernel must be using to maintain the information. That's exactly what I am looking for. Thanks, Mohit |
Quote:
So, basically, there won't be any such identifier, anymore. These I/O operations you are trying to avoid ... isn't that also involved in passing the interface alias name? Or is the interface alias name short enough to allow avoiding I/O where the full IPv6 address is too long?[/QUOTE] |
Actually, I am working on a middleware and the API, I am exposing to the applications requires an integral handle.
Now, for IPv4 the address is assigned to an alias say, eth1:2, Now 1 & 2 can be used to uniquely identify the logical interface and the associated address. So I am keeping 0x00000102 in my integer and using this to later fetch the information. And I am looking for a similar solution for IPv6. Now, as you said, if there is nothing that can work like this, then I probably would have to devise some compression/decompression algorithm b/w 128 bit ipv6 address and 32 bit handle. Thanks anyways for your help. |
Quote:
Quote:
Code:
lorentz/root /home/root 210# ifconfig eth1:alongalias 10.20.30.40 netmask 255.0.0.0 |
All times are GMT -5. The time now is 05:30 PM. |