summary refs log tree commit diff
path: root/nixos/doc/manual/development
diff options
context:
space:
mode:
authorNiklas Hambüchen <mail@nh2.me>2023-11-11 01:22:13 +0100
committerJörg Thalheim <Mic92@users.noreply.github.com>2023-11-11 15:40:55 +0100
commitf9611764c699fe98ad45996f3c87b9bdd14db716 (patch)
tree0b1b7f23592d1b167d66b01f613a1916822a85c3 /nixos/doc/manual/development
parent73b4398b583d344c7ca01ae32dc02074700d9c82 (diff)
downloadnixpkgs-f9611764c699fe98ad45996f3c87b9bdd14db716.tar
nixpkgs-f9611764c699fe98ad45996f3c87b9bdd14db716.tar.gz
nixpkgs-f9611764c699fe98ad45996f3c87b9bdd14db716.tar.bz2
nixpkgs-f9611764c699fe98ad45996f3c87b9bdd14db716.tar.lz
nixpkgs-f9611764c699fe98ad45996f3c87b9bdd14db716.tar.xz
nixpkgs-f9611764c699fe98ad45996f3c87b9bdd14db716.tar.zst
nixpkgs-f9611764c699fe98ad45996f3c87b9bdd14db716.zip
manual: Fix QEMU_NET_OPTS VM-side address.
In my earlier commit

    manual: Don't suggest exposing VM port to local network.

I made a side change titled

    Use `127.0.0.1` also on the VM side, otherwise connections to
    services that, in the VM, bind to `127.0.0.1` only
    (doing the safe approach) do not work.

Unfortunately, that was wrong:

QEMU inside the VM always communicates via the virtualised
Ethernet interface, not via the VM's loopback interface.
So trying to connect to `127.0.0.1` on the VM's side cannot work.
Diffstat (limited to 'nixos/doc/manual/development')
-rw-r--r--nixos/doc/manual/development/running-nixos-tests-interactively.section.md7
1 files changed, 6 insertions, 1 deletions
diff --git a/nixos/doc/manual/development/running-nixos-tests-interactively.section.md b/nixos/doc/manual/development/running-nixos-tests-interactively.section.md
index a816213f37d..4b8385d7e0d 100644
--- a/nixos/doc/manual/development/running-nixos-tests-interactively.section.md
+++ b/nixos/doc/manual/development/running-nixos-tests-interactively.section.md
@@ -62,7 +62,7 @@ where socat is running.
 If your test has only a single VM, you may use e.g.
 
 ```ShellSession
-$ QEMU_NET_OPTS="hostfwd=tcp:127.0.0.1:2222-127.0.0.1:22" ./result/bin/nixos-test-driver
+$ QEMU_NET_OPTS="hostfwd=tcp:127.0.0.1:2222-:22" ./result/bin/nixos-test-driver
 ```
 
 to port-forward a port in the VM (here `22`) to the host machine (here port `2222`).
@@ -73,6 +73,11 @@ since a single port on the host cannot forward to multiple VMs.
 If the test defines multiple machines, you may opt to _temporarily_ set
 `virtualisation.forwardPorts` in the test definition for debugging.
 
+Such port forwardings connect via the VM's virtual network interface.
+Thus they cannot connect to ports that are only bound to the VM's
+loopback interface (`127.0.0.1`), and the VM's NixOS firewall
+must be configured to allow these connections.
+
 ## Reuse VM state {#sec-nixos-test-reuse-vm-state}
 
 You can re-use the VM states coming from a previous run by setting the