To implement the Wired Local Area Networks (LANs) in OMNeT++ has needs to design and emulate the network that custom the wired communication protocols like Ethernet to connect devices. The OMNeT++ with the INET framework delivers the detailed support for emulating wired LANs. The given below are the procedures on how to implement the wired LAN in OMNeT++ using the INET framework:
Step-by-Step Implementation:
Make sure we have OMNeT++ and the INET Framework installed.
Generate a new NED file to describe network topology that contains hosts and switches connected through Ethernet.
Example: Wired LAN Network Topology (WiredLANNetwork.ned)
package wiredlan;
import inet.node.inet.StandardHost;
import inet.node.ethernet.EtherSwitch;
network WiredLANNetwork
{
parameters:
@display(“bgb=800,400”);
submodules:
host1: StandardHost {
@display(“p=100,200”);
}
host2: StandardHost {
@display(“p=300,200”);
}
host3: StandardHost {
@display(“p=500,200”);
}
switch: EtherSwitch {
@display(“p=300,100”);
}
connections allowunconnected:
host1.ethg++ <–> Eth100M <–> switch.ethg++;
host2.ethg++ <–> Eth100M <–> switch.ethg++;
host3.ethg++ <–> Eth100M <–> switch.ethg++;
}
Create an OMNeT++ initialization file to configure the parameters of the simulation.
Example: Configuration File (omnetpp.ini)
network = wiredlan.WiredLANNetwork
sim-time-limit = 100s
# Visualization
*.visualizer.canvasVisualizer.displayBackground = true
*.visualizer.canvasVisualizer.displayGrid = true
# Host Configuration
*.host*.numApps = 1
*.host*.app[0].typename = “UdpBasicApp”
*.host*.app[0].destAddresses = “host3”
*.host*.app[0].destPort = 5000
*.host*.app[0].messageLength = 1024B
*.host*.app[0].sendInterval = 1s
# Switch Configuration
*.switch.numPorts = 3
# IP Address Configuration
*.host1.ipv4.config = xmldoc(“host1.xml”)
*.host2.ipv4.config = xmldoc(“host2.xml”)
*.host3.ipv4.config = xmldoc(“host3.xml”)
Create XML files to describe the IP address configuration for each node.
Example: IP Configuration File for host1 (host1.xml)
<config>
<interface>
<name>eth0</name>
<address>192.168.1.1</address>
<netmask>255.255.255.0</netmask>
</interface>
</config>
Example: IP Configuration File for host2 (host2.xml)
<config>
<interface>
<name>eth0</name>
<address>192.168.1.2</address>
<netmask>255.255.255.0</netmask>
</interface>
</config>
Example: IP Configuration File for host3 (host3.xml)
<config>
<interface>
<name>eth0</name>
<address>192.168.1.3</address>
<netmask>255.255.255.0</netmask>
</interface>
</config>
To mimic the characteristics of applications running on the hosts then use pre-defined application modules in the INET framework or implements your own.
Example: UDP Basic Application (Pseudo-Code)
#include <omnetpp.h>
#include <inet/applications/udpapp/UdpBasicApp.h>
using namespace omnetpp;
using namespace inet;
class CustomUdpApp : public UdpBasicApp
{
protected:
virtual void initialize(int stage) override;
virtual void handleMessageWhenUp(cMessage *msg) override;
};
Define_Module(CustomUdpApp);
void CustomUdpApp::initialize(int stage) {
UdpBasicApp::initialize(stage);
if (stage == INITSTAGE_APPLICATION_LAYER) {
// Custom initialization code
}
}
void CustomUdpApp::handleMessageWhenUp(cMessage *msg) {
UdpBasicApp::handleMessageWhenUp(msg);
// Custom message handling code
}
In the end, we discussed the elaborated guide to implement the Wired Local Area Networks (LANs) in OMNeT++ that emulate the network then custom Ethernet to connect devices. If you have any doubts regarding the wired local area network we will provide it.
For assistance with project performance on Wired LANs in OMNeT++, you can count on our expertise. Just share your details with us, and we’ll provide the simulation support you need.