multiple routes to same destination in routing table

116 views
Skip to first unread message

Momo H

unread,
Apr 9, 2024, 3:41:08 PM4/9/24
to ns-3-users
I am collecting routing tables for every nodes, but found out two routes for the same destination,  i am wondering why there are two routes for the same destination?(may be there are two paths to the destination in my topology?) How would I know which one was used, Hence there is no entry for metric

===========Setup===============
I am calling the following functions to print out the routing tables, 

===========Code===============
    Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper>("tmp.routes", std::ios::out);
    Ipv4RoutingHelper::PrintRoutingTableAllAt(Seconds(21), routingStream);


===========Partial Output===============Priority: -10 Protocol: ns3::Ipv4GlobalRouting
Node: 8, Time: +21s, Local time: +21s, Ipv4GlobalRouting table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
...........
10.1.9.1        10.1.2.2        255.255.255.255 UH    -      -      -   r0-r1
10.1.9.1        10.1.7.2        255.255.255.255 UH    -      -      -   r0-r2
.......

Thanks for all



Tommaso Pecorella

unread,
Apr 9, 2024, 6:06:26 PM4/9/24
to ns-3-users
Hi,
yes, probably you have a route with two paths at the same cost. I don't remember if (by design) Ipv4GlobalRouting should only select one, in that case you found a bug.

It would be useful to have a sample script to show the issue.

Momo H

unread,
Apr 9, 2024, 9:29:14 PM4/9/24
to ns-3-users
Thanks for the reply, here is my complete script 
tmp.cc

Momo H

unread,
Apr 11, 2024, 5:01:14 AM4/11/24
to ns-3-users
I realized one statement on the following document, it says equal cost multipath is enabled by default. But it doesn't say which path a packet will use

Tommaso Pecorella

unread,
Apr 11, 2024, 6:18:24 PM4/11/24
to ns-3-users
Good finding. According to the code, if the attribute is set to false (by default it is false), the 1st route is chosen. If I'm correct (I might be wrong) the 1st route is the one that is printed first.
Reply all
Reply to author
Forward
0 new messages