Table Of Contents
Table Of Contents

Using Real Applications in a Simulated Network


In this showcase, we’ll use real applications which communicate over a simulated network. This feature is useful for testing how applications work over the network, without having to set up a physical network. The simulated network can be easily configured for various topologies and behaviors to test a variety of cases.

We’ll use INET’s emulation feature to interface the real world (the host OS environment) with the simulation. INET has various modules which facilitate this interfacing, you can read about them in the Emulation section of the showcases page. In this scenario, we’ll use a real video application to stream a video file to another real video application.

Note that this showcase requires the Emulation feature of the INET Framework to be turned on (it’s off by default), and it only runs on Linux.

INET version: 4.2

The Model

The simulation scenario is illustrated with the following diagram:


In this scenario, a VLC instance in a sender host streams a video file to another VLC instance in a receiver host over the network. The hosts from the link-layer up are real; parts of the link-layer, as well as the physical layer and the network are simulated.

We’ll use the ExtUpperEthernet interface to connect the real and simulated parts of the scenario. The lower part of this interface is present in the simulation, and uses TAP interfaces in the host OS to send and receive packets to and from the upper layers of the host OS.

Note that the real and simulated parts can be separated at other levels of the protocol stack, using other, suitable EXT interface modules, such as at the transport layer (ExtLowerUdp), and the network layer (ExtUpperIpv4, ExtLowerIpv4).

In fact, the real parts of the sender and receiver hosts are running on the same machine, as both use the protocol stack of the host OS (even though in this scenario logically they are different hosts):


We’ll use a VLC instance in the sender host to stream a video file. The packets created by VLC go down the host OS protocol stack and enter the simulation at the Ethernet interface. Then they traverse the simulated network, enter the receiver host’s Ethernet interface, and are injected into the host OS protocol stack, and go up to another VLC instance which plays the video.

The network for the simulation is the following:


It contains two StandardHost’s. Each host is connected by an EtherSwitch to a Router.

The sender VLC application will stream the video to the address of the router’s eth0 in the simulation. The router will perform network address translation to rewrite the destination address to the address of the receiver host’s EXT/TAP interface.

This is required so that the video packets actually enter the simulated network; if they were sent to the receiver host’s EXT/TAP interface, they would go through the loopback interface because the host OS optimizes traffic.

Three shell scripts in the showcase’s directory can be used to control the emulation scenario. The script creates the TAP interfaces, assigns IP addresses to them, and brings them up:

# create TAP interfaces
sudo ip tuntap add mode tap dev tapa
sudo ip tuntap add mode tap dev tapb

# assign IP addresses to interfaces
sudo ip addr add dev tapa
sudo ip addr add dev tapb

# bring up all interfaces
sudo ip link set dev tapa up
sudo ip link set dev tapb up

The script does the opposite; it destroys the TAP interfaces when they’re no longer needed.

# destroy TAP interfaces
sudo ip tuntap del mode tap dev tapa
sudo ip tuntap del mode tap dev tapb

The script starts the simulation, and both video applications:

# start streaming server
cvlc RickAstley.mkv --sout '#transcode{vcodec=h264,acodec=mpga,vb=125k,ab=64k,deinterlace,scale=0.25,threads=2}:rtp{mux=ts,dst=,port=4004}' &

# start streaming client
vlc rtp:// &

# start simulation
inet -u Cmdenv -f omnetpp.ini

# kill child processes
trap 'kill $(jobs -pr)' SIGINT SIGTERM EXIT

In the configuration in omnetpp.ini, the scheduler class is set to RealTimeScheduler so that the simulation can run in the real time of the host OS:

network = VideoStreamingShowcase
scheduler-class = "inet::RealTimeScheduler"
sim-time-limit = 225s

The hosts are configured to have an ExtUpperEthernetInterface, and to use the TAP devices which were created by the setup script. The setup script assigned IP addresses to the TAP interfaces; the EXT interfaces are configured to copy the addresses from the TAP interfaces:

*.host1.eth[0].typename = "ExtUpperEthernetInterface"
*.host1.eth[0].device = "tapa"
*.host1.eth[0].copyConfiguration = "copyFromExt"

*.host2.eth[0].typename = "ExtUpperEthernetInterface"
*.host2.eth[0].device = "tapb"
*.host2.eth[0].copyConfiguration = "copyFromExt"

The addresses in the network are important; the configurator is set to assign the correct addresses so the simulation and the script can work together (the VLC sends the video packets to the router, so its address needs to match as the destination address in the script):

*.configurator.config = xml("<config> \
                                <interface hosts='router' names='eth0' address='' netmask=''/> \
                                <interface hosts='router' names='eth1' address='' netmask=''/> \

Also, the CRC and FCS need to be set to computed to be able to properly serialize/deserialize packets.

**.crcMode = "computed"
**.fcsMode = "computed"


Before running the emulation scenario, run setenv in the omnetpp and inet directories, and run the script in the showcase’s folder:

$ cd ~/workspace/omnetpp
$ . setenv
$ cd ~/workspace/inet
$ . setenv
$ cd showcases/emulation/videostreaming
$ ./

To start the simulation and the VLC instances, run the script:

$ ./

The script starts the simulation in Cmdenv; the streaming VLC client is also started in command line mode. The received video stream is played by the other VLC instance. The received video is lower quality than the original video file, because it’s downscaled, and the bitrate is reduced, so that the playback is smooth.


Emulating the network is CPU-intensive. The downscaling and bitrate settings were chosen to lead to smooth playback on the PC we tested the showcase on. However, it might be able to work in higher quality on a faster machine; the user can experiment with different encoding settings for the VLC streaming instance by editing them in the run script.

Here are some of the packets captured in Wireshark:


Note that there are packets sent from the tapa ( interface to the router’s eth0 ( interface, and also packets sent from the router’s eth1 ( interface to tapb (

Sources: omnetpp.ini, VideostreamingShowcaseNetwork.ned,,,


Use this page in the GitHub issue tracker for commenting on this showcase.