LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-24-2011, 10:46 PM   #1
itismohit
LQ Newbie
 
Registered: Jun 2010
Posts: 8

Rep: Reputation: 0
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.

Last edited by itismohit; 08-26-2011 at 02:26 AM.
 
Old 08-26-2011, 01:48 PM   #2
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,678
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
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.
 
Old 08-29-2011, 04:58 AM   #3
itismohit
LQ Newbie
 
Registered: Jun 2010
Posts: 8

Original Poster
Rep: Reputation: 0
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
 
Old 08-29-2011, 10:12 AM   #4
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,678
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by itismohit View Post
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.
The IP addresses are most likely a linked list. The kernel doesn't need any "handle" or "tag" or "identifier". If it needs to see if any interface has [fc00::1234] it can just scan all of them sequentially and that's not a performance hit in most cases (it doesn't need to do this with traffic, but might with neighbor discovery, or ARP for v4).

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]
 
Old 08-30-2011, 07:20 AM   #5
itismohit
LQ Newbie
 
Registered: Jun 2010
Posts: 8

Original Poster
Rep: Reputation: 0
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.
 
Old 08-30-2011, 01:11 PM   #6
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,678
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by itismohit View Post
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.
If it requires the handle be an interface name, then it is a bad API design that assumed things that not only were not guaranteed, but did not exist in other Unix systems, and have come to pass that they are not so in Linux, either.

Quote:
Originally Posted by itismohit View Post
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.
So the API is just passing data between two components you are coding, and is limited to 32 bits? Interface names can be longer. The alias hack is NOT limited to 32 bits or to numbers. Characters can be used, and it appears the entire interface name limit is 15 characters:
Code:
lorentz/root /home/root 210# ifconfig eth1:alongalias 10.20.30.40 netmask 255.0.0.0
lorentz/root /home/root 211# ifconfig eth1:alongalias
eth1:alongalias Link encap:Ethernet  HWaddr 00:25:90:14:c4:59  
          inet addr:10.20.30.40  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:17 Memory:fbde0000-fbe00000 

lorentz/root /home/root 212#
 
  


Reply

Tags
interface, ipv6, linux, multiple, virtual


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Another IPv6 Crash Course For Linux: Real IPv6 Addresses, Routing, Name Services LXer Syndicated Linux News 0 04-21-2011 07:40 AM
Need sendmail to split single envelope into multiple To: addresses Dan_in_NH Linux - Server 1 08-04-2010 04:07 PM
LXer: Tutorial: Assigning Multiple Addresses to a Network Interface LXer Syndicated Linux News 0 10-10-2008 04:30 PM
how do i group multiple global ip addresses on a single network iterface? shinacalypse Linux - Networking 3 09-08-2003 06:07 AM
Multiple addresses for a single NIC grub Programming 1 08-04-2003 02:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration