2019-02-19 16:42:07 +08:00
|
|
|
.. _networking_with_host:
|
|
|
|
|
|
|
|
Networking with the host system
|
|
|
|
###############################
|
|
|
|
|
2019-02-24 19:39:14 +08:00
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 1
|
|
|
|
:hidden:
|
|
|
|
|
2023-11-10 18:54:11 +08:00
|
|
|
native_sim_setup.rst
|
2019-02-24 19:39:14 +08:00
|
|
|
qemu_eth_setup.rst
|
|
|
|
qemu_setup.rst
|
|
|
|
usbnet_setup.rst
|
2020-05-06 07:56:52 +08:00
|
|
|
qemu_user_setup.rst
|
2020-05-08 19:48:46 +08:00
|
|
|
networking_with_multiple_instances.rst
|
2024-09-11 01:07:13 +08:00
|
|
|
eth_bridge_native_sim_setup.rst
|
2020-11-04 20:37:51 +08:00
|
|
|
qemu_802154_setup.rst
|
2023-02-12 16:27:33 +08:00
|
|
|
armfvp_user_networking_setup.rst
|
2019-02-24 19:39:14 +08:00
|
|
|
|
2019-02-19 16:42:07 +08:00
|
|
|
While developing networking software, it is usually necessary to connect and
|
|
|
|
exchange data with the host system like a Linux desktop computer.
|
|
|
|
Depending on what board is used for development, the following options are
|
|
|
|
possible:
|
|
|
|
|
|
|
|
* QEMU using SLIP (Serial Line Internet Protocol).
|
|
|
|
|
|
|
|
* Here IP packets are exchanged between Zephyr and the host system via serial
|
|
|
|
port. This is the legacy way of transferring data. It is also quite slow so
|
|
|
|
use it only when necessary. See :ref:`networking_with_qemu` for details.
|
|
|
|
|
|
|
|
* QEMU using built-in Ethernet driver.
|
|
|
|
|
|
|
|
* Here IP packets are exchanged between Zephyr and the host system via QEMU's
|
|
|
|
built-in Ethernet driver. Not all QEMU boards support built-in Ethernet so
|
|
|
|
in some cases, you might need to use the SLIP method for host connectivity.
|
|
|
|
See :ref:`networking_with_eth_qemu` for details.
|
|
|
|
|
2020-05-06 07:56:52 +08:00
|
|
|
* QEMU using SLIRP (Qemu User Networking).
|
|
|
|
|
|
|
|
* QEMU User Networking is implemented using "slirp", which provides a full TCP/IP
|
|
|
|
stack within QEMU and uses that stack to implement a virtual NAT'd network. As
|
|
|
|
this support is built into QEMU, it can be used with any model and requires no
|
|
|
|
admin privileges on the host machine, unlike TAP. However, it has several
|
|
|
|
limitations including performance which makes it less valuable for practical
|
|
|
|
purposes. See :ref:`networking_with_user_qemu` for details.
|
|
|
|
|
2023-02-12 16:27:33 +08:00
|
|
|
* Arm FVP (User Mode Networking).
|
|
|
|
|
|
|
|
* User mode networking emulates a built-in IP router and DHCP server, and
|
|
|
|
routes TCP and UDP traffic between the guest and host. It uses the user mode
|
|
|
|
socket layer of the host to communicate with other hosts. This allows
|
|
|
|
the use of a significant number of IP network services without requiring
|
|
|
|
administrative privileges, or the installation of a separate driver on
|
|
|
|
the host on which the model is running. See :ref:`networking_with_armfvp`
|
|
|
|
for details.
|
|
|
|
|
2023-11-10 19:07:22 +08:00
|
|
|
* native_sim board.
|
2019-02-19 16:42:07 +08:00
|
|
|
|
2019-02-28 05:55:32 +08:00
|
|
|
* The Zephyr instance can be executed as a user space process in the host
|
2019-02-19 16:42:07 +08:00
|
|
|
system. This is the most convenient way to debug the Zephyr system as one
|
|
|
|
can attach host debugger directly to the running Zephyr instance. This
|
|
|
|
requires that there is an adaptation driver in Zephyr for interfacing
|
2024-02-23 21:58:54 +08:00
|
|
|
with the host system. Two possible network drivers can be used for this
|
|
|
|
purpose, a TAP virtual Ethernet driver and an offloaded sockets driver.
|
2023-11-10 18:54:11 +08:00
|
|
|
See :ref:`networking_with_native_sim` for details.
|
2019-02-19 16:42:07 +08:00
|
|
|
|
|
|
|
* USB device networking.
|
|
|
|
|
|
|
|
* Here, the Zephyr instance is run on a real board and the connectivity to
|
|
|
|
the host system is done via USB.
|
|
|
|
See :ref:`usb_device_networking_setup` for details.
|
2020-05-08 19:48:46 +08:00
|
|
|
|
|
|
|
* Connecting multiple Zephyr instances together.
|
|
|
|
|
2023-11-10 19:07:22 +08:00
|
|
|
* If you have multiple Zephyr instances, either QEMU or native_sim ones,
|
2020-05-08 19:48:46 +08:00
|
|
|
and want to create a connection between them, see
|
|
|
|
:ref:`networking_with_multiple_instances` for details.
|
2020-11-04 20:37:51 +08:00
|
|
|
|
|
|
|
* Simulating IEEE 802.15.4 network between two QEMUs.
|
|
|
|
|
|
|
|
* Here, two Zephyr instances are running and there is IEEE 802.15.4 link layer
|
|
|
|
run over an UART between them.
|
|
|
|
See :ref:`networking_with_ieee802154_qemu` for details.
|
2024-09-11 01:07:13 +08:00
|
|
|
|
|
|
|
* Simulating Ethernet bridge network with native_sim.
|
|
|
|
|
|
|
|
* Here, one Zephyr instance is running with Ethernet bridge enabled
|
|
|
|
via :kconfig:option:`CONFIG_NET_ETHERNET_BRIDGE` Kconfig option. There
|
|
|
|
exists two host network interfaces ``zeth0`` and ``zeth1`` and the network
|
|
|
|
packets are bridged between those two interfaces.
|
|
|
|
See :ref:`networking_with_native_sim_eth_bridge` for details.
|