Part 1
요약·해설
SLIRP 기본 network와 gateway, extra argument 전달 방식, performance·ICMP·dynamic port·IPv6 제약을 설명합니다.
10.0.2.0/24 · DHCP
Host 8080 ↔ Guest 8080
ICMP · IPv6 · Performance
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
C4CFCFD36C63F3943BBE651D3538E58A7A1772A6A2C169A18907CF593D33D636
.. _networking_with_user_qemu:
Networking with QEMU User
#############################
.. contents::
:local:
:depth: 2
This page is intended to serve as a starting point for anyone interested in
using QEMU SLIRP with Zephyr.
Introduction
*************
SLIRP is a network backend which provides the complete TCP/IP stack within
QEMU and uses that stack to implement a virtual NAT'd network. As there are
no dependencies on the host, SLIRP is simple to setup.
By default, QEMU uses the ``10.0.2.X/24`` network and runs a gateway at
``10.0.2.2``. All traffic intended for the host network has to travel through
this gateway, which will filter out packets based on the QEMU command line
parameters. This gateway also functions as a DHCP server for all GOS,
allowing them to be automatically assigned with an IP address starting from
``10.0.2.15``.
More details about User Networking can be obtained from here:
https://wiki.qemu.org/Documentation/Networking#User_Networking_.28SLIRP.29
Using SLIRP with Zephyr
************************
In order to use SLIRP with Zephyr, the user has to set the Kconfig option to
enable User Networking.
.. code-block:: cfg
CONFIG_NET_QEMU_USER=y
Once this configuration option is enabled, all QEMU launches will use SLIRP.
In the default configuration, Zephyr only enables User Networking, and does
not pass any arguments to it. This means that the Guest will only be able to
communicate to the QEMU gateway, and any data intended for the host machine
will be dropped by QEMU.
In general, QEMU User Networking can take in a lot of arguments including,
* Information about host/guest port forwarding. This must be provided to
create a communication channel between the guest and host.
* Information about network to use. This may be valuable if the user does
not want to use the default ``10.0.2.X`` network.
* Tell QEMU to start DHCP server at user-defined IP address.
* ID and other information.
As this information varies with every use case, it is difficult to come up
with good defaults that work for all. Therefore, Zephyr Implementation
offloads this to the user, and expects that they will provide arguments
based on requirements. For this, there is a Kconfig string which can be
populated by the user.
.. code-block:: cfg
CONFIG_NET_QEMU_USER_EXTRA_ARGS="net=192.168.0.0/24,hostfwd=tcp::8080-:8080"
This option is appended as-is to the QEMU command line. Therefore, any problems with
this command line will be reported by QEMU only. Here's what this particular
example will do,
* Make QEMU use the ``192.168.0.0/24`` network instead of the default.
* Enable forwarding of any TCP data received from port 8080 of host to port
8080 of guest, and vice versa.
Limitations
*************
If the user does not have any specific networking requirements other than the
ability to access a web page from the guest, user networking (slirp) is a
good choice. However, it has several limitations
* There is a lot of overhead so the performance is poor.
* The guest is not directly accessible from the host or the external network.
* In general, ICMP traffic does not work (so you cannot use ping within a guest).
* As port mappings need to be defined before launching qemu, clients which use
dynamically generated ports cannot communicate with external network.
* There is a bug in the SLIRP implementation which filters out all IPv6 packets
from the guest. See https://bugs.launchpad.net/qemu/+bug/1724590 for details.
Therefore, IPv6 will not work with User Networking.
Part 3
한국어 전문 번역
QEMU User Networking
이 문서는 Zephyr에서 QEMU SLIRP를 사용하려는 사용자를 위한 시작점입니다.
소개
SLIRP는 QEMU 내부에 완전한 TCP/IP stack을 제공하고 이를 이용해 virtual NAT network를 만드는 network backend입니다. Host dependency가 없어 설정이 간단합니다.
QEMU 기본 network는 10.0.2.X/24이며 10.0.2.2에서 gateway를 실행합니다. Host network로 향하는 모든 traffic은 이 gateway를 통과하며 QEMU command-line parameter에 따라 packet이 filter됩니다.
Gateway는 모든 guest operating system(GOS)의 DHCP server 역할도 하며 10.0.2.15부터 IP address를 자동 할당합니다.
QEMU User Networking의 추가 내용은 QEMU networking documentation을 참고하십시오.
Zephyr에서 SLIRP 사용
Zephyr에서 SLIRP를 사용하려면 User Networking Kconfig option을 활성화합니다.
CONFIG_NET_QEMU_USER=y이 option을 켜면 모든 QEMU 실행이 SLIRP를 사용합니다. Zephyr 기본 configuration은 User Networking만 켜고 별도 인자를 전달하지 않습니다.
따라서 guest는 QEMU gateway하고만 통신할 수 있고 host machine으로 보내려는 data는 QEMU가 폐기합니다.
QEMU User Networking은 일반적으로 다음 정보를 인자로 받을 수 있습니다.
- Guest와 host 사이 communication channel을 만들기 위한 host/guest port forwarding 정보
- 기본
10.0.2.X대신 사용할 network 정보 - QEMU DHCP server를 시작할 사용자 지정 IP address
- ID와 그 밖의 정보
이 값은 use case마다 달라 모두에게 적합한 기본값을 만들기 어렵습니다. Zephyr implementation은 설정을 사용자에게 맡기며 requirement에 맞는 argument를 제공할 것으로 기대합니다.
사용자는 다음 Kconfig string에 argument를 넣습니다.
CONFIG_NET_QEMU_USER_EXTRA_ARGS="net=192.168.0.0/24,hostfwd=tcp::8080-:8080"이 option은 QEMU command line에 그대로 append됩니다. 잘못된 command line은 QEMU만 report합니다. 위 예는 다음을 수행합니다.
192.168.0.0/24network를 QEMU 기본 network 대신 사용합니다.- Host TCP port 8080으로 수신한 data를 guest port 8080으로 전달하고 반대 방향도 forwarding합니다.
제한 사항
Guest에서 web page에 접근하는 것 외에 특별한 network 요구가 없다면 user networking(SLIRP)은 좋은 선택이지만 다음 제약이 있습니다.
- Overhead가 커 performance가 낮습니다.
- Host나 external network에서 guest에 직접 접근할 수 없습니다.
- 일반적으로 ICMP traffic이 동작하지 않아 guest 안에서 ping을 사용할 수 없습니다.
- QEMU를 시작하기 전에 port mapping을 정의해야 하므로 동적으로 생성한 port를 쓰는 client는 external network와 통신할 수 없습니다.
- SLIRP implementation bug가 guest의 모든 IPv6 packet을 filter하므로 User Networking에서는 IPv6가 동작하지 않습니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.