To develop the Multicast Routing Projects Using NS3 involves simulating a multicast routing network using NS3’s modules. Multicast routing is necessary for effective the collection of communication in networks, we decrease the redundant transmissions through forwarding a data packets only once to multiple destinations. In NS-3, multicast routing can be executed it utilized the Internet Group Management Protocol (IGMP) and Protocol Independent Multicast (PIM-SM or PIM-DM).
Steps to Develop a Multicast Routing Project in NS3
- Install and Setup NS3
We enable the NS-3 is installed:
git clone
cd ns-3-dev
./ns3 configure –enable-examples –enable-tests
./ns3 build
- Define a Network Topology
Multicast needs at least one sender and several receivers.
Example: Generate a Network Topology
NodeContainer nodes;
nodes.Create(6); // 6 nodes for the multicast group
Join the nodes for utilize a point-to-Point connections
PointToPointHelper p2p;
p2p.SetDeviceAttribute(“DataRate”, StringValue(“1Gbps”));
p2p.SetChannelAttribute(“Delay”, StringValue(“2ms”));
NetDeviceContainer devices01 = p2p.Install(nodes.Get(0), nodes.Get(1));
NetDeviceContainer devices12 = p2p.Install(nodes.Get(1), nodes.Get(2));
NetDeviceContainer devices13 = p2p.Install(nodes.Get(1), nodes.Get(3));
NetDeviceContainer devices34 = p2p.Install(nodes.Get(3), nodes.Get(4));
NetDeviceContainer devices35 = p2p.Install(nodes.Get(3), nodes.Get(5));
- We allocate the IP Addresses
InternetStackHelper stack;
stack.Install(nodes);
Ipv4AddressHelper address;
address.SetBase(“10.1.1.0”, “255.255.255.0”);
Ipv4InterfaceContainer interfaces01 = address.Assign(devices01);
address.SetBase(“10.1.2.0”, “255.255.255.0”);
Ipv4InterfaceContainer interfaces12 = address.Assign(devices12);
address.SetBase(“10.1.3.0”, “255.255.255.0”);
Ipv4InterfaceContainer interfaces13 = address.Assign(devices13);
address.SetBase(“10.1.4.0”, “255.255.255.0”);
Ipv4InterfaceContainer interfaces34 = address.Assign(devices34);
address.SetBase(“10.1.5.0”, “255.255.255.0”);
Ipv4InterfaceContainer interfaces35 = address.Assign(devices35);
- Enable Multicast Routing
We assure the multicast routing, you must:
- Enable Multicast Forwarding
- Define Multicast Group Addresses
- Use PIM-SM or IGMP for Group Management
(A) Permit the Multicast Forwarding
Ipv4StaticRoutingHelper multicastRouting;
Ptr<Ipv4> ipv4 = nodes.Get(1)->GetObject<Ipv4>();
Ptr<Ipv4StaticRouting> staticRouting = multicastRouting.GetStaticRouting(ipv4);
staticRouting->SetDefaultMulticastRoute(1); // Forward packets to interface 1
(B) Allot for Multicast Group Address
Ipv4Address multicastGroup(“225.1.2.4”);
(C) Link the Multicast Group
Receivers must link the multicast group:
Ptr<Ipv4MulticastRoutingTableEntry> entry = Create<Ipv4MulticastRoutingTableEntry>();
entry->SetGroup(multicastGroup);
staticRouting->AddMulticastRoute(entry);
- We configure a congestion using UDP Multicast
uint16_t multicastPort = 9;
OnOffHelper multicastServer(“ns3::UdpSocketFactory”, Address(InetSocketAddress(multicastGroup, multicastPort)));
multicastServer.SetAttribute(“DataRate”, StringValue(“500Kbps”));
multicastServer.SetAttribute(“PacketSize”, UintegerValue(512));
ApplicationContainer serverApp = multicastServer.Install(nodes.Get(0)); // Sender
serverApp.Start(Seconds(1.0));
serverApp.Stop(Seconds(10.0));
PacketSinkHelper multicastClient(“ns3::UdpSocketFactory”, Address(InetSocketAddress(multicastGroup, multicastPort)));
ApplicationContainer clientApp = multicastClient.Install(NodeContainer(nodes.Get(4), nodes.Get(5))); // Receivers
clientApp.Start(Seconds(1.0));
clientApp.Stop(Seconds(10.0));
- Assist the Tracing for Debugging
AsciiTraceHelper ascii;
p2p.EnableAsciiAll(ascii.CreateFileStream(“multicast-routing.tr”));
p2p.EnablePcapAll(“multicast-routing”);
- Execute the method for Simulation
Simulator::Run();
Simulator::Destroy();
- Examine the outcomes
The NetAnim used for vision the results:
./waf –run multicast-routing
netanim
- Extend with Advanced Features
- QoS-Aware in Multicast Routing
- Energy-Efficient on Multicast Routing
- PIM-SM (Protocol Independent Multicast – Sparse Mode)
- Multicast in 5G and IoT Networks
This project will explore you more ideas on how the multicast routing projects simulated and evaluated the outcomes using the tool of ns3 simulation. If needed, we will deliver the detailed structured entire execution process in another manual.