How to Customize CORE Network Emulator Services

November 26, 2014 — 7 Comments

When setting up a complex network scenario in the CORE Network Emulator, we may want to change the default configurations provided by CORE services. Fortunately, the CORE Network Emulator allows the user to customize services.

A user may want to customize CORE services in order to:

  • set up complex network emulation scenarios by adding more configuration information to required CORE services
  • simplify network emulation scenarios by removing default configurations from CORE Services
  • enable the CORE GUI to execute user-generated scripts or commands on network nodes while running a simulation
  • save customized configurations on each node in the CORE Network Emulator configuration file.

In this post, we will work through a detailed tutorial that shows how to customize the IPForward service. The steps we follow in this tutorial can be applied, generally, to customize any other CORE service.

The IPForward CORE Service

The IPForward CORE Service provides a script that runs when the node starts in a simulation scenario. The script sets the IP Forwarding kernel parameters so that the node will forward packets from one port to another, according to the routing table on the node. The IPForward script is a default service on the Router node type.

Why customize this service?

The default IPForward CORE service has limited functionality: it can start IP forwarding on a node but it offers no commands to manipulate those settings while the node is running. We will custiomize it to add more functionality.

We want to add a “Shutdown” command to the IPForward service. This will allow us to use menu commands on the CORE GUI to modify the IP Forwarding setting on the node while the simulation is running. Adding this Shutdown command allows us to create a “silent failure” in the simulated network that would be useful when testing the behavior of networking protocols.

Set up a scenario

We will demonstrate how to customize a service using a practical example.

Create a simple network scenario (or load an existing scenario) in the CORE Network Emulator. We need a minimum of three nodes (any L3 node type) with a router node in the middle. In our example, we will create a network as shown below:

Example network scenario. Any topology that includes a router will suffice.

Example network scenario. Any topology that includes a router will suffice.

Please see my previous posts about the CORE Network Emulator if you need to learn how to create a simple network topology using the CORE GUI.

Review the existing IPForward settings

Let’s first look at the default settings of the IPForward service. Right-click on the router node (in our example, we right-click on the router named Router1) and select Services… from the drop-down window. This opens the CORE Services configuration window.

Click on the customize button next to the IPForward service

Click on the customize button next to the IPForward service

We see the services that are already selected on the router by default. To customize the IPForward service, click on the “tools” icon next to the service in the configuration window. This opens up the IPForward service configuration window. The window has three tabs: Files, Directories, and Startup/shutdown. Let’s review the default setting on each tab.

The Files tab

The Files tab shows the files that will be created by the service and their contents. If the file is in a directory other than the virtual node’s home directory, the path will be directory part of the file name (for example: testdir/filename.txt).

The default settings for the Files tab

The default settings for the Files tab

Here we see there is one shell script that will be created by the IPForward CORE service. The script contains a series of commands that configures IP Forwarding for IPv4 and IPv6 packets through the Linux kernel.

The Directories tab

The Directories tab shows that the IPForward CORE service does not create any directories. So, any files created or modified by the service must exist in the virtual node’s home directory or in some other directory that is created by either by the CORE Network Emulator or by some other CORE Service.

The Directories tab: we have nothing to change in this tab

The Directories tab: we have nothing to change in this tab

Only directories to be created by this service on this node will appear in the Directories tab.

The Startup/shutdown tab

The Starup/shutdown tab shows the commands that the CORE Service will execute when the node starts (the Start command), or when a Service command is executed from the CORE GUI when the simulation is running.

The default settings on the Startup/Shutdown tab

The default settings on the Startup/Shutdown tab

We see that the IPForward service provides only a start command, which runs the shell script we saw in the Files tab. This service has no commands to stop or to validate the service. We can see the Shutdown and Validate commands are blank in the service Starup/shutdown tab.

Add “Shutdown” command to the IPForward service

We will create a new shell script in the Files tab in the IPForward service configuration window. The script will contains commands that disable IP Forwarding. Then, we will create a command in the Startup/Shutdown tab that will run the script when the “stop” menu command is selected from the node’s Services menu when the simulation is running.

Edit the Files tab

The startup services command runs a shell script that the service creates as a file when the node starts. We should use the same method when creating our new shutdown command.

To create a new file that will contain the script that runs from the shutdown command, first open the Files tab for the IPForward service.

Then enter a name for the new script in the File name field, such as ipforward-shutdown.sh. Click on the “new file” button that is immediately to the right of the File name field to create the new file. This creates a new file. The contents of the file are already displayed below in the contents field. Note: file contents are changed immediately when you update the contents field so wait until you create the new file before modifying contents.

Enter a new filename (with path, if appropriate) and click on the "create file" button

Enter a new filename (with path, if appropriate) and click on the “create file” button

Now we have a new script file created. You can see we have two scripts associated with this IPForward service on this node. Click on the drop-down button on the file name field and see both files.

The available files can be chosen from the drop-down file picker

The available files can be chosen from the drop-down file picker

Next, we edit the contents of the ipforward-shutdown.sh file. Ensure that we have chosen that file, then eit the contents window to change all the forwarding parameters to zero.

Edit the contents of the script. Changes are automatically saved.

Edit the contents of the script. Changes are automatically saved.

Edit the Startup/shutdown tab

Click on the Startup/shutdown tab. Enter a new command in the Shutdown Commands field. In this case, we add a command to run the ipforward-shutdown.sh script.

Edit the command that runs when the "stop" command is selected; click on the "new command" button

Edit the command that runs when the “stop” command is selected

Click on the “new command” button immediately to the right of the text field. This will add the command to the text window below. This is the command that will run when the stop command (for this service on this node) is executed in the CORE GUI.

See the new command created in the "stop" command field

See the new command created in the “stop” command field

Click the Apply button at the bottom of the IPForward service window. This will save the customizations.

Now we see that the IPForward service on this node has a green icon next to it. This indicates the service has been customized.

The IPForward service is customized, as indicated by the green color

The IPForward service is customized, as indicated by the green color

Scope of customization

The changes we made to the IPForward service only apply to this node, router1.

If we look at the services configured on the other router, router2, in this scenario, we see that the services have not been customized on that router. If we want the same customization on every node, we must repeat this process on every node.

Test the service’s new “stop” command

To see how our customized service operates, start the emulation by clicking on the green Start button on the CORE menu bar. Start a flow of IP packets from the PC node to the Server node. Then use the new customized IPForward service to stop IP forwarding on router1 and see the impact.

Start an IP packet flow

Double-click on the PC node to open a terminal session and start a ping command to the Server node, which has the IP address 10.0.2.10 in this scenario.

root@PC# ping 10.0.2.10

We should see the ping command’s output showing a packet is sent and replied to every second, indicating that IP traffic is flowing between PC and Server across the two routers.

Start a ping command from PC to Server

Start a ping command from PC to Server

Stop IP Forwarding

Stop IPForward on router1. Right-click on router1 and, from the drop-down menu, select the stop command for the IPForward service as shown below.

Stopping IP Forwarding using the CORE GUI with the customized IPForward service

Stopping IP Forwarding using the CORE GUI with the customized IPForward service

IP packet flow is interrupted

Look at the terminal session from PC again.

We see that the ping command has stopped because it is no longer receiving replies from Server. This shows that the flow between PC and Server is interrupted.

Start IP Forwarding again

To start IP Forwarding on router1, right-click on router1 and, from the drop-down menu, select the start command for the IPForward service as shown below.

Start IP Forwarding again

Start IP Forwarding again

IP packet flow is restored

See that the IP packets are forwarded through router1 again. Look at the PC node’s terminal window and see that the ping command is again showing it is receiving responses from the Server node.

Ping traffic resumes. Note the gap in sequence numbers that indicates lost traffic

Ping traffic resumes. Note the gap in sequence numbers that indicates lost traffic

A potentially confusing GUI menu

We saw that, even if a service does not have commands set up to run when one of its service commands is chosen, such as the validate command on the IPForward service, is still available on the GUI.

This could be confusing. The user just has to know which service commands will actually execute commands on the node and which have no functionality. It would be nice if the CORE development team changed the GUI system so that only service commands that have commands configured will appear as an option in the menu.

Save the configuration file

Stop the emulation and save the network scenario using the File → Save menu command on the CORE GUI.

Save the scenario in the .imn format. I observe the .imn format preserves the placement of node names on the canvas, while the .xml does not. If you are particular about how your network diagrams look on the CORE GUI, .iml is the better format.

We can verify that the services configuration is saved by re-loading the network scenario.

Conclusion

We extended the functionality of the IPForward CORE service by customizing the service. While doing this, we showed the procedures that can be used to customize other services.

7 responses to How to Customize CORE Network Emulator Services

  1. Hi Brian

    Thank you very much for your detailed blog. I am just starting to use CORE and this will be a great help.

    I have a question regarding this article. In your discussion of the file formats three extensions are mentioned: .imn, .xml and .iml. Is one of these a typo?

    Kind regards
    Sam

  2. Hi Brian!

    Is there any way to add a DNS server in this emulator? I know we can customize the services but I didn’t find a way to ADD any specific server.

    Thanks!

  3. Hello Brian,
    I am trying to use WLAN in CORE emulator.I want to make the interface of the host in monitor mode but I could only make wlan1 interface in monitor mode.I have to capture 802.11 packets in wireshark for which the interface of host has to be in monitor mode but I am not able to.Kindly suggest a way to solve it.Thanks in advance

Leave a Reply

Text formatting is available via select HTML. <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*