IPv6 stateless auto-configuration, random number generation for host identifier

180 views
Skip to first unread message

Robert Greig

unread,
Jan 13, 2014, 1:19:31 PM1/13/14
to ns-3-...@googlegroups.com
Hello,

I'm new to NS3 and have been searching for building a stateless auto-configured Mobile Ad Hoc Network. I want the nodes to generate their own host identifier themselves, which would use 64 bits of the 128 bits. Does anyone know of a way of doing this? This function of IPv6 was not implemented in any of the IPv6 modules I looked at on nsnam.org as was deemed an unnecessary function to implement. 

If anyone can point me in the right direction that would be great :)      

Tommaso Pecorella

unread,
Jan 13, 2014, 3:31:36 PM1/13/14
to ns-3-...@googlegroups.com
Hi,

unfortunately (or fortunately for you), I'm quite an expert of the matter… so I hope to be able to help you on this (by the way, the manual was recently updated on this point).

IPv6 auto configuration… interesting topic. Let's recall some points (not only for you, for anybody reading this).

IPv6 addresses can be configured in a number of ways:
1) manually - the ugly way, like IPv4.
2) Stateless address autoconfiguration (SLAAC)
3) DHCPv6, like IPv4.

SLAAC is defined in RFC 4862, and it can be divided in different phases:
1) find a link-local address based on your EUI64 (derived from your MAC address)
2) do a Duplicate Address Detection. If it fails, generate a new EUI64 randomly and repeat point 1
3) search for a router - obtain a Router Advertisement (RA)
4) from the RA, derive a global address
5) repeat the DAD, this time on the global address

Points 3-5 require a Router Advertisement Demon (RADVd) in a router.

Now, about ns-3 what you can do.

You have two options:
1) assign addresses through the Ipv6AddressHelper. this is a "strange" way, only available in simulators. It's a sort of manual address assignment.
2) use RADVd… it's what you're looking for :)

examples/ipv6/radvd.cc
and
examples/ipv6/radvd-two-prefix.cc

The only issue for MANETs is that, in order to communicate with the router, your MANET routing should be already working, perhaps with link-local addresses.
However, link-local addresses are … link-local, and it's not obvious how to route them. Link-local addresses, as a matter of fact, are only valid on a link, which for multi-hop network just on hop (unless you specifically say otherwise in a RFC).

So, either all the nodes are also routers, propagating RAs (beware of the default gateway, tho), or the MANET-specific routing have to know how to reach "the" router (usually the border router).

I hope to have clarified some points… but to tell you exactly if what you want to do is feasible, I should first know what MANET routing protocol you plan to use.

Cheers,

T.

Robert Greig

unread,
Jan 13, 2014, 4:54:38 PM1/13/14
to ns-3-...@googlegroups.com
Hi Tommasco,

Thanks for the help, very fortunate for me :) 

I was planning on using AODV, although the specific protocol used isn't fixed. The main focus for me is to investigate an IPv6 stateless auto-configuration scheme for a MANET. 

Would it be possible to generate a link-layer address so that they are locally routable?  

Yes that was very helpful, all the nodes would also have to be routers. I can only use mobile nodes, no fixed infrastructure or reliance on a single node as router. The nodes are in movement and presumed to be too unreliable due to movement outside of transmission range and also a node may go down due too running out of battery power.  

thanks you,
Robbie.

Tommaso Pecorella

unread,
Jan 14, 2014, 2:24:06 AM1/14/14
to ns-3-...@googlegroups.com
Hi,

technically speaking, a link-local address cannot be routed by definition. Of course you can bend the standards, but it wouldn't be wise.
Another solution (to reach the router) would be to use ULA instead of Link-local, but then again, it's forcing the standard.

The "standard" solution is, as I said, to have all the nodes/routers sending RAs. The only (problem?) could be about who's the advertised default router. RA can carry it or not. How to deal with it depends on you.
I don't remember if RA can carry a delegate default router, as is say "this is the prefix, and the default router is this (maybe use a site-local address instead of a global). Check the rfc.

Another problem you might face, tho, is that AODV doesn't support IPv6, but that's a different problem.

Cheers,

T.

Robert Greig

unread,
Jan 14, 2014, 7:39:13 AM1/14/14
to ns-3-...@googlegroups.com
Hi,

You've given me plenty food for thought here, I'll look into using RAs. Would you mind if I got back to you after I've done some more studying? I don't want to take up too much of your time, I'm finding what you have to say very useful. 

Yes that is definitely a problem, are there any IPv6 compliant protocols I can use in NS3 you would recommend which would be suitable on a MANET? 

Thank you,
Robbie




--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/evM1Utkv13U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/groups/opt_out.

Tommaso Pecorella

unread,
Jan 14, 2014, 1:43:33 PM1/14/14
to ns-3-...@googlegroups.com
Hi,

of course you can come back at me, I'm always available. If I don't answer in 2 days, feel free to use direct e-mail.

About the routing protocol, I'd say that adapting one of the existing ones could be a good option. It really depends on the mobility and speed of the MANET tho.

Cheers,

T.

Robert Greig

unread,
Feb 3, 2014, 12:25:57 PM2/3/14
to ns-3-...@googlegroups.com
Hi Tommaso,

Sorry for the long delay between this post and the thread. I've just been able to get back into my project again last week. Thanks for the posts so far they have helped me understand this subject better.

I had a read of rfc 4862 and again over your posts so hopefully I've understood them right and should be able to use the following process:

1) Generate link local address on system start up I would use the random number generator. Which is RADVd
2) Perform DAD on interface link between one hop scope nodes 
3) Create global address taking  the network prefix and appending to the link local address. So the host individual identifier would remain the same but the network half of the address would be changed using the RAs.
4) DAD again 
5) IP address can now function in a multi-hop environment  and be learned by the nodes also acting as routers. 

I'm a bit confused by two points though:

1) How would the network prefix be generated? Would I need to implement something myself or is there a way to do this using SLAAC that I missed.
2) Given that the host identifier is 64 bits long (extremely unlikely duplication) and that DAD is not 100% in detecting duplication. Is it not worth just skipping the DAD procedure. I read in section 4 you can do this but in section 5 it must not be done for new implementations. Do you think skipping this would be a reasonable thing to do?

The mobility of the MANET will be walking speed, do you know how large a task configuring an existing protocol would be to make it IPv6 compliant? This may be a problem if it would take a long time, is there anywhere I can ask to use someone else's IPv6 compliant routing protocol? 

Thanks for your time, much appreciated :)

Robbie

Tommaso Pecorella

unread,
Feb 3, 2014, 2:00:18 PM2/3/14
to ns-3-...@googlegroups.com
Hi Robert,

Yes, it's quite unlikely that two EUI64 will collide, but it happens. It's hard, but it's possible, so DAD is mandatory.
It's not a big issue anyway, ns-3 already takes care of it. If you wanna skip it, there's an attribute to set.

About the network prefix, it's a RADVd setup. E.g., in examples/ipv6/radvd.cc

  /* radvd configuration */

  RadvdHelper radvdHelper;

  /* R interface (n0 - R) */

  radvdHelper.AddAnnouncedPrefix(iic1.GetInterfaceIndex (1), Ipv6Address("2001:1::0"), 64);

  /* R interface (R - n1) */

  radvdHelper.AddAnnouncedPrefix(iic2.GetInterfaceIndex (1), Ipv6Address("2001:2::0"), 64);


  ApplicationContainer radvdApps = radvdHelper.Install (r);

  radvdApps.Start (Seconds (1.0));

  radvdApps.Stop (Seconds (10.0));


Routing: it depends on the mobility / message frequency / bandwidth. If the bandwidth is low, then a "normal" routing protocol would fail. Same for very infrequent packets sent (the routing overhead would exceed the normal packets bandwidth).
Modifying an existing routing protocol to be IPv6 complaint shouldn't be that hard, but I haven't tried it myself.

Cheers,

T.

Robert Greig

unread,
Feb 3, 2014, 2:21:55 PM2/3/14
to ns-3-...@googlegroups.com
Thanks for the quick reply Tommaso, these points on IPv6 have cleared up some confusion for me with the implementation. 

Good to know that its not to hard to modify an existing protocol, if I run into problems with this I'll hassle some other poor fellow XD

Thanks you once again Tommaso,

All the best,
Robbie
Reply all
Reply to author
Forward
0 new messages