IPv6 support for hostfwd + guestfwd
Currently, hostfwd does only forward IPv4 traffic. It's not possible to specify an IPv6 address.
There has been a patchset around. I'm not sure why it hasn't been merged yet. Latest incarnation: https://www.mail-archive.com/qemu-devel@nongnu.org/msg814483.html
Host environment
- Operating system: nixos-unstable
- OS/kernel version: Linux 6.12.18 #1-NixOS SMP PREEMPT_DYNAMIC Fri Mar 7 17:25:47 UTC 2025 x86_64 GNU/Linux
- Architecture: x86-64
- QEMU flavor: qemu-system-x86_64
- QEMU version: master (1dae461a)
- QEMU command line:
qemu-system-x86_64 -M q35 -m 4096 -enable-kvm -hda Arch-Linux-x86_64-basic.qcow2 \ -net nic,netdev=user.0,model=virtio \ -netdev user,id=user.0,hostfwd=tcp::52022-:22
Emulated/Virtualized environment
- Operating system: Arch Linux
- OS/kernel version: Linux archlinux 6.13.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 13 Mar 2025 18:12:00 +0000 x86_64 GNU/Linux
- Architecture: x86-64
Description of problem
When using hostfwd, only IPv4 connections are forwarded.
Steps to reproduce
- Start vm with the aforementioned command using a system image that comes with a socket listening on both IPv4 and IPv6. (I used Arch Linux Box which comes with
sshdenabled by default). - Connect to the forwarded socket:
- IPv4 succeeds:
ssh -oPasswordAuthentication=yes arch@127.0.0.1 -p 52022nc -zv 127.0.0.1 52022
- IPv6 does not:
ssh -oPasswordAuthentication=yes arch@::1 -p 52022nc -zv ::1 52022
Additional information
Patches
- [PATCH v7 0/4] Add support for ipv6 host forwarding
- [PATCH v7 4/4] net: Extend host forwarding to support IPv6
Other times requested
Edited by Frédéric