Skip to contentSkip to conversation

qemu.rst: slirp port forwarding details

PATCH Superseded Atanas Bunchev 2 participants 2 messages Nov 10, 2022

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 qemu.rst: slirp port forwarding details

Explains the default behavior of runqemu slirp. Explains how to forward ports from the guest to the host machine.

---
 documentation/dev-manual/qemu.rst | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
documentation/dev-manual/qemu.rst +22 -0
index 5a4a82ce6..bdfa8f3e3 100644
@@ -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:
Signature · 1 line
2.37.4
#1 lore raw

Hi Atanas,

Quoted 13 lines · Atanas Bunchev

Explains the default behavior of runqemu slirp. Explains how to forward ports from the guest to the host machine.

---
  documentation/dev-manual/qemu.rst | 22 ++++++++++++++++++++++
  1 file changed, 22 insertions(+)
documentation/dev-manual/qemu.rst +0 -0
index 5a4a82ce6..bdfa8f3e3 100644

documentation/dev-manual/qemu.rst command line: · line 432

Quoted 7 lines
documentation/dev-manual/qemu.rst +4 -0
@@ -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?).

documentation/dev-manual/qemu.rst command line: · line 434

Quoted 2 lines
documentation/dev-manual/qemu.rst +2 -0
+   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