diff mbox series

[v4] qemu.rst: slirp port forwarding details

Message ID 20221111102151.7159-1-atanas.bunchev@konsulko.com
State New
Headers show
Series [v4] qemu.rst: slirp port forwarding details | expand

Commit Message

Atanas Bunchev Nov. 11, 2022, 10:21 a.m. UTC
Explains the default behavior of `runqemu slirp`.
Explains how to forward ports from the guest to the host machine.

Signed-off-by: Atanas Bunchev <atanas.bunchev@konsulko.com>
---
 documentation/dev-manual/qemu.rst | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Quentin Schulz Nov. 11, 2022, 10:29 a.m. UTC | #1
Hi Atanas,

On 11/11/22 11:21, Atanas Bunchev wrote:
> Explains the default behavior of `runqemu slirp`.
> Explains how to forward ports from the guest to the host machine.
> 
> Signed-off-by: Atanas Bunchev <atanas.bunchev@konsulko.com>

Thank your for the patch and prompt updates,

Reviewed-by: Quentin Schulz <foss+yocto@0leil.net>

Cheers,
Quentin
Michael Opdenacker Nov. 21, 2022, 2:46 p.m. UTC | #2
Atanas, Quentin

Thanks for the patch and reviews!

On 11/11/22 11:29, Quentin Schulz via lists.yoctoproject.org wrote:
> Hi Atanas,
>
> On 11/11/22 11:21, Atanas Bunchev wrote:
>> Explains the default behavior of `runqemu slirp`.
>> Explains how to forward ports from the guest to the host machine.
>>
>> Signed-off-by: Atanas Bunchev <atanas.bunchev@konsulko.com>
>
> Thank your for the patch and prompt updates,
>
> Reviewed-by: Quentin Schulz <foss+yocto@0leil.net>


Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
... and merged into "master-next".

Thanks again

Michael.
diff mbox series

Patch

diff --git a/documentation/dev-manual/qemu.rst b/documentation/dev-manual/qemu.rst
index 5a4a82ce6..03a05c071 100644
--- a/documentation/dev-manual/qemu.rst
+++ b/documentation/dev-manual/qemu.rst
@@ -426,6 +426,29 @@  command line:
    networking that does not need root access but also is not as easy to
    use or comprehensive as the default.
 
+   Using ``slirp`` by default will forward the guest machine's
+   22 and 23 TCP ports to host machine's 2222 and 2323 ports
+   (or the next free ports). Specific forwarding rules can be configured
+   by setting ``QB_SLIRP_OPT`` as environment variable or in ``qemuboot.conf``
+   in the :term:`Build Directory` ``deploy/image`` directory.
+   Examples::
+
+      QB_SLIRP_OPT="-netdev user,id=net0,hostfwd=tcp::8080-:80"
+
+      QB_SLIRP_OPT="-netdev user,id=net0,hostfwd=tcp::8080-:80,hostfwd=tcp::2222-:22"
+
+   The first example forwards TCP port 80 from the emulated system to
+   port 8080 (or the next free port) on the host system,
+   allowing access to http server running in QEMU from
+   ``http://<host ip>:8080/``.
+
+   The second example does the same, but also forwards TCP port 22 on the
+   guest system to 2222 (or the next free port) on the host system,
+   allowing ssh access to the emulated system using
+   ``ssh -P 2222 <user>@<host ip>``.
+
+   Keep in mind that proper configuration of firewall software is required.
+
 -  ``kvm``: Enables KVM when running "qemux86" or "qemux86-64" QEMU
    architectures. For KVM to work, all the following conditions must be
    met: