diff mbox series

[v3] qemu.rst: slirp port forwarding details

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

Commit Message

Atanas Bunchev Nov. 10, 2022, 6:36 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 | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

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

On 11/10/22 07:36, 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>
> ---
>   documentation/dev-manual/qemu.rst | 22 ++++++++++++++++++++++
>   1 file changed, 22 insertions(+)
> 
> diff --git a/documentation/dev-manual/qemu.rst b/documentation/dev-manual/qemu.rst
> index 5a4a82ce6..bdfa8f3e3 100644
> --- a/documentation/dev-manual/qemu.rst
> +++ b/documentation/dev-manual/qemu.rst
> @@ -426,6 +426,28 @@ 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`` in ``qemuboot.conf``.

I didn't catch this one earlier sorry. Can you add where this conf file 
should be located?

In the same document, we say it's in "in the Build Directory 
deploy/image directory" (with a ref for Build directory), can you do the 
same (or better if there's a possible ref to the build/tmp/deploy/image 
directory somewhere?).

> +   Examples::
> +

I would remove this line and end the previous one with :: only (no dot 
required) but that's a matter of taste, up to you.

Cheers,
Quentin
diff mbox series

Patch

diff --git a/documentation/dev-manual/qemu.rst b/documentation/dev-manual/qemu.rst
index 5a4a82ce6..bdfa8f3e3 100644
--- a/documentation/dev-manual/qemu.rst
+++ b/documentation/dev-manual/qemu.rst
@@ -426,6 +426,28 @@  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`` in ``qemuboot.conf``.
+   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: