When using the SLiRP user networking (default), this option allows to forward ports to/from the host/guest.
If the NixOS firewall on the virtual machine is enabled, you also have to open the guest ports to enable the traffic between host and guest.
Currently QEMU supports only IPv4 forwarding.
Declarations
Type
list of (submodule)
Default
[ ]
Example
[ # forward local port 2222 -> 22, to ssh into the VM
{ from = "host"; host.port = 2222; guest.port = 22; }
# forward local port 80 -> 10.0.2.10:80 in the VLAN
{ from = "guest";
guest.address = "10.0.2.10"; guest.port = 80;
host.address = "127.0.0.1"; host.port = 80;
}
]