If you are working with your code in TCL may be you can make a map  
Node_ID (from ns) to an IP address in your TCL script. If you are  
working in C++ you can do what Sidney proposes.

        Either way you have a way to do it, may be not trivial but definitely  
possible.

-as

On 5 Nov 2008, at 15:55, Sidney Doria wrote:

>
> The best of NS-2 is its flexibility. If you didn't find a trivial
> solution to assign a simple IP to a node, you can add a new attribute
> to an inherited class of node. You can simply bind this new attribute
> in your TCL script and assign what IP you want on the node you want.
>
> The new atrribute can be of type nsaddr_t (IP address).
>
> Hope to be useful,
>
> Sidney Doria
> Brazil
>
> 2008/11/5 Marlos Marques <[EMAIL PROTECTED]>:
>>
>> Hello all,
>>
>> Currently, I am trying to implement an application layer multicast  
>> algorithm
>> using NS2. For this purpose I need to assign IP address to every  
>> node in
>> NS2. I checked out the NS2 nodes may have hierarchical routing  
>> addressing
>> which is similar to IP addressing. But, I also found the "addr"  
>> command
>> which apparently allows you to configure the node IP, so I can run  
>> the
>> following code:
>>
>> set ns [new Simulator]
>> set n0 [$ns node]
>> set n1 [$ns node]
>> $n0 addr "192.168.1.1"
>> $n1 addr "192.168.1.2"
>>
>> But in the trace file I keep getting sequential identifiers. For  
>> example:
>>
>> + 0 1 2 tcp 40 ------- 2 1.0 5.0 0 0
>>
>> But I would like to get this one:
>>
>> + 0 192.168.1.1 192.168.1.2 tcp 40 ------- 2 1.0 5.0 0 0
>>
>> What am I doing wrong?
>>
>>
>> Thanks in advance,
>> Marlos
>>
>
>
>
> -- 
> Sidney Doria
> Redes ad hoc móveis
> Mestrado em Computação
> UFCG
> Brasil
>
> "Nessa jornada, o conhecimento será o seu escudo..."
> (Mestre dos Magos no episódio do grimoire de ouro)
>

Reply via email to