2020-11-04 20:37:51 +08:00
|
|
|
.. _networking_with_ieee802154_qemu:
|
|
|
|
|
|
|
|
Networking with QEMU and IEEE 802.15.4
|
|
|
|
######################################
|
|
|
|
|
|
|
|
.. contents::
|
|
|
|
:local:
|
|
|
|
:depth: 2
|
|
|
|
|
|
|
|
This page describes how to set up a virtual network between two QEMUs that
|
|
|
|
are connected together via UART and are running IEEE 802.15.4 link layer
|
|
|
|
between them. Note that this only works in Linux host.
|
|
|
|
|
|
|
|
Basic Setup
|
|
|
|
***********
|
|
|
|
|
|
|
|
For the steps below, you will need two terminal windows:
|
|
|
|
|
|
|
|
* Terminal #1 is terminal window with ``echo-server`` Zephyr sample application.
|
|
|
|
* Terminal #2 is terminal window with ``echo-client`` Zephyr sample application.
|
|
|
|
|
2020-11-04 21:24:10 +08:00
|
|
|
If you want to capture the transferred network data, you must compile the
|
|
|
|
``monitor_15_4`` program in ``net-tools`` directory.
|
|
|
|
|
|
|
|
Open a terminal window and type:
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
cd $ZEPHYR_BASE/../net-tools
|
|
|
|
make monitor_15_4
|
|
|
|
|
|
|
|
|
2020-11-04 20:37:51 +08:00
|
|
|
Step 1 - Compile and start echo-server
|
|
|
|
======================================
|
|
|
|
|
|
|
|
In terminal #1, type:
|
|
|
|
|
|
|
|
.. zephyr-app-commands::
|
|
|
|
:zephyr-app: samples/net/sockets/echo_server
|
|
|
|
:host-os: unix
|
|
|
|
:board: qemu_x86
|
|
|
|
:build-dir: server
|
2023-05-17 19:24:35 +08:00
|
|
|
:gen-args: -DEXTRA_CONF_FILE=overlay-qemu_802154.conf
|
2020-11-04 20:37:51 +08:00
|
|
|
:goals: server
|
|
|
|
:compact:
|
|
|
|
|
2020-11-04 21:24:10 +08:00
|
|
|
If you want to capture the network traffic between the two QEMUs, type:
|
|
|
|
|
|
|
|
.. zephyr-app-commands::
|
|
|
|
:zephyr-app: samples/net/sockets/echo_server
|
|
|
|
:host-os: unix
|
|
|
|
:board: qemu_x86
|
|
|
|
:build-dir: server
|
2023-05-17 19:24:35 +08:00
|
|
|
:gen-args: -G'Unix Makefiles' -DEXTRA_CONF_FILE=overlay-qemu_802154.conf -DPCAP=capture.pcap
|
2020-11-04 21:24:10 +08:00
|
|
|
:goals: server
|
|
|
|
:compact:
|
|
|
|
|
|
|
|
Note that the ``make`` must be used for ``server`` target if packet capture
|
|
|
|
option is set in command line. The ``build/server/capture.pcap`` file will contain the
|
|
|
|
transferred data.
|
|
|
|
|
2020-11-04 20:37:51 +08:00
|
|
|
Step 2 - Compile and start echo-client
|
|
|
|
======================================
|
|
|
|
|
|
|
|
In terminal #2, type:
|
|
|
|
|
|
|
|
.. zephyr-app-commands::
|
|
|
|
:zephyr-app: samples/net/sockets/echo_client
|
|
|
|
:host-os: unix
|
|
|
|
:board: qemu_x86
|
|
|
|
:build-dir: client
|
2023-05-17 19:24:35 +08:00
|
|
|
:gen-args: -DEXTRA_CONF_FILE=overlay-qemu_802154.conf
|
2020-11-04 20:37:51 +08:00
|
|
|
:goals: client
|
|
|
|
:compact:
|
|
|
|
|
|
|
|
You should see data passed between the two QEMUs.
|
|
|
|
Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
|