ip addresses of routers

39 views
Skip to first unread message

sofi

unread,
Dec 26, 2017, 3:40:54 PM12/26/17
to ns-3-users
Dear NS3-users
I want to display ip addresses of routers in the packet path, I don't know where I put exactly this code in the ipv4-l3-protocol.cc:

Ipv4Address address= m_node->GetObject<Ipv4>()->GetAddress (1,0).GetLocal();
std::cout << "***************************"  << address << std::endl;

Please I need your help.

Tommaso Pecorella

unread,
Dec 26, 2017, 4:15:00 PM12/26/17
to ns-3-users
Hi,

Ipv4L3Protocol::IpForward
is the function you'll looking for.

T.

sofi

unread,
Dec 26, 2017, 4:28:03 PM12/26/17
to ns-3-users
Thank you for your replay. I think rtentry is related to the current router but how can I get its Ip address from this variable??

Tommaso Pecorella

unread,
Dec 26, 2017, 5:55:05 PM12/26/17
to ns-3-users
Hi,

well, a router has many IP addresses (at least 2). "rtentry" can lead you to the output interface, i.e., the one that the router will use to forward the packet.
If that's what you want, rtentry->GetSource() should give you the right number.

T.

sofi

unread,
Dec 26, 2017, 6:29:42 PM12/26/17
to ns-3-users
Dear Sir, I put this code :
Ipv4Address address= rtentry->GetSource();
std::cout << "***************************"  << address << std::endl; 

in IpForward method but no display. I put it in SendRealOut method so I obtain just source and destination addresses  (no intermidiate routers address):
Ipv4Address address= route->GetSource();

result:
Flow ID : 1 ; 10.1.1.4 -----> 10.1.1.9
Tx Packets = 8
Rx Packets = 8
Duration : 21.0114
Last Received Packet : 21.0114 Seconds
Throughput: 0.00305591 Mbps
Delay = 2.11707
lost packet= 0
lost packet rate = 0
---------------------------------------------------------------------------
Flow ID : 2 ; 10.1.1.4 -----> 10.1.1.9
Tx Packets = 230
Rx Packets = 210
Duration : 22.9048
Last Received Packet : 22.9048 Seconds
Throughput: 0.0735866 Mbps
Delay = 5.18972
lost packet= 20
lost packet rate = 8.69565
---------------------------------------------------------------------------
Flow ID : 3 ; 10.1.1.5 -----> 10.1.1.9
Tx Packets = 8
Rx Packets = 8
Duration : 21.0064
Last Received Packet : 21.0064 Seconds
Throughput: 0.00305664 Mbps
Delay = 1.05663
lost packet= 0
lost packet rate = 0
---------------------------------------------------------------------------
***************************10.1.1.4
***************************10.1.1.9
***************************10.1.1.4
***************************10.1.1.9
***************************10.1.1.4
***************************10.1.1.9
***************************10.1.1.4
***************************10.1.1.9
***************************10.1.1.4
***************************10.1.1.9
***************************10.1.1.4
***************************10.1.1.9
***************************10.1.1.4
***************************10.1.1.9
***************************10.1.1.4
***************************10.1.1.9
***************************10.1.1.4
***************************10.1.1.9
***************************10.1.1.4
***************************10.1.1.9
***************************10.1.1.4
***************************10.1.1.5

Tommaso Pecorella

unread,
Dec 27, 2017, 5:41:19 AM12/27/17
to ns-3-users
What's exactly the question ?
As a side note, if you use a MAC-level forwarding (e.g., like in mesh networks) you'll not see anything at IP forwarding level.

T.

sofi

unread,
Dec 27, 2017, 10:35:52 AM12/27/17
to ns-3-users
Yes, I use a MAC-level forwarding (mesh networks) and I use precisely HWMP protocol. I know that I can not see anything at IP forwarding level, but 
1) there is a method to display ip addresses of intermidiate routers in hwmp-protocol.cc and what is exactly the method if this is possible???
2) Can I put the current router ip address in a message ( create new packet) and send it in other radio ( using other router interface??) different from the one of the forwarded packet in order to catch this message in the destination ?

Tommaso Pecorella

unread,
Dec 27, 2017, 6:28:29 PM12/27/17
to ns-3-users
Why are you (ab)using of my time with incomplete informations ?
Do you think that **I** have to figure out what you didn't mention in the first place ?

Answers:
1) Yes, but it's not that easy. Study HWMP and figure out what is the forwarding function.
2) No, you'll need to modify the HWMP packets.

T.

sofi

unread,
Dec 28, 2017, 4:35:26 PM12/28/17
to ns-3-users
Dear Sir
I am so sorry, thank you for your replay.
1) I display mac addresses of intermidiate routers in the method HwmpProtocol::DequeueFirstPacketByDst, but how obtain ip addresses from MAC ones still a problem for me.
2) I don't want  to modify HWMP packets, my idea is to create a control radio specified for routers to update and modify a secured message without changing anything in the forwarded packet (out of band approach: a specified radio permits routers to exchange a control information), if this is possible how can I implement this approach?? For this, I think to add a new packet passed through a sepecified interface.
Reply all
Reply to author
Forward
0 new messages