Skip to main content

Dockemu: An IoT Simulation Framework Based on Linux Containers and the ns-3 Network Simulator — Application to CoAP IoT Scenarios

  • Conference paper
  • First Online:
Simulation and Modeling Methodologies, Technologies and Applications (SIMULTECH 2018)

Abstract

Large-scale and realistic simulations have been a pending issue in IoT research and development, hampering the design and optimization of networked systems. This paper presents new features added to the Dockemu open-source project, aimed at making it a valuable framework for such studies. The framework is based on the use of Linux Docker containers for the individual constrained nodes, and the ns-3 network simulator to emulate the network and connect the nodes during the simulation. Both technologies combined enable the capacity to simulate a huge number of lightweight nodes under realistic network conditions. The Linux interface mechanism used to interconnect the containers and the ns-3 simulation are described in detail. We also explain how LTE and LR-WPAN network technologies were added to the framework in order to cover a wide range of scenarios. Details on how Ansible has been used to orchestrate the setup and execution of the testing framework are given, too, showing how this widely-used devops tool can replace different programming and scripting languages for the orchestration of a simulation framework. Finally, the paper includes an example of IoT scenario simulation, using a real implementation of the CoAP protocol and involving a relevant number of nodes.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://www.nsnam.org/.

  2. 2.

    https://github.com/chepeftw/NS3DockerEmulator.

  3. 3.

    Security is a key point in IoT deployments since it normally controls and monitors critical infrastructures, and also due to the huge number of devices and the difficulties to update the software in many constrained devices. An extensive report of MQTT and CoAP vulnerabilities and attack patterns detected in production devices can be found at [14].

  4. 4.

    The Ansible version of Dockemu framework presented in this paper is publicly available under GPLv3 license at: https://github.com/antonroman/dockemu-ansible. In doing so, we try to follow good practices [15] in terms of research impact and reproducibility.

  5. 5.

    https://github.com/contiki-ng/contiki-ng/wiki/Docker.

  6. 6.

    https://github.com/megakilo/FreeRTOS-Sim.

  7. 7.

    https://p4.org/.

  8. 8.

    We started to use the term hybrid in [27] to refer to simulations where some of the elements is not simulated but a real element, like the client/server software in Dockemu. With ‘pure simulation’ we refer to simulations where all the elements (nodes, IoT software, networks, etc.) are simulated.

  9. 9.

    ns-3 supports distributed simulations as explained in Sect. 7.1.

  10. 10.

    http://www.smplsft.com/SimpleIoTSimulator.html.

  11. 11.

    https://www.tetcos.com/.

  12. 12.

    http://www.cupcarbon.com/.

  13. 13.

    https://github.com/bounceur/CupCarbon.

  14. 14.

    https://nodered.org/.

  15. 15.

    https://js.foundation/.

  16. 16.

    https://www.iot-lab.info/.

  17. 17.

    Ansible Best Practices to write playbooks and organize the files can be found in Ansible doc site: https://docs.ansible.com/.

  18. 18.

    The roles are the way that Ansible separates groups of actions to be performed in the server.

  19. 19.

    Please note that it is a .cc which must be re-compiled even when we refer to it as a script.

  20. 20.

    The container can not execute the client or server daemon just after being started but it must start with a few-second (at least 10 s) delay to make sure the network interfaces are connected to ns-3.

  21. 21.

    /var/run/netns.

  22. 22.

    eNodeB comes from E-UTRAN Node B and it is the name given to base stations in LTE, the hardware which connects the mobile devices (UE in LET terminology) and the rest of the network.

  23. 23.

    The name of the module used to simulate wired Ethernet networks in ns-3 is called CSMA.

  24. 24.

    This means in Virtual Box terminology that a full physical CPU is assigned to the virtual CPU.

  25. 25.

    Please note that modern hypervisors does not consume all the reserved RAM when the virtual machine is launched but it is used under demand, however the RAM required to keep the system up and running.

  26. 26.

    glibc is the GNU C Library used by most Linux distributions.

  27. 27.

    This page contains a very detailed comparison of performance and characteristics of the main C libraries http://www.etalabs.net/compare_libcs.html.

  28. 28.

    Playbook is the name given by Ansible framework to the scripts where all the instruction needed to carry out a task are written.

  29. 29.

    The CSMA model can be considered very close to a Ethernet cabled network.

  30. 30.

    International Electrotechnical Comission.

  31. 31.

    IKEA smartlights are one of the most well-known examples of CoAP usage in mass market products: https://learn.pimoroni.com/tutorial/sandyj/controlling-ikea-tradfri-lights-from-your-pi.

  32. 32.

    https://github.com/antonroman/dockemu-ansible.

  33. 33.

    In our case the packet loss can be simulated by both ns-3 and also by the libcoap reference applications [23] used for the tests.

  34. 34.

    This scenario is not recommended by [11] however is neither forbidden by the RFC nor the current CoAP libraries.

  35. 35.

    https://www.nsnam.org/docs/models/html/distributed.html.

  36. 36.

    https://www.open-mpi.org/.

References

  1. 3GPP: Standardization of NB-IOT completed (2016). http://www.3gpp.org/news-events/3gpp-news/1785-nb_iot_complete. Accessed 3 Mar 2019

  2. Cohn, R.J., et al.: Mqtt version 3.1.1. http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html

  3. Bai, J., Bi, J., Kuang, P., Fan, C., Zhou, Y., Zhang, C.: NS4: enabling programmable data plane simulation. In: Proceedings of the Symposium on SDN Research, SOSR 2018, pp. 12:1–12:7. ACM, New York (2018). https://doi.org/10.1145/3185467.3185470, http://doi.acm.org/10.1145/3185467.3185470

  4. Baldo, N., Requena-Esteso, M., Núñez-Martínez, J., Portoles-Comeras, M., Nin-Guerrero, J., Dini, P., Mangues-Bafalluy, J.: Validation of the IEEE 802.11 MAC model in the ns3 simulator using the EXTREME testbed. In: SimuTools (2010)

    Google Scholar 

  5. Bormann, C., Shelby, Z.: Block-Wise Transfers in the Constrained Application Protocol (CoAP). RFC 7959 (Proposed Standard), August 2016. https://doi.org/10.17487/RFC7959, https://www.rfc-editor.org/rfc/rfc7959.txt

  6. D’Angelo, G., Ferretti, S., Ghini, V.: Simulation of the internet of things. CoRR abs/1605.04876 (2016). http://arxiv.org/abs/1605.04876

  7. Docker-Team: Best practices for writing dockerfiles. https://docs.docker.com/develop/develop-images/dockerfile_best-practices/. Accessed 3 Jan 2019

  8. Ebert, C., Gallardo, G., Hernantes, J., Serrano, N.: DevOps. IEEE Softw. 33(3), 94–100 (2016). https://doi.org/10.1109/MS.2016.68

    Article  Google Scholar 

  9. Gupta, S.G., Ghonge, M., Thakare, P.D.P.M., Jawandhiya, P.: Open-source network simulation tools an overview. Int. J. Adv. Res. Comput. Eng. Technol. 2 (2013)

    Google Scholar 

  10. Gluhak, A., Krco, S., Nati, M., Pfisterer, D., Mitton, N., Razafindralambo, T.: A survey on facilities for experimental internet of things research. IEEE Commun. Mag. 49(11), 58–67 (2011). https://doi.org/10.1109/MCOM.2011.6069710

    Article  Google Scholar 

  11. Hartke, C.: Observing Resources in the Constrained Application Protocol (CoAP). RFC 7641 (Proposed Standard), September 2015. https://doi.org/10.17487/RFC7641, https://www.rfc-editor.org/rfc/rfc7641.txt

  12. Hasan, A.B., Kiong, T., Paw, J.K., Musa, A.B., Mohamed, H.: Real-time video streaming over NS3-based emulated LTE networks. Int. J. Electron., Comput. Commun. Technol. 4 (2017). https://www.researchgate.net/publication/282219796_Real-Time_Video_Streaming_over_NS3-based_Emulated_LTE_Networks

  13. Iglesias Urkia, M., Urbieta, A., Parra, J., Casado Mansilla, D.: IEC 61850 meets CoAP: towards the integration of smart grids and IoT standards, pp. 1–9, October 2017. https://doi.org/10.1145/3131542.3131545

  14. Maggi, F., Vosseler, R., Quarta, D.: The fragility of industrial IoT’s data backbone - security and privacy issues in MQTT and CoAP protocols. Trend Micro Res. (2018). https://documents.trendmicro.com/assets/white_papers/wp-the-fragility-of-industrial-IoTs-data-backbone.pdf

  15. Patrick Vandewalle, J.K., Vetterli, M.: Reproducible research in signal processing. IEEE Signal Process. Mag. 37, 47 (2009). https://infoscience.epfl.ch/record/136640/files/VandewalleKV09.pdf

  16. Pei, G., Henderson, T.R.: Validation of OFDM error rate model in ns-3 (2010)

    Google Scholar 

  17. Pino, D.: Network namespaces. https://blogs.igalia.com/dpino/2016/04/10/network-namespaces/ (2016). Accessed 22 Apr 2018

  18. Rampf, S.: Network simulation and its limitations. In: Seminar Future Internet SS2013 (2010)

    Google Scholar 

  19. ur Rehman Khan, A., Bilal, S.M., Othman, M.: A performance comparison of network simulators for wireless networks. CoRR abs/1307.4129 (2013)

    Google Scholar 

  20. Rescorla, E., Modadugu, N.: Datagram Transport Layer Security Version 1.2. RFC 6347 (Proposed Standard), January 2012. https://doi.org/10.17487/RFC6347, https://www.rfc-editor.org/rfc/rfc6347.txt

  21. Román, A., López, M.: Dockemu: extension of a scalable network simulation framework based on Docker and NS3 to cover IoT scenarios. In: Proceedings of 8th International Conference on Simulation and Modeling Methodologies, Technologies and Applications (SIMULTECH). INSTICC, INSTICC, Porto, Portugal, July 2018

    Google Scholar 

  22. Sharma, P., Chaufournier, L., Shenoy, P., Tay, Y.C.: Containers and virtual machines at scale: a comparative study. In: Proceedings of the 17th International Middleware Conference, Middleware 2016, pp. 1:1–1:13. ACM, New York (2016). https://doi.org/10.1145/2988336.2988337, http://doi.acm.org/10.1145/2988336.2988337

  23. libcoap team: libcoap: A CoAP (RFC 7252) implementation in C (2019). Accessed 12 Jan 2019. https://github.com/obgm/libcoap

  24. NS3 Team: Mobility model library guide (2018). Accessed 21 Apr 2018. https://www.nsnam.org/docs/models/html/mobility.html

  25. NS3 Team: Mobility model library guide (2018). Accessed 22 Apr 2018. https://www.nsnam.org/docs/models/html/tap.html

  26. NS3 Team: NB-IOT guide (2019). Accessed 3 Mar 2019. https://www.nsnam.org/wiki/NB-IOT

  27. To, M.A., Cano, M., Biba, P.: DOCKEMU – a network emulation tool. In: 2015 IEEE 29th International Conference on Advanced Information Networking and Applications Workshops. IEEE, March 2015. https://doi.org/10.1109/waina.2015.107

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Antón Román Portabales .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Portabales, A.R., Nores, M.L. (2020). Dockemu: An IoT Simulation Framework Based on Linux Containers and the ns-3 Network Simulator — Application to CoAP IoT Scenarios. In: Obaidat, M., Ören, T., Rango, F. (eds) Simulation and Modeling Methodologies, Technologies and Applications. SIMULTECH 2018. Advances in Intelligent Systems and Computing, vol 947. Springer, Cham. https://doi.org/10.1007/978-3-030-35944-7_4

Download citation

Publish with us

Policies and ethics